respira/src
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
..
components feature: Create unified PatternLayer component to eliminate duplication 2025-12-25 21:29:24 +01:00
data feature: Add Brother thread color mapping to PES importer 2025-12-21 20:37:32 +01:00
formats feature: Add RGB color matching for Brother thread identification 2025-12-21 20:52:32 +01:00
hooks feature: Extract canvas state management into custom React hooks 2025-12-25 21:24:46 +01:00
lib style: Apply linter auto-fixes 2025-12-22 12:03:49 +01:00
platform fix: run linter 2025-12-18 11:39:22 +01:00
services fix: run linter 2025-12-18 11:39:22 +01:00
stores feature: Add pattern rotation with Konva Transformer 2025-12-25 21:06:48 +01:00
types fix: run linter 2025-12-18 11:39:22 +01:00
utils feature: Add pattern rotation with Konva Transformer 2025-12-25 21:06:48 +01:00
App.css fix: Restore correct destructive variant colors 2025-12-22 11:59:02 +01:00
App.tsx fix: Improve theme color definitions and dark mode styling 2025-12-21 00:02:22 +01:00
index.css feature: Implement unified semantic color system with Tailwind v4 2025-12-17 21:43:36 +01:00
main.tsx fix: run linter 2025-12-18 11:39:22 +01:00
vite-env.d.ts feature: Add application version to page title 2025-12-13 23:48:05 +01:00