"use client" import type { Transcript } from "@/lib/types" import { ScrollArea } from "@radix-ui/react-scroll-area" import { Separator } from "@radix-ui/react-separator" import { FileText } from "lucide-react" import { useEffect } from "react" import EmptyState from "./empty_state" type Props = { selectedTranscript: Transcript | null selectedTranscripts: Transcript[] } const TranscriptsTab = ({ selectedTranscript, selectedTranscripts }: Props) => { useEffect(() => { if (selectedTranscript) { // wait for 300ms for the transcript to render so it will scroll to the correct position const timeoutId = setTimeout(() => { const transcriptId = "transcript-" + selectedTranscript?.timestamp const transcriptElement = document.getElementById(transcriptId) transcriptElement?.scrollIntoView({ behavior: "smooth", block: "start", }) }, 500) return () => clearTimeout(timeoutId) } }, [selectedTranscript, selectedTranscripts]) return ( {selectedTranscript ? (

{selectedTranscript.filename}

{selectedTranscripts.map((transcript) => (

{transcript.speaker} @ {transcript.timestamp}

{transcript.text}

))}
) : ( )}
) } export default TranscriptsTab