"use client"; import { X, Copy, CheckCheck, Check } from "lucide-react"; import { useState } from "react"; import type { VideoTranscript } from "../types"; interface TranscriptPanelProps { open: boolean; onClose: () => void; transcript: VideoTranscript | null; } export function TranscriptPanel({ open, onClose, transcript }: TranscriptPanelProps) { const [copiedIndex, setCopiedIndex] = useState(null); const [copiedAll, setCopiedAll] = useState(false); if (!open) return null; const handleCopy = (text: string, index: number) => { navigator.clipboard.writeText(text).then(() => { setCopiedIndex(index); setTimeout(() => setCopiedIndex(null), 2000); }); }; const handleCopyAll = () => { if (!transcript?.transcript) return; const allText = transcript.transcript.join("\n"); navigator.clipboard.writeText(allText).then(() => { setCopiedAll(true); setTimeout(() => setCopiedAll(false), 2000); }); }; if (!transcript?.speech_detected || !transcript.transcript?.length) { return (
e.stopPropagation()} > {/* 头部 */}

语音转录

{/* 内容 */}

该视频暂无语音转录内容

); } return (
e.stopPropagation()} > {/* 头部 */}

语音转录

{transcript.language && (

语言: {transcript.language}

)}
{/* 转录列表 */}
{transcript.transcript.map((text, index) => (
handleCopy(text, index)} >
#{index + 1}

{text}

))}
{/* 底部统计 */}
共 {transcript.transcript.length} 段转录内容
); }