import { useState } from "react"; import { useFileStore } from "@/stores/file-store"; import { useToolProcessor } from "@/hooks/use-tool-processor"; import { Download, RotateCcw, RotateCw, FlipHorizontal, FlipVertical, } from "lucide-react"; import { ProgressCard } from "@/components/common/progress-card"; export function RotateSettings() { const { files } = useFileStore(); const { processFiles, processing, error, downloadUrl, originalSize, processedSize, progress } = useToolProcessor("rotate"); const [angle, setAngle] = useState(0); const [flipH, setFlipH] = useState(false); const [flipV, setFlipV] = useState(false); const rotateLeft = () => setAngle((a) => (a - 90 + 360) % 360); const rotateRight = () => setAngle((a) => (a + 90) % 360); const handleProcess = () => { processFiles(files, { angle, horizontal: flipH, vertical: flipV, }); }; const hasFile = files.length > 0; const hasChanges = angle !== 0 || flipH || flipV; const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); if (hasFile && hasChanges && !processing) handleProcess(); }; return (
); }