Spaces:
Running
Running
File size: 1,005 Bytes
f27679f f62b8d3 a3f1817 851546d f62b8d3 a3f1817 f62b8d3 a3f1817 f62b8d3 a3f1817 f62b8d3 a3f1817 f62b8d3 a3f1817 f62b8d3 a3f1817 f62b8d3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
"use client"
import { useEffect, useTransition } from "react"
import { useStore } from "@/app/state/useStore"
import { cn } from "@/lib/utils"
import { VideoList } from "@/app/interface/video-list"
import { getChannelVideos } from "@/app/server/actions/ai-tube-hf/getChannelVideos"
export function PublicChannelView() {
const [_isPending, startTransition] = useTransition()
const publicChannel = useStore(s => s.publicChannel)
const publicVideos = useStore(s => s.publicVideos)
const setPublicVideos = useStore(s => s.setPublicVideos)
useEffect(() => {
if (!publicChannel) {
return
}
startTransition(async () => {
const videos = await getChannelVideos({
channel: publicChannel,
status: "published",
})
setPublicVideos(videos)
})
setPublicVideos([])
}, [publicChannel, publicChannel?.id])
return (
<div className={cn(
`flex flex-col`
)}>
<VideoList
videos={publicVideos}
/>
</div>
)
} |