From 93cca6d2d09582dff151e96bc9253050119f5640 Mon Sep 17 00:00:00 2001 From: Jan-Henrik Bruhn Date: Sat, 20 Dec 2025 20:01:25 +0100 Subject: [PATCH] feature: Migrate ProgressMonitor to shadcn/ui and improve styling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Migrated ProgressMonitor component to use shadcn Card, Button, and Progress components. Removed redundant state visual indicator section that duplicated information already shown by progress bars, color blocks, and action buttons. Changed active thread block styling from vibrant accent colors to muted grays for better visual hierarchy. Changes: - Replaced outer div with shadcn Card component - Migrated header to use CardHeader with CardTitle and CardDescription - Replaced custom progress bars with shadcn Progress components - Migrated all action buttons (Resume Sewing, Start Sewing, Start Mask Trace) to shadcn Button - Removed redundant state visual indicator section (Ready/Active/Complete status) - Removed unused imports (getStateVisualInfo and related icons) - Applied consistent Card padding (p-0 gap-0, explicit CardHeader and CardContent padding) - Changed active thread block from accent colors to muted grays (border, background, icon, progress bar) - Removed violet border override on active color swatch 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- src/components/ProgressMonitor.tsx | 148 ++++++++--------------------- 1 file changed, 41 insertions(+), 107 deletions(-) diff --git a/src/components/ProgressMonitor.tsx b/src/components/ProgressMonitor.tsx index 5a82a40..1c9be6a 100644 --- a/src/components/ProgressMonitor.tsx +++ b/src/components/ProgressMonitor.tsx @@ -7,10 +7,6 @@ import { ArrowRightIcon, CircleStackIcon, PlayIcon, - CheckBadgeIcon, - ClockIcon, - PauseCircleIcon, - ExclamationCircleIcon, ChartBarIcon, ArrowPathIcon, } from "@heroicons/react/24/solid"; @@ -19,9 +15,11 @@ import { canStartSewing, canStartMaskTrace, canResumeSewing, - getStateVisualInfo, } from "../utils/machineStateHelpers"; import { calculatePatternTime } from "../utils/timeCalculation"; +import { Card, CardHeader, CardTitle, CardDescription, CardContent } from "@/components/ui/card"; +import { Button } from "@/components/ui/button"; +import { Progress } from "@/components/ui/progress"; export function ProgressMonitor() { // Machine store @@ -55,8 +53,6 @@ export function ProgressMonitor() { const isMaskTraceComplete = machineStatus === MachineStatus.MASK_TRACE_COMPLETE; - const stateVisual = getStateVisualInfo(machineStatus); - // Use PEN stitch count as fallback when machine reports 0 total stitches const totalStitches = patternInfo ? patternInfo.totalStitches === 0 && pesData?.penStitches @@ -158,34 +154,22 @@ export function ProgressMonitor() { return () => window.removeEventListener("resize", checkScrollable); }, [colorBlocks]); - const stateIndicatorColors = { - idle: "bg-info-50 dark:bg-info-900/20 border-info-600", - info: "bg-info-50 dark:bg-info-900/20 border-info-600", - active: "bg-warning-50 dark:bg-warning-900/20 border-warning-500", - waiting: "bg-warning-50 dark:bg-warning-900/20 border-warning-500", - warning: "bg-warning-50 dark:bg-warning-900/20 border-warning-500", - complete: "bg-success-50 dark:bg-success-900/20 border-success-600", - success: "bg-success-50 dark:bg-success-900/20 border-success-600", - interrupted: "bg-danger-50 dark:bg-danger-900/20 border-danger-600", - error: "bg-danger-50 dark:bg-danger-900/20 border-danger-600", - danger: "bg-danger-50 dark:bg-danger-900/20 border-danger-600", - }; - return ( -
-
- -
-

- Sewing Progress -

- {sewingProgress && ( -

- {progressPercent.toFixed(1)}% complete -

- )} + + +
+ +
+ Sewing Progress + {sewingProgress && ( + + {progressPercent.toFixed(1)}% complete + + )} +
-
+ + {/* Pattern Info */} {patternInfo && ( @@ -220,12 +204,10 @@ export function ProgressMonitor() { {/* Progress Bar */} {sewingProgress && (
-
-
-
+
@@ -249,49 +231,6 @@ export function ProgressMonitor() {
)} - {/* State Visual Indicator */} - {patternInfo && - (() => { - const iconMap = { - ready: ( - - ), - active: ( - - ), - waiting: ( - - ), - complete: ( - - ), - interrupted: ( - - ), - error: ( - - ), - }; - - return ( -
-
- {iconMap[stateVisual.iconName]} -
-
-
- {stateVisual.label} -
-
- {stateVisual.description} -
-
-
- ); - })()} - {/* Color Blocks */} {colorBlocks.length > 0 && (
@@ -326,8 +265,8 @@ export function ProgressMonitor() { isCompleted ? "border-success-600 bg-success-50 dark:bg-success-900/20" : isCurrent - ? "border-accent-600 bg-accent-50 dark:bg-accent-900/20 shadow-lg shadow-accent-600/20 animate-pulseGlow" - : "border-gray-200 dark:border-gray-600 bg-gray-300 dark:bg-gray-800/50 opacity-70" + ? "border-gray-400 dark:border-gray-500 bg-white dark:bg-gray-700" + : "border-gray-200 dark:border-gray-600 bg-gray-100 dark:bg-gray-800/50 opacity-70" }`} role="listitem" aria-label={`Thread ${block.colorIndex + 1}, ${block.stitchCount} stitches, ${isCompleted ? "completed" : isCurrent ? "in progress" : "pending"}`} @@ -338,7 +277,6 @@ export function ProgressMonitor() { className="w-7 h-7 rounded-lg border-2 border-gray-300 dark:border-gray-600 shadow-md flex-shrink-0" style={{ backgroundColor: block.threadHex, - ...(isCurrent && { borderColor: "#9333ea" }), }} title={`Thread color: ${block.threadHex}`} aria-label={`Thread color ${block.threadHex}`} @@ -395,7 +333,7 @@ export function ProgressMonitor() { /> ) : isCurrent ? ( ) : ( @@ -408,17 +346,11 @@ export function ProgressMonitor() { {/* Progress bar for current block */} {isCurrent && ( -
-
-
+ )}
); @@ -436,36 +368,37 @@ export function ProgressMonitor() {
{/* Resume has highest priority when available */} {canResumeSewing(machineStatus) && ( - + )} {/* Start Sewing - primary action, takes more space */} {canStartSewing(machineStatus) && !canResumeSewing(machineStatus) && ( - + )} {/* Start Mask Trace - secondary action */} {canStartMaskTrace(machineStatus) && ( - + )}
-
+ + ); }