mirror of
https://github.com/jhbruhn/respira.git
synced 2026-01-27 18:33:41 +00:00
504 lines
12 KiB
Markdown
504 lines
12 KiB
Markdown
# Quick UI Improvements - Action Guide
|
||
|
||
This is a condensed, actionable guide for immediately improving the SKiTCH Controller UI. For detailed analysis, see `UI_DESIGN_ANALYSIS.md`.
|
||
|
||
---
|
||
|
||
## Priority 1: Color System (30 minutes)
|
||
|
||
### Create Design Tokens File
|
||
|
||
**File: `src/styles/design-tokens.css`**
|
||
|
||
```css
|
||
@theme {
|
||
/* Primary - Blue */
|
||
--color-primary: #2563eb;
|
||
--color-primary-light: #3b82f6;
|
||
--color-primary-dark: #1d4ed8;
|
||
|
||
/* Secondary - Slate */
|
||
--color-secondary: #64748b;
|
||
--color-secondary-light: #94a3b8;
|
||
|
||
/* Success - Green */
|
||
--color-success: #16a34a;
|
||
--color-success-bg: #dcfce7;
|
||
|
||
/* Warning - Amber */
|
||
--color-warning: #d97706;
|
||
--color-warning-bg: #fef3c7;
|
||
|
||
/* Danger - Red */
|
||
--color-danger: #dc2626;
|
||
--color-danger-bg: #fee2e2;
|
||
|
||
/* Info - Cyan */
|
||
--color-info: #0891b2;
|
||
--color-info-bg: #cffafe;
|
||
|
||
/* Neutral */
|
||
--color-neutral-50: #f9fafb;
|
||
--color-neutral-100: #f3f4f6;
|
||
--color-neutral-200: #e5e7eb;
|
||
--color-neutral-300: #d1d5db;
|
||
--color-neutral-600: #4b5563;
|
||
--color-neutral-900: #111827;
|
||
}
|
||
```
|
||
|
||
Import in `App.css`:
|
||
```css
|
||
@import "tailwindcss";
|
||
@import "./styles/design-tokens.css";
|
||
```
|
||
|
||
### Find & Replace Color Classes
|
||
|
||
**Throughout all components:**
|
||
|
||
```tsx
|
||
// Primary action buttons
|
||
bg-blue-600 → bg-primary
|
||
bg-blue-700 → bg-primary-dark
|
||
hover:bg-blue-700 → hover:bg-primary-light
|
||
|
||
// Text colors
|
||
text-blue-900 → text-primary-dark
|
||
text-blue-800 → text-primary
|
||
text-gray-600 → text-neutral-600
|
||
text-gray-900 → text-neutral-900
|
||
|
||
// Backgrounds
|
||
bg-gray-50 → bg-neutral-50
|
||
bg-gray-100 → bg-neutral-100
|
||
|
||
// Borders
|
||
border-gray-300 → border-neutral-300
|
||
```
|
||
|
||
---
|
||
|
||
## Priority 2: Button States (20 minutes)
|
||
|
||
### Standard Button Classes
|
||
|
||
**Replace all button classes with these variants:**
|
||
|
||
```tsx
|
||
// PRIMARY BUTTON (Connect, Upload, Start Sewing)
|
||
className="
|
||
px-6 py-3
|
||
bg-primary text-white
|
||
rounded-lg font-semibold text-sm
|
||
shadow-sm
|
||
hover:bg-primary-light hover:shadow-md
|
||
active:bg-primary-dark active:scale-[0.98]
|
||
focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2
|
||
disabled:bg-neutral-300 disabled:text-neutral-500 disabled:cursor-not-allowed
|
||
transition-all duration-150
|
||
cursor-pointer
|
||
"
|
||
|
||
// SECONDARY BUTTON (Mask Trace)
|
||
className="
|
||
px-6 py-3
|
||
bg-white text-neutral-700 border border-neutral-300
|
||
rounded-lg font-semibold text-sm
|
||
shadow-sm
|
||
hover:bg-neutral-50 hover:border-neutral-400
|
||
active:bg-neutral-100 active:scale-[0.98]
|
||
focus:outline-none focus:ring-2 focus:ring-neutral-400 focus:ring-offset-2
|
||
disabled:bg-neutral-50 disabled:text-neutral-400 disabled:cursor-not-allowed
|
||
transition-all duration-150
|
||
cursor-pointer
|
||
"
|
||
|
||
// DANGER BUTTON (Delete, Disconnect)
|
||
className="
|
||
px-6 py-3
|
||
bg-danger text-white
|
||
rounded-lg font-semibold text-sm
|
||
shadow-sm
|
||
hover:bg-red-700 hover:shadow-md
|
||
active:bg-red-800 active:scale-[0.98]
|
||
focus:outline-none focus:ring-2 focus:ring-danger focus:ring-offset-2
|
||
disabled:bg-neutral-300 disabled:text-neutral-500 disabled:cursor-not-allowed
|
||
transition-all duration-150
|
||
cursor-pointer
|
||
"
|
||
|
||
// ICON BUTTON (Zoom controls)
|
||
className="
|
||
w-10 h-10
|
||
flex items-center justify-center
|
||
bg-white border border-neutral-300
|
||
rounded-lg
|
||
text-neutral-700
|
||
hover:bg-primary hover:text-white hover:border-primary
|
||
active:bg-primary-dark active:scale-95
|
||
focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2
|
||
transition-all duration-150
|
||
cursor-pointer
|
||
"
|
||
```
|
||
|
||
**KEY CHANGES:**
|
||
- Remove `disabled:grayscale-[0.3]` everywhere
|
||
- Add `active:scale-[0.98]` for press feedback
|
||
- Add `focus:ring-2` for accessibility
|
||
- Use semantic color tokens
|
||
|
||
---
|
||
|
||
## Priority 3: Typography Scale (15 minutes)
|
||
|
||
### Standard Text Classes
|
||
|
||
**Apply throughout components:**
|
||
|
||
```tsx
|
||
// Headings
|
||
h1: "text-2xl font-bold text-neutral-900" // Main title
|
||
h2: "text-xl font-semibold text-neutral-900" // Section titles
|
||
h3: "text-base font-semibold text-neutral-900" // Subsections
|
||
h4: "text-sm font-semibold text-neutral-700" // Small headings
|
||
|
||
// Body text
|
||
"text-base text-neutral-900" // Large body
|
||
"text-sm text-neutral-700" // Regular body
|
||
"text-xs text-neutral-600" // Small text
|
||
"text-[11px] text-neutral-500" // Caption (minimal use)
|
||
```
|
||
|
||
### Quick Fixes
|
||
|
||
**WorkflowStepper.tsx:**
|
||
```tsx
|
||
// Line 102: Make step labels larger
|
||
<div className="text-sm font-semibold"> {/* was text-xs */}
|
||
```
|
||
|
||
**ProgressMonitor.tsx:**
|
||
```tsx
|
||
// Line 169: Larger thread labels
|
||
<span className="text-sm flex-1 font-semibold"> {/* was unlabeled size */}
|
||
|
||
// Line 179: More readable stitch counts
|
||
<span className="text-sm text-neutral-600 font-medium"> {/* was text-xs */}
|
||
```
|
||
|
||
**PatternCanvas.tsx:**
|
||
```tsx
|
||
// Line 278: Clearer thread legend text
|
||
<span className="text-sm text-neutral-900">Thread {index + 1}</span> {/* was text-xs */}
|
||
```
|
||
|
||
---
|
||
|
||
## Priority 4: Spacing Consistency (15 minutes)
|
||
|
||
### Standard Card Padding
|
||
|
||
**Apply to all card components:**
|
||
|
||
```tsx
|
||
// Standard card
|
||
<div className="bg-white p-6 rounded-lg shadow-md border border-neutral-100">
|
||
|
||
// Compact card (ProgressMonitor)
|
||
<div className="bg-white p-5 rounded-lg shadow-md border border-neutral-100">
|
||
```
|
||
|
||
### Standard Section Spacing
|
||
|
||
```tsx
|
||
// Between major sections
|
||
<div className="flex flex-col gap-6">
|
||
|
||
// Within sections
|
||
<div className="space-y-4">
|
||
|
||
// Within subsections
|
||
<div className="space-y-3">
|
||
|
||
// Tight grouping
|
||
<div className="space-y-2">
|
||
```
|
||
|
||
### Quick Fixes
|
||
|
||
**App.tsx:**
|
||
```tsx
|
||
// Line 126: Increase main grid gap
|
||
<div className="grid grid-cols-1 lg:grid-cols-[400px_1fr] gap-8"> {/* was gap-6 */}
|
||
|
||
// Line 128: Standard spacing in left column
|
||
<div className="flex flex-col gap-6">
|
||
```
|
||
|
||
**ProgressMonitor.tsx:**
|
||
```tsx
|
||
// Line 116: Better grid gap
|
||
<div className="grid grid-cols-1 md:grid-cols-2 gap-6"> {/* was gap-4 */}
|
||
|
||
// Line 143: Better color block spacing
|
||
<div className="flex flex-col gap-3"> {/* was gap-2 */}
|
||
```
|
||
|
||
---
|
||
|
||
## Priority 5: Visual Hierarchy (20 minutes)
|
||
|
||
### Section Headers
|
||
|
||
**Replace all section headers:**
|
||
|
||
```tsx
|
||
// OLD
|
||
<h2 className="text-xl font-semibold mb-4 pb-2 border-b-2 border-gray-300">
|
||
|
||
// NEW
|
||
<div className="mb-5 pb-3 border-b border-neutral-200">
|
||
<h2 className="text-xl font-bold text-neutral-900">Pattern Preview</h2>
|
||
</div>
|
||
```
|
||
|
||
### Color Block Enhancement
|
||
|
||
**ProgressMonitor.tsx - Lines 157-191:**
|
||
|
||
```tsx
|
||
<div className={`
|
||
p-3 rounded-lg border-2 transition-all duration-200
|
||
${isCompleted ? 'border-success bg-success-bg/50' : ''}
|
||
${isCurrent ? 'border-primary bg-primary/5 shadow-lg shadow-primary/10 ring-2 ring-primary/20' : ''}
|
||
${!isCompleted && !isCurrent ? 'border-neutral-200 bg-neutral-50 opacity-70' : ''}
|
||
`}>
|
||
<div className="flex items-center gap-3">
|
||
<div
|
||
className="w-6 h-6 rounded-md border-2 border-white shadow-md ring-1 ring-neutral-300 flex-shrink-0"
|
||
style={{ backgroundColor: block.threadHex }}
|
||
/>
|
||
<span className="font-semibold text-sm flex-1">
|
||
Thread {block.colorIndex + 1}
|
||
</span>
|
||
{/* Status icons */}
|
||
{isCompleted && <CheckCircleIcon className="w-5 h-5 text-success" />}
|
||
{isCurrent && <ArrowRightIcon className="w-5 h-5 text-primary" />}
|
||
{!isCompleted && !isCurrent && <CircleStackIcon className="w-5 h-5 text-neutral-400" />}
|
||
<span className="text-sm text-neutral-600 font-medium">
|
||
{block.stitchCount.toLocaleString()}
|
||
</span>
|
||
</div>
|
||
{/* Progress bar */}
|
||
{isCurrent && (
|
||
<div className="mt-2.5 h-1.5 bg-neutral-200 rounded-full overflow-hidden">
|
||
<div
|
||
className="h-full bg-primary transition-all duration-300"
|
||
style={{ width: `${blockProgress}%` }}
|
||
/>
|
||
</div>
|
||
)}
|
||
</div>
|
||
```
|
||
|
||
---
|
||
|
||
## Priority 6: Accessibility Quick Wins (15 minutes)
|
||
|
||
### Add ARIA Labels to Icon Buttons
|
||
|
||
**PatternCanvas.tsx - Zoom controls:**
|
||
|
||
```tsx
|
||
<button
|
||
onClick={handleZoomIn}
|
||
aria-label="Zoom in on pattern preview"
|
||
title="Zoom In"
|
||
className="..."
|
||
>
|
||
<PlusIcon className="w-5 h-5" />
|
||
</button>
|
||
|
||
<button
|
||
onClick={handleZoomOut}
|
||
aria-label="Zoom out from pattern preview"
|
||
title="Zoom Out"
|
||
className="..."
|
||
>
|
||
<MinusIcon className="w-5 h-5" />
|
||
</button>
|
||
|
||
<button
|
||
onClick={handleZoomReset}
|
||
aria-label="Reset zoom to fit pattern"
|
||
title="Reset Zoom"
|
||
className="..."
|
||
>
|
||
<ArrowPathIcon className="w-5 h-5" />
|
||
</button>
|
||
```
|
||
|
||
### Increase Touch Targets
|
||
|
||
**All icon buttons:**
|
||
|
||
```tsx
|
||
// Change from w-8 h-8 to w-10 h-10
|
||
<button className="w-10 h-10 ..."> {/* was w-8 h-8 */}
|
||
```
|
||
|
||
### Add Progress Bar ARIA
|
||
|
||
**ProgressMonitor.tsx - Line 207:**
|
||
|
||
```tsx
|
||
<div
|
||
className="h-full bg-gradient-to-r from-primary to-primary-light transition-all duration-300"
|
||
style={{ width: `${progressPercent}%` }}
|
||
role="progressbar"
|
||
aria-valuenow={progressPercent}
|
||
aria-valuemin={0}
|
||
aria-valuemax={100}
|
||
aria-label="Sewing progress"
|
||
/>
|
||
```
|
||
|
||
---
|
||
|
||
## Priority 7: Polish Details (20 minutes)
|
||
|
||
### Better Progress Bar Styling
|
||
|
||
**Both upload and sewing progress bars:**
|
||
|
||
```tsx
|
||
<div className="h-2.5 bg-neutral-200 rounded-full overflow-hidden shadow-inner">
|
||
<div
|
||
className="h-full bg-gradient-to-r from-primary to-primary-light transition-all duration-300 ease-out relative overflow-hidden"
|
||
style={{ width: `${progress}%` }}
|
||
>
|
||
{/* Shimmer effect */}
|
||
<div className="absolute inset-0 bg-gradient-to-r from-transparent via-white/30 to-transparent animate-[shimmer_2s_infinite]" />
|
||
</div>
|
||
</div>
|
||
```
|
||
|
||
### Enhanced Status Badges
|
||
|
||
**MachineConnection.tsx - Line 116:**
|
||
|
||
```tsx
|
||
<span className={`
|
||
inline-flex items-center gap-2
|
||
px-3.5 py-2
|
||
rounded-lg
|
||
font-semibold text-sm
|
||
border border-current/20
|
||
${statusBadgeColors[stateVisual.color]}
|
||
`}>
|
||
<span className="text-base leading-none">{stateVisual.icon}</span>
|
||
<span>{machineStatusName}</span>
|
||
</span>
|
||
```
|
||
|
||
### Unified Canvas Overlays
|
||
|
||
**PatternCanvas.tsx - All overlays:**
|
||
|
||
```tsx
|
||
// Use consistent overlay styling
|
||
className="absolute ... bg-white/98 backdrop-blur-sm p-3 rounded-xl shadow-lg border border-neutral-200 z-10"
|
||
```
|
||
|
||
---
|
||
|
||
## Quick Reference: Common Patterns
|
||
|
||
### Card Component
|
||
```tsx
|
||
<div className="bg-white p-6 rounded-lg shadow-md border border-neutral-100">
|
||
<div className="mb-5 pb-3 border-b border-neutral-200">
|
||
<h2 className="text-xl font-bold text-neutral-900">Title</h2>
|
||
</div>
|
||
<div className="space-y-4">
|
||
{/* Content */}
|
||
</div>
|
||
</div>
|
||
```
|
||
|
||
### Info Box / Alert
|
||
```tsx
|
||
<div className="bg-blue-50 border-l-4 border-blue-600 p-4 rounded-lg">
|
||
<div className="flex items-start gap-3">
|
||
<InformationCircleIcon className="w-6 h-6 text-blue-600 flex-shrink-0" />
|
||
<div>
|
||
<h4 className="font-semibold text-blue-900 mb-1">Title</h4>
|
||
<p className="text-sm text-blue-800">Message</p>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
```
|
||
|
||
### Data Grid
|
||
```tsx
|
||
<div className="bg-neutral-50 p-4 rounded-lg border border-neutral-200 space-y-3">
|
||
<div className="flex justify-between items-center">
|
||
<span className="text-sm font-medium text-neutral-600">Label:</span>
|
||
<span className="text-base font-bold text-neutral-900">Value</span>
|
||
</div>
|
||
</div>
|
||
```
|
||
|
||
---
|
||
|
||
## Testing Checklist
|
||
|
||
After making changes, verify:
|
||
|
||
- [ ] All buttons have visible hover states
|
||
- [ ] All buttons have press feedback (scale on active)
|
||
- [ ] All buttons have focus rings (test with Tab key)
|
||
- [ ] All disabled buttons are clearly grayed out
|
||
- [ ] Colors are consistent (no random blue-500, blue-600 mixing)
|
||
- [ ] Text is readable (no tiny 10px text)
|
||
- [ ] Touch targets are at least 44×44px
|
||
- [ ] Section headers stand out clearly
|
||
- [ ] Spacing feels consistent across components
|
||
- [ ] Status colors match semantic meaning (green=success, red=danger, etc.)
|
||
|
||
---
|
||
|
||
## Estimated Time: 2.5 Hours Total
|
||
|
||
1. Color system setup: 30 min
|
||
2. Button state updates: 20 min
|
||
3. Typography fixes: 15 min
|
||
4. Spacing consistency: 15 min
|
||
5. Visual hierarchy: 20 min
|
||
6. Accessibility: 15 min
|
||
7. Polish details: 20 min
|
||
8. Testing: 15 min
|
||
|
||
---
|
||
|
||
## Impact Summary
|
||
|
||
These changes will:
|
||
- **Improve usability** - Clearer buttons, better hierarchy
|
||
- **Enhance accessibility** - WCAG compliant, better focus states
|
||
- **Create consistency** - Unified color system, spacing
|
||
- **Polish appearance** - Professional, cohesive design
|
||
- **Maintain compactness** - Still efficient for technical users
|
||
|
||
---
|
||
|
||
## Need More Details?
|
||
|
||
See `UI_DESIGN_ANALYSIS.md` for:
|
||
- Detailed analysis of each component
|
||
- Comprehensive accessibility guidelines
|
||
- Advanced implementation recommendations
|
||
- Full code examples
|
||
- Design system specifications
|