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
@@ -1,13 +1,14 @@
import { useState } from "react";
import { useFileStore } from "@/stores/file-store";
import { useToolProcessor } from "@/hooks/use-tool-processor";
import { Download, Loader2 } from "lucide-react";
import { Download } from "lucide-react";
import { ProgressCard } from "@/components/common/progress-card";
type CompressMode = "quality" | "targetSize";
export function CompressSettings() {
const { files } = useFileStore();
const { processFiles, processing, error, downloadUrl, originalSize, processedSize } =
const { processFiles, processing, error, downloadUrl, originalSize, processedSize, progress } =
useToolProcessor("compress");
const [mode, setMode] = useState<CompressMode>("quality");
@@ -108,14 +109,24 @@ export function CompressSettings() {
)}
{/* Process */}
<button
type="submit"
disabled={!hasFile || !canProcess || 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 ? "Compressing..." : "Compress"}
</button>
{processing ? (
<ProgressCard
active={processing}
phase={progress.phase === "idle" ? "uploading" : progress.phase}
label="Compressing"
stage={progress.stage}
percent={progress.percent}
elapsed={progress.elapsed}
/>
) : (
<button
type="submit"
disabled={!hasFile || !canProcess || 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"
>
Compress
</button>
)}
{/* Download */}
{downloadUrl && (