From d67dd18a30063af7938634c66742da55967bf18f Mon Sep 17 00:00:00 2001 From: Siddharth Kumar Sah Date: Mon, 13 Apr 2026 11:46:10 +0800 Subject: [PATCH] feat(stitch): redesign settings UI with grid, alignment, border, radius, quality --- .../src/components/tools/stitch-settings.tsx | 258 ++++++++++++------ 1 file changed, 182 insertions(+), 76 deletions(-) diff --git a/apps/web/src/components/tools/stitch-settings.tsx b/apps/web/src/components/tools/stitch-settings.tsx index 79e985a8..5697d579 100644 --- a/apps/web/src/components/tools/stitch-settings.tsx +++ b/apps/web/src/components/tools/stitch-settings.tsx @@ -1,21 +1,27 @@ -import { ChevronDown, ChevronUp, Download, Loader2 } from "lucide-react"; +import { Download, Loader2 } from "lucide-react"; import { useState } from "react"; import { formatHeaders } from "@/lib/api"; import { useFileStore } from "@/stores/file-store"; -type Direction = "horizontal" | "vertical"; -type ResizeMode = "fit" | "original"; +type Direction = "horizontal" | "vertical" | "grid"; +type ResizeMode = "fit" | "original" | "stretch" | "crop"; +type Alignment = "start" | "center" | "end"; type OutputFormat = "png" | "jpeg" | "webp"; export function StitchSettings() { const { files, processing, error, setProcessing, setError, setProcessedUrl, setSizes, setJobId } = useFileStore(); + const [direction, setDirection] = useState("horizontal"); - const [showAdvanced, setShowAdvanced] = useState(false); + const [gridColumns, setGridColumns] = useState(3); const [resizeMode, setResizeMode] = useState("fit"); + const [alignment, setAlignment] = useState("center"); const [gap, setGap] = useState(0); + const [border, setBorder] = useState(0); + const [cornerRadius, setCornerRadius] = useState(0); const [backgroundColor, setBackgroundColor] = useState("#FFFFFF"); const [format, setFormat] = useState("png"); + const [quality, setQuality] = useState(90); const [downloadUrl, setDownloadUrl] = useState(null); const handleProcess = async () => { @@ -32,7 +38,18 @@ export function StitchSettings() { } formData.append( "settings", - JSON.stringify({ direction, resizeMode, gap, backgroundColor, format }), + JSON.stringify({ + direction, + gridColumns, + resizeMode, + alignment, + gap, + border, + cornerRadius, + backgroundColor, + format, + quality, + }), ); const res = await fetch("/api/v1/tools/stitch", { @@ -62,10 +79,11 @@ export function StitchSettings() { return (
+ {/* Layout */}

Direction

-
- {(["horizontal", "vertical"] as const).map((d) => ( +
+ {(["horizontal", "vertical", "grid"] as const).map((d) => (
- - - {showAdvanced && ( -
-
-

Resize Mode

-
- {(["fit", "original"] as const).map((m) => ( - - ))} -
-
- -
-
- - {gap}px -
- setGap(Number(e.target.value))} - className="w-full mt-1" - /> -
- -
-