feat: implement sections 6-7 - span selection, preview, and label assignment popover

This commit is contained in:
Marko Djordjevic 2026-02-14 10:10:41 +01:00
parent c9d2cbfc4b
commit 586f02ed69
11 changed files with 647 additions and 22483 deletions

View file

@ -38,19 +38,19 @@
## 6. Two-Click Span Selection & Preview
- [ ] 6.1 Create `SpanAnnotationManager.tsx` component that manages span interaction state (idle / first-click-done / popover-open)
- [ ] 6.2 Implement first-click handler: snap to nearest candle, store start candle, render start marker via a preview primitive
- [ ] 6.3 Implement mouse-move preview: stretch preview rectangle from start candle to cursor candle, computing price range (min low to max high) of candles in range
- [ ] 6.4 Implement second-click handler: snap to nearest candle, finalize span range, swap if end < start, trigger popover
- [ ] 6.5 Implement Escape key to cancel span selection and clear preview
- [x] 6.1 Create `SpanAnnotationManager.tsx` component that manages span interaction state (idle / first-click-done / popover-open)
- [x] 6.2 Implement first-click handler: snap to nearest candle, store start candle, render start marker via a preview primitive
- [x] 6.3 Implement mouse-move preview: stretch preview rectangle from start candle to cursor candle, computing price range (min low to max high) of candles in range
- [x] 6.4 Implement second-click handler: snap to nearest candle, finalize span range, swap if end < start, trigger popover
- [x] 6.5 Implement Escape key to cancel span selection and clear preview
## 7. Label Assignment Popover
- [ ] 7.1 Create `SpanPopover.tsx` with shadcn Popover/Dialog: label dropdown (from span_label_types), confidence slider (1-5), outcome select (win/loss/breakeven/none), notes textarea, Save/Cancel buttons
- [ ] 7.2 Position popover near the end-click position with collision avoidance
- [ ] 7.3 Wire Save button: POST to API, attach SpanRectanglePrimitive to chart series, update spanAnnotations state, close popover
- [ ] 7.4 Wire Cancel button / Escape: discard span, clear preview, close popover
- [ ] 7.5 Disable Save when no label is selected (validation)
- [x] 7.1 Create `SpanPopover.tsx` with shadcn Popover/Dialog: label dropdown (from span_label_types), confidence slider (1-5), outcome select (win/loss/breakeven/none), notes textarea, Save/Cancel buttons
- [x] 7.2 Position popover near the end-click position with collision avoidance
- [x] 7.3 Wire Save button: POST to API, attach SpanRectanglePrimitive to chart series, update spanAnnotations state, close popover
- [x] 7.4 Wire Cancel button / Escape: discard span, clear preview, close popover
- [x] 7.5 Disable Save when no label is selected (validation)
## 8. Span Selection, Editing & Deletion