diff --git a/frontend/src/app/image/convert/page.tsx b/frontend/src/app/image/convert/page.tsx index ca3b1cc..3cb9d5e 100644 --- a/frontend/src/app/image/convert/page.tsx +++ b/frontend/src/app/image/convert/page.tsx @@ -11,14 +11,25 @@ import { ResultPreview } from "@/components/tools/result-preview"; type PageState = "upload" | "processing" | "result" | "error"; +const FORMATS = [ + { value: "jpeg", label: "JPEG (.jpg)" }, + { value: "png", label: "PNG (.png)" }, + { value: "webp", label: "WebP (.webp)" }, + { value: "gif", label: "GIF (.gif)" }, + { value: "bmp", label: "BMP (.bmp)" }, +]; + export default function ImageConvertPage() { const [pageState, setPageState] = useState("upload"); const [jobId, setJobId] = useState(null); const [errorMsg, setErrorMsg] = useState(null); + const [format, setFormat] = useState("jpeg"); + const [quality, setQuality] = useState(85); + const { upload } = useUpload({ tool: "image-convert", - options: { quality: 80 }, + options: { format, quality }, }); const handleComplete = useCallback(() => setPageState("result"), []); @@ -56,48 +67,73 @@ export default function ImageConvertPage() { return ( {pageState === "upload" && ( - +
+ {/* Format + Quality */} +
+

Conversion Settings

+ + + +
+
+ Quality + {quality}% +
+ setQuality(Number(e.target.value))} + className="w-full" + /> +
+ Small file + Best quality +
+
+
+ + +
)} {pageState === "processing" && jobId && ( - + )} {pageState === "result" && result && ( - + )} {pageState === "error" && (
-

- {errorMsg || "Terjadi kesalahan"} -

- +

{errorMsg || "Terjadi kesalahan"}

+
)}
); -} +} \ No newline at end of file diff --git a/frontend/src/app/image/resize/page.tsx b/frontend/src/app/image/resize/page.tsx index b421ec5..c60cae0 100644 --- a/frontend/src/app/image/resize/page.tsx +++ b/frontend/src/app/image/resize/page.tsx @@ -16,9 +16,14 @@ export default function ImageResizePage() { const [jobId, setJobId] = useState(null); const [errorMsg, setErrorMsg] = useState(null); + const [width, setWidth] = useState(1920); + const [height, setHeight] = useState(1080); + const [lockAspect, setLockAspect] = useState(true); + const [quality, setQuality] = useState(85); + const { upload } = useUpload({ tool: "image-resize", - options: { quality: 80 }, + options: { width, height, quality, fit: lockAspect ? "inside" : "fill" }, }); const handleComplete = useCallback(() => setPageState("result"), []); @@ -56,48 +61,91 @@ export default function ImageResizePage() { return ( {pageState === "upload" && ( - +
+ {/* Dimensions */} +
+

Dimensions

+
+ + +
+ +
+ + {/* Quality */} +
+
+ Quality + {quality}% +
+ setQuality(Number(e.target.value))} + className="w-full" + /> +
+ Small file + Best quality +
+
+ + +
)} {pageState === "processing" && jobId && ( - + )} {pageState === "result" && result && ( - + )} {pageState === "error" && (
-

- {errorMsg || "Terjadi kesalahan"} -

- +

{errorMsg || "Terjadi kesalahan"}

+
)}
); -} +} \ No newline at end of file