'use client'; import { useQuery } from '@tanstack/react-query'; import { getSourceClips, SourceClip } from '../lib/api'; interface ClipGridProps { projectId: string; } export function ClipGrid({ projectId }: ClipGridProps) { const { data: clips, isLoading, isError, error } = useQuery({ queryKey: ['projects', projectId, 'source-clips'], queryFn: () => getSourceClips(projectId) }); if (isLoading) { return

Loading source clips...

; } if (isError) { return

{error.message}

; } if (!clips || clips.length === 0) { return (
No source clips found yet.
); } return (
{clips.map((clip) => (

{clip.name}

{clip.duration != null && (

Duration: {clip.duration.toFixed(1)}s

)} {clip.waveform_url && (

Waveform: {clip.waveform_url}

)}
))}
); }