import { Download } from "lucide-react"; import { useState } from "react"; import { ProgressCard } from "@/components/common/progress-card"; import { useTranslation } from "@/contexts/i18n-context"; import { useToolProcessor } from "@/hooks/use-tool-processor"; import { format } from "@/lib/format"; import { useFileStore } from "@/stores/file-store"; const LANGUAGE_OPTIONS = [ { value: "auto", labelKey: "autoDetect" }, { value: "en", label: "English" }, { value: "de", label: "German" }, { value: "fr", label: "French" }, { value: "es", label: "Spanish" }, { value: "zh", label: "Chinese" }, { value: "ja", label: "Japanese" }, { value: "ko", label: "Korean" }, { value: "id", label: "Indonesian" }, { value: "th", label: "Thai" }, { value: "vi", label: "Vietnamese" }, ] as const; const FORMAT_OPTIONS = [ { value: "txt", labelKey: "plainText" }, { value: "srt", label: "SRT" }, { value: "vtt", label: "WebVTT" }, ] as const; export function TranscribeAudioSettings() { const { t } = useTranslation(); const { files } = useFileStore(); const { processFiles, processAllFiles, processing, error, downloadUrl, progress } = useToolProcessor("transcribe-audio"); const [language, setLanguage] = useState("auto"); const [outputFormat, setOutputFormat] = useState("txt"); const ts = t.toolSettings["transcribe-audio"]; const hasFile = files.length > 0; const hasMultiple = files.length > 1; const handleProcess = () => { const settings = { language, outputFormat }; if (hasMultiple) { processAllFiles(files, settings); } else { processFiles(files, settings); } }; const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); handleProcess(); }; return (
{/* Language */}
{/* Output Format */}
{/* Progress / Submit */} {processing && progress ? ( ) : ( )} {/* Error */} {error && (
{error}
)} {/* Download */} {downloadUrl && ( {t.common.download} )} ); }