feat: add nsfw toggle to post editor

This commit is contained in:
codytseng
2025-06-27 22:55:21 +08:00
parent 544d65972a
commit 5df33837ab
11 changed files with 94 additions and 88 deletions

View File

@@ -2,17 +2,8 @@ import { cn, isInViewport } from '@/lib/utils'
import { useAutoplay } from '@/providers/AutoplayProvider'
import videoManager from '@/services/video-manager.service'
import { useEffect, useRef } from 'react'
import NsfwOverlay from '../NsfwOverlay'
export default function VideoPlayer({
src,
className,
isNsfw = false
}: {
src: string
className?: string
isNsfw?: boolean
}) {
export default function VideoPlayer({ src, className }: { src: string; className?: string }) {
const { autoplay } = useAutoplay()
const videoRef = useRef<HTMLVideoElement>(null)
const containerRef = useRef<HTMLDivElement>(null)
@@ -48,7 +39,7 @@ export default function VideoPlayer({
}, [autoplay])
return (
<div ref={containerRef} className="relative">
<div ref={containerRef}>
<video
ref={videoRef}
controls
@@ -61,7 +52,6 @@ export default function VideoPlayer({
}}
muted
/>
{isNsfw && <NsfwOverlay className="rounded-lg" />}
</div>
)
}