---
estimated_steps: 7
estimated_files: 2
skills_used: []
---

# T02: Lift canvas state to App.tsx and add Export navigation

Currently `useCanvasState()` is instantiated inside `DesignCanvas.tsx`, making canvas state inaccessible to View 3. This task lifts the hook instantiation to `App.tsx`, passes state + actions as props to `DesignCanvas`, and adds an `onExport` callback prop that triggers navigation to the 'export' view. The Export view placeholder in App.tsx is updated to receive canvas state props. DesignCanvas gets an 'Export' button in its toolbar area. All existing DesignCanvas functionality must remain unchanged — this is a mechanical prop-threading refactor.

Key constraints:
- `useCanvasState` hook itself is NOT modified — only where it's called changes
- DesignCanvas receives `state`, `addObject`, `removeObject`, `updateObject`, `selectObjects`, `deselectAll`, `reorderObject`, `toggleVisibility`, `toggleLock`, `setArtboard`, `undo`, `redo`, `canUndo`, `canRedo` as props instead of calling the hook internally
- The `traceMetadata` param to `useCanvasState()` comes from App.tsx's existing `traceMetadata` state
- App.tsx passes a `stageRef` to DesignCanvas and receives it back so PNG export can work later
- A `Ref<Konva.Stage>` is created in App.tsx and passed to DesignCanvas for stage access from View 3

## Inputs

- ``app/src/App.tsx` — current view router with svgResult/traceMetadata state`
- ``app/src/views/DesignCanvas.tsx` — current View 2 container that owns useCanvasState`
- ``app/src/hooks/useCanvasState.ts` — hook providing UseCanvasStateReturn interface`
- ``app/src/types/canvas.ts` — CanvasState, CanvasObject, ArtboardConfig types`

## Expected Output

- ``app/src/App.tsx` — instantiates useCanvasState, passes state/actions as props to DesignCanvas and (placeholder) ExportView, creates stageRef`
- ``app/src/views/DesignCanvas.tsx` — receives canvas state/actions via props instead of calling useCanvasState internally; adds Export button; accepts and uses stageRef from parent`

## Verification

cd app && npx tsc -b --noEmit && npx vitest run
