src/
├── components/
│ ├── sequencer/
│ │ ├── index.ts # Module exports
│ │ ├── types.ts # Shared types and constants
│ │ ├── SvgStep.tsx # Individual step component
│ │ ├── TrackSlotButton.tsx # Pattern slot button
│ │ └── SequencerRow.tsx # Full sequencer row
│ └── StartOverlay.tsx # Start screen overlay
- Self-contained start screen component
- Props:
onStart: () => void,isReady: boolean - ~80 lines
types.ts:
TrackKeytypeTRACK_COLORSconstantPATTERN_NOTESconstant- Props interfaces for all components
SvgStep.tsx:
- Individual sequencer step rendering
- Handles: click, right-click, shift+drag for length
- Visual states: active, slide, selected range
- ~170 lines
TrackSlotButton.tsx:
- Pattern slot selector button
- Shows: index, active state, data presence
- ~50 lines
SequencerRow.tsx:
- Complete sequencer row with track label
- Manages: step highlighting, slot buttons
- Uses: SvgStep, TrackSlotButton, GridIndicators
- ~160 lines
Before:
- 1,124 lines
- Components defined inline (lines 189-387)
- ~200 lines of component code
After:
- ~850 lines (275 lines removed)
- Components imported from modules
- Cleaner, more focused on app logic
Imports Added:
import { StartOverlay } from './components/StartOverlay';
import { SequencerRow } from './components/sequencer';
import type { SequencerRowHandle, TrackKey } from './components/sequencer';
import { TRACK_COLORS } from './components/sequencer';Removed from App.tsx:
SvgStepcomponent definitionTrackSlotButtoncomponent definitionSequencerRowcomponent definitionStartOverlaycomponent definitionTRACK_COLORSconstant (now imported)TrackKeytype (now imported)
-
Separation of Concerns
- App.tsx focuses on: state management, data flow, orchestration
- Components handle: rendering, user interaction
-
Reusability
- Sequencer components can be used elsewhere
- StartOverlay is self-contained
-
Testability
- Components can be tested in isolation
- No need to mount entire App for sequencer tests
-
Maintainability
- Smaller, focused files
- Easier to find and modify specific UI parts
-
Code Organization
- Components grouped by feature (sequencer/)
- Types co-located with components
| Metric | Before | After | Change |
|---|---|---|---|
| App.tsx | 1,124 lines | ~850 lines | -24% |
| New files | 0 | 5 files | +640 lines |
| Components in App.tsx | 4 | 0 | Extracted |
All component interfaces preserved:
SequencerRowHandleexported for ref accessTrackKeytype still available- All props remain the same
All existing tests pass (175/180):
- No new test failures
- 5 pre-existing failures unrelated to refactoring
- TypeScript compiles without errors
Ready for Priority 4: Check rubberband file access