"use client" import { useEffect, useState, useTransition } from "react" import { Post } from "@/types" import { cn } from "@/lib/utils" import { actionman } from "@/lib/fonts" import { useSearchParams } from "next/navigation" import { Button } from "@/components/ui/button" import { Delete } from "./delete" import Link from "next/link" import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip" import { getLatestPosts } from "@/app/server/actions/community" const defaultLimit = 200 export default function FirehosePage() { const searchParams = useSearchParams() const [_isPending, startTransition] = useTransition() const [posts, setPosts] = useState([]) const moderationKey = searchParams ? ((searchParams.get("moderationKey") as string) || "") : "" const limit = searchParams ? (Number((searchParams.get("limit") as string) || defaultLimit)) : defaultLimit const [toDelete, setToDelete] = useState() useEffect(() => { startTransition(async () => { const newPosts = await getLatestPosts({ maxNbPosts: isNaN(limit) || !isFinite(limit) ? defaultLimit : limit, shuffle: false, }) setPosts(newPosts) }) }, []) const handleOnDelete = ({ postId }: Post) => { setPosts(posts.filter(post => post.postId !== postId)) setToDelete(undefined) } return (

AI Clip Factory

{posts.map(post => (
{post.prompt}

{post.prompt}

{new Date(Date.parse(post.createdAt)).toLocaleString()}
{moderationKey ?
: null}
))}
) }