'use client'; import { useState, useMemo } from 'react'; import Link from 'next/link'; import { Plus, Settings, Share2, Play, Users, Building2, ArrowUp, ArrowDown, Globe, UserPlus, Lock, } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Card, CardContent } from '@/components/ui/card'; import { Badge } from '@/components/ui/badge'; import { VideoCard } from '@/components/video-card'; type SortOrder = 'desc' | 'asc'; interface SerializedVideo { id: string; title: string; thumbnailUrl: string; currentVersion: number; commentCount: number; duration: string; lastUpdated: string; updatedAt: string; } interface ProjectContentClientProps { project: { name: string; description: string | null; visibility: string; workspace: { id: string; name: string } | null; members: { role: string }[]; }; projectId: string; videos: SerializedVideo[]; canEdit: boolean; isOwner: boolean; workspaceRole: string | null; } export function ProjectContentClient({ project, projectId, videos, canEdit, isOwner, workspaceRole, }: ProjectContentClientProps) { const [sortOrder, setSortOrder] = useState('desc'); const sortedVideos = useMemo(() => { return [...videos].sort((a, b) => { const dateA = new Date(a.updatedAt).getTime(); const dateB = new Date(b.updatedAt).getTime(); return sortOrder === 'desc' ? dateB - dateA : dateA - dateB; }); }, [videos, sortOrder]); return ( <> {/* Project Header */}

{project.name}

{project.visibility === 'PUBLIC' && } {project.visibility === 'INVITE' && } {project.visibility === 'PRIVATE' && } {project.visibility.toLowerCase()}
{project.workspace && ( {project.workspace.name} )} {project.description && ( {project.description} )}
{/* Sort Button - Left of Share */} {(isOwner || project.members[0]?.role === 'ADMIN') && ( <> )} {canEdit && ( )}
{/* Videos Grid */} {videos.length > 0 ? (
{sortedVideos.map((video) => ( ))}
) : (

No videos yet

Add your first video to start collecting feedback

{canEdit && ( )}
)} ); }