respira/src/components
Jan-Henrik Bruhn 469c08d45b feature: Create unified PatternLayer component to eliminate duplication
Unified three separate layer implementations into single PatternLayer component:

**PatternLayer.tsx (156 lines)**
- Handles both interactive (original) and locked (uploaded) pattern rendering
- Props-driven configuration for dragging, rotation, transformer
- Includes CurrentPosition indicator for uploaded patterns
- Memoized stitches and center calculations for performance
- Single source of truth for pattern rendering logic

**Benefits:**
- Eliminated ~140 lines of duplicated layer code
- Reduced PatternCanvas from 388 to 271 lines (-117 lines, -30%)
- Consistent rendering behavior across pattern states
- Easier to maintain and test pattern rendering
- Cleaner component composition in PatternCanvas

**Removed from PatternCanvas:**
- Original pattern layer implementation (74 lines)
- Uploaded pattern layer implementation (33 lines)
- Current position layer implementation (26 lines)
- Duplicate Group, Transformer, Stitches setup
- Redundant center calculations and stitch conversions

**Complete refactoring impact (All Phases):**
- Original: 786 lines in single monolithic file
- After Phase 4: 271 lines main + hooks + components
- **Total reduction: -515 lines (-65%)**

File structure now:
- PatternCanvas.tsx: 271 lines (orchestration)
- PatternLayer.tsx: 156 lines (rendering)
- useCanvasViewport.ts: 166 lines (viewport)
- usePatternTransform.ts: 179 lines (transform)
- 3 display components + 3 utilities

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-25 21:29:24 +01:00
..
PatternCanvas feature: Create unified PatternLayer component to eliminate duplication 2025-12-25 21:29:24 +01:00
ui fix: Improve destructive Alert variant styling 2025-12-22 12:00:54 +01:00
AppHeader.tsx feature: Replace connection indicator with shadcn StatusIndicator 2025-12-21 13:29:27 +01:00
BluetoothDevicePicker.tsx feature: Migrate ConfirmDialog and BluetoothDevicePicker to shadcn dialogs 2025-12-20 23:13:09 +01:00
ConfirmDialog.tsx feature: Migrate ConfirmDialog and BluetoothDevicePicker to shadcn dialogs 2025-12-20 23:13:09 +01:00
ConnectionPrompt.tsx feature: Enhance PatternInfo with Tooltip and improve card layouts 2025-12-20 19:52:16 +01:00
ErrorPopover.tsx feature: Migrate ErrorPopover to shadcn Popover component 2025-12-21 00:06:38 +01:00
FileUpload.tsx feature: Add pattern rotation with Konva Transformer 2025-12-25 21:06:48 +01:00
KonvaComponents.tsx feature: Add pattern rotation with Konva Transformer 2025-12-25 21:06:48 +01:00
LeftSidebar.tsx fix: run linter 2025-12-18 11:39:22 +01:00
PatternCanvas.tsx feature: Add pattern rotation with Konva Transformer 2025-12-25 21:06:48 +01:00
PatternCanvasPlaceholder.tsx fix: Improve theme color definitions and dark mode styling 2025-12-21 00:02:22 +01:00
PatternInfo.tsx fix: Apply chart/catalogNumber duplicate detection to all components 2025-12-22 11:54:30 +01:00
PatternSummaryCard.tsx feature: Enhance PatternInfo with Tooltip and improve card layouts 2025-12-20 19:52:16 +01:00
ProgressMonitor.tsx style: Apply linter auto-fixes 2025-12-22 12:03:49 +01:00
SkeletonLoader.tsx style: Apply linter auto-fixes 2025-12-22 12:03:49 +01:00
WorkflowStepper.tsx fix: run linter 2025-12-18 11:39:22 +01:00