- Add SpanAnnotation and SpanLabelType interfaces to page.tsx
- Add span-related state: spanAnnotations, selectedSpanId, spanLabelTypes
- Add fetchSpanAnnotations() and fetchSpanLabelTypes() data fetching functions
- Load span annotations and label types when chart changes
- Add "Span" tool button to Toolbox component with RectangleHorizontal icon
- Mark Section 5 tasks (5.1-5.5) as complete in tasks.md
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Created SpanRectanglePrimitive.ts implementing ISeriesPrimitive interface
- Implemented updateAllViews() with coordinate conversion from data-space to pixel-space
- Added semi-transparent rectangle rendering with configurable opacity
- Implemented label tag rendering above rectangles showing pattern names
- Added hitTest() for click detection within span bounds
- Implemented highlight state with thicker borders and increased opacity
- Set zOrder to 'bottom' to render rectangles behind candlesticks
- Completed Section 4 tasks (4.1-4.6) from span-annotation specification
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Add span_label_types and span_annotations tables to schema
- Seed default span label types (bull_flag, bear_flag, etc.)
- Implement CRUD API endpoints for span label types
- Implement CRUD API endpoints for span annotations
- Add time swap validation in POST endpoint (start_time <= end_time)
- Verified ChartSelector uses theme-aware classes
- Tested full workflow: upload, chart creation, switching, annotation scoping
- Verified migration creates default chart with existing data
- Tested chart deletion with cascade delete of candles/annotations
- Tested edge cases: duplicate filenames, deleting last chart, upload with no charts
- Build passes with no type errors
- 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
- GET /api/candles accepts ?chartId= with fallback to most recent chart
- GET /api/annotations accepts ?chartId= with fallback to most recent chart
- POST /api/annotations now requires chart_id in request body
- GET /api/export accepts ?chartId= to scope exported annotations
- DELETE /api/annotations supports optional chartId scoping
- POST /api/upload now creates a chart named from the CSV filename
- Duplicate names get numeric suffix (e.g., btc-daily-2)
- Candles inserted with chart_id instead of replacing all data
- Response includes chart id and name
- Add charts table with id, name (unique), created_at
- Add chart_id FK to candles table with composite unique on (chart_id, time)
- Add chart_id FK to annotations table
- Custom migration handles existing data: creates 'Imported Data' chart and backfills chart_id
- Recreates tables for NOT NULL constraint (SQLite limitation)
- Change bullish candles to white interior with black outline
- Change bearish candles to solid black
- Update all wick colors to black
- Enable borders for candlesticks
- Replace Matrix/terminal dark theme with modern light design
- Update Tailwind config with clean, professional color palette
- Change from monospace to Inter sans-serif font
- Update chart styling to use white background with subtle grids
- Remove glow effects and neon colors from buttons and UI
- Update color picker with better color options
- Improve sidebar spacing and typography
- Update annotation badges with softer colors
- Change scrollbar styling to match light theme
- Auto-run migrations when db module loads
- Copy drizzle migrations folder to Docker image
- Generate missing color column migration
- Fixes 500 errors on /api/candles and /api/annotations in Docker
- Add color field to annotations schema with default blue (#3b82f6)
- Add color picker UI with 5 preset colors (red, green, blue, yellow, white)
- Pass selected color through component hierarchy (Page -> Toolbox, CandleChart -> SvgOverlay)
- Store color when creating line annotations
- Render lines with their stored color
- Update database with color column
- Preview lines show selected color during drawing
Phase 1 of LINE_DRAWING_IMPROVEMENTS.md complete
- Add sorting to annotation markers in ascending order by time
- Fixes 'data must be asc ordered by time' error for markers
- Ensures both candle data and markers are properly sorted
- Add sorting by timestamp in ascending order before setting chart data
- Fixes 'data must be asc ordered by time' error from lightweight-charts
- Ensures chart displays correctly even if API returns unsorted data
- Add fixed width to sidebar (w-64) to prevent layout collapse
- Change chart container from flex-1 to w-full h-full for proper sizing
- Chart now properly displays after CSV upload
- Created CandleChart component with lightweight-charts integration
- Implemented SvgOverlay component for line drawing
- Integrated all components in main page
- Fixed TypeScript and Tailwind CSS compatibility issues
- Added comprehensive README.md with project documentation
- Created DEPLOYMENT.md with setup and troubleshooting guide
- Downgraded to stable versions (Tailwind v3, lightweight-charts v4)
- All 59 tasks from OpenSpec completed
- Toolbox component with tool selection (break up/down, line, delete)
- FileUpload component with CSV upload functionality
- Main page layout with sidebar and chart area
- Tool state management and export functionality
- CSV upload with papaparse (handles date strings and Unix timestamps)
- Annotations CRUD (GET, POST, DELETE)
- Candles GET endpoint
- Export annotations as CSV
- Set up Next.js with App Router, TypeScript, Tailwind CSS
- Configure shadcn/ui with dark theme
- Install dependencies: lightweight-charts, papaparse, lucide-react
- Set up Drizzle ORM with better-sqlite3
- Create database schema for candles and annotations tables
- Generate migration SQL