feat: wire frontend state and data flow for multi-chart support

- Add activeChartId/charts state to page.tsx with chart fetching on mount
- ChartSelector integrated in sidebar between header and file upload
- CandleChart and SvgOverlay fetch data scoped by activeChartId
- FileUpload returns chart info, auto-selects new chart after upload
- Annotation create/delete flows include chart_id
- Export scoped by activeChartId
- Toolbox receives activeChartId prop
This commit is contained in:
Marko Djordjevic 2026-02-13 00:17:09 +01:00
parent a3c7137b01
commit b9771fe89f
6 changed files with 126 additions and 37 deletions

View file

@ -34,13 +34,13 @@
## 6. Frontend State & Data Flow
- [ ] 6.1 Add `activeChartId` and `charts` state to `page.tsx`
- [ ] 6.2 Fetch charts list on mount via `GET /api/charts`, auto-select the most recent chart
- [ ] 6.3 Pass `activeChartId` to `CandleChart` component — update it to fetch candles/annotations with `?chartId=` param
- [ ] 6.4 Update `handleUploadSuccess` to receive the new chart from the upload response, add it to `charts` state, and set it as `activeChartId`
- [ ] 6.5 Update annotation create/delete flows to include `chart_id` in requests
- [ ] 6.6 When `activeChartId` changes, refetch candles and annotations for the new chart
- [ ] 6.7 Update export handler to include `?chartId=` in the export URL
- [x] 6.1 Add `activeChartId` and `charts` state to `page.tsx`
- [x] 6.2 Fetch charts list on mount via `GET /api/charts`, auto-select the most recent chart
- [x] 6.3 Pass `activeChartId` to `CandleChart` component — update it to fetch candles/annotations with `?chartId=` param
- [x] 6.4 Update `handleUploadSuccess` to receive the new chart from the upload response, add it to `charts` state, and set it as `activeChartId`
- [x] 6.5 Update annotation create/delete flows to include `chart_id` in requests
- [x] 6.6 When `activeChartId` changes, refetch candles and annotations for the new chart
- [x] 6.7 Update export handler to include `?chartId=` in the export URL
## 7. UI Polish