Phase 2: Canvas Editor Core

Implements the core canvas editor with react-konva:

- Added dependencies: react-konva, konva, use-image
- DesignCanvas component: 300×300px Stage with T-shirt SVG overlay
- TShirtSVG component: Visual t-shirt outline with print zone indicator
- ImageElement: Draggable/resizable image with Transformer handles
- TextElement: Draggable/resizable text with Transformer handles
- useDesignEditor hook: Element CRUD, selection, reordering
- Keyboard shortcut: Delete/Backspace removes selected element
- Test image added on mount for Phase 2 verification

Canvas info bar shows: "Design Area: 15" × 15" • Export: 4500 × 4500px @ 300 DPI"

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Khalid A
2026-04-21 01:03:30 -05:00
parent 1af0e6152d
commit e67017b259
10 changed files with 476 additions and 28 deletions

View File

@@ -1,31 +1,10 @@
import { StrictMode, useEffect, useState } from 'react'
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import './index.css'
function AppWithHealth() {
const [serverStatus, setServerStatus] = useState('Checking...');
useEffect(() => {
fetch('/api/health')
.then(res => res.ok ? setServerStatus('Connected ✓') : setServerStatus('Error'))
.catch(() => setServerStatus('Offline'));
}, []);
return (
<div style={{ padding: '2rem', textAlign: 'center' }}>
<h1>Apparel Designer</h1>
<p style={{ color: 'var(--text-secondary)' }}>
T-shirt customization editor
</p>
<div style={{ marginTop: '2rem', padding: '1rem', background: 'var(--bg-secondary)', borderRadius: 'var(--radius-md)' }}>
<p>Server Status: <code id="server-status">{serverStatus}</code></p>
</div>
</div>
);
}
import App from './App'
createRoot(document.getElementById('root')).render(
<StrictMode>
<AppWithHealth />
<App />
</StrictMode>,
)