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"; type Position = "tl" | "tc" | "tr" | "l" | "c" | "r" | "bl" | "bc" | "br"; export function WatermarkPdfSettings() { const { t } = useTranslation(); const s = t.toolSettings["watermark-pdf"]; const { files } = useFileStore(); const { processFiles, processAllFiles, processing, error, progress } = useToolProcessor("watermark-pdf"); const [text, setText] = useState(""); const [position, setPosition] = useState("c"); const [fontSize, setFontSize] = useState(48); const [opacity, setOpacity] = useState(0.3); const [rotation, setRotation] = useState(45); const hasFile = files.length > 0; const hasMultiple = files.length > 1; const handleProcess = () => { const settings = { text, position, fontSize, opacity, rotation }; if (hasMultiple) { processAllFiles(files, settings); } else { processFiles(files, settings); } }; return (
setText(e.target.value)} className="w-full mt-0.5 px-2 py-1.5 rounded border border-border bg-background text-sm text-foreground" />
setFontSize(Number(e.target.value))} className="w-full mt-0.5 px-2 py-1.5 rounded border border-border bg-background text-sm text-foreground" />
setOpacity(Number(e.target.value))} className="w-full mt-0.5 px-2 py-1.5 rounded border border-border bg-background text-sm text-foreground" />
setRotation(Number(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 ? ( ) : ( )}
); }