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"; export function PdfMetadataSettings() { const { t } = useTranslation(); const s = t.toolSettings["pdf-metadata"]; const { files } = useFileStore(); const { processFiles, processAllFiles, processing, error, progress } = useToolProcessor("pdf-metadata"); const [title, setTitle] = useState(""); const [author, setAuthor] = useState(""); const [subject, setSubject] = useState(""); const [keywords, setKeywords] = useState(""); const hasFile = files.length > 0; const hasMultiple = files.length > 1; const handleProcess = () => { const settings: Record = {}; if (title) settings.title = title; if (author) settings.author = author; if (subject) settings.subject = subject; if (keywords) settings.keywords = keywords; if (hasMultiple) { processAllFiles(files, settings); } else { processFiles(files, settings); } }; return (
setTitle(e.target.value)} className="w-full mt-0.5 px-2 py-1.5 rounded border border-border bg-background text-sm text-foreground" />
setAuthor(e.target.value)} className="w-full mt-0.5 px-2 py-1.5 rounded border border-border bg-background text-sm text-foreground" />
setSubject(e.target.value)} className="w-full mt-0.5 px-2 py-1.5 rounded border border-border bg-background text-sm text-foreground" />
setKeywords(e.target.value)} className="w-full mt-0.5 px-2 py-1.5 rounded border border-border bg-background text-sm text-foreground" />
{error &&

{error}

} {processing ? ( ) : ( )}
); }