feat(web): add ProgressCard to non-AI tool settings (Group A)

Replace Loader2 spinner buttons with ProgressCard in all 13 non-AI tool
settings components that use useToolProcessor. Each now shows upload
progress, elapsed time, and processing phase during operations.
This commit is contained in:
Siddharth Kumar Sah
2026-03-23 01:45:58 +08:00
parent 60945fd3b3
commit 5c64b306ea
13 changed files with 272 additions and 130 deletions
@@ -2,13 +2,14 @@ import { useState } from "react";
import { SOCIAL_MEDIA_PRESETS } from "@stirling-image/shared";
import { useFileStore } from "@/stores/file-store";
import { useToolProcessor } from "@/hooks/use-tool-processor";
import { Download, Link, Unlink, Loader2 } from "lucide-react";
import { Download, Link, Unlink } from "lucide-react";
import { ProgressCard } from "@/components/common/progress-card";
type FitMode = "contain" | "cover" | "fill" | "inside" | "outside";
export function ResizeSettings() {
const { files } = useFileStore();
const { processFiles, processing, error, downloadUrl, originalSize, processedSize } =
const { processFiles, processing, error, downloadUrl, originalSize, processedSize, progress } =
useToolProcessor("resize");
const [mode, setMode] = useState<"pixels" | "percentage">("pixels");
@@ -187,14 +188,24 @@ export function ResizeSettings() {
)}
{/* Process button */}
<button
type="submit"
disabled={!hasFile || processing}
className="w-full py-2.5 rounded-lg bg-primary text-primary-foreground font-medium disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2"
>
{processing && <Loader2 className="h-4 w-4 animate-spin" />}
{processing ? "Processing..." : "Resize"}
</button>
{processing ? (
<ProgressCard
active={processing}
phase={progress.phase === "idle" ? "uploading" : progress.phase}
label="Resizing"
stage={progress.stage}
percent={progress.percent}
elapsed={progress.elapsed}
/>
) : (
<button
type="submit"
disabled={!hasFile || processing}
className="w-full py-2.5 rounded-lg bg-primary text-primary-foreground font-medium disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2"
>
Resize
</button>
)}
{/* Download */}
{downloadUrl && (