Commit graph

187 commits

Author SHA1 Message Date
Marko Djordjevic
2f05136f20 feat: implement section 8 - span selection, editing, and deletion 2026-02-14 10:11:51 +01:00
Marko Djordjevic
586f02ed69 feat: implement sections 6-7 - span selection, preview, and label assignment popover 2026-02-14 10:10:41 +01:00
Marko Djordjevic
c9d2cbfc4b feat: implement Section 5 - Span Tool State & Integration
- 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>
2026-02-14 06:42:24 +01:00
Marko Djordjevic
5ea63a613e feat: implement SpanRectanglePrimitive for span annotation rendering
- 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>
2026-02-14 06:35:01 +01:00
Marko Djordjevic
dadf515406 feat: add database schema, migrations, and API endpoints for span annotations
- 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)
2026-02-14 05:56:28 +01:00
Marko Djordjevic
7cb308788e test: verify multi-chart management implementation
- 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
2026-02-13 00:29:21 +01:00
Marko Djordjevic
b9771fe89f 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
2026-02-13 00:17:09 +01:00
Marko Djordjevic
a3c7137b01 feat: create ChartSelector component with dropdown, delete, and empty state 2026-02-13 00:14:53 +01:00
Marko Djordjevic
90e1e179cc feat: scope candles/annotations/export APIs by chartId query param
- 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
2026-02-13 00:14:22 +01:00
Marko Djordjevic
98e91b047a feat: upload creates new chart from filename with duplicate handling
- 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
2026-02-13 00:13:23 +01:00
Marko Djordjevic
b53cb1b7d1 feat: add charts API endpoints (GET list, DELETE with cascade) 2026-02-13 00:12:53 +01:00
Marko Djordjevic
92d3339a48 feat: add charts table schema and migration with data backfill
- 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)
2026-02-13 00:12:21 +01:00
Marko Djordjevic
178834f3b2 fix: resolve type errors in ThemeProvider and ThemeToggle
- Remove import from 'next-themes/dist/types' (no longer exported)
- Use React.ComponentProps<typeof NextThemesProvider> instead
- Remove unsupported 'asChild' prop from TooltipTrigger
- Remove unsupported 'side' prop from TooltipContent
2026-02-12 23:48:58 +01:00
Marko Djordjevic
9ec571389b night friendly candle colors 2026-02-12 23:38:11 +01:00
Marko Djordjevic
0d235602af feat: implement dark/light mode with system detection
- Install and configure next-themes for theme management
- Add ThemeProvider wrapper component with suppressHydrationWarning
- Define light theme CSS variables (off-white backgrounds, green accents)
- Define dark theme CSS variables (hacker theme: terminal blacks, matrix green)
- Update scrollbar styles for both themes
- Add CRT scanline/glow effects (dark mode only)
- Create ThemeToggle component with system/light/dark cycling
- Add theme toggle to Toolbox sidebar
- Update CandleChart to apply theme-specific colors
- Chart colors update dynamically on theme change
- All components use CSS variables for theme compatibility
- FOUC prevention via next-themes inline script
2026-02-12 23:31:51 +01:00
Marko Djordjevic
4dad24845e chore: archive update-candle-colors change 2026-02-12 23:26:25 +01:00
Marko Djordjevic
48883e60f0 feat: update candlestick colors to black/white scheme
- 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
2026-02-12 23:23:17 +01:00
Marko Djordjevic
011bea2350 feat: delete old candles on CSV upload before inserting new ones 2026-02-12 18:47:11 +01:00
Marko Djordjevic
974d9f5598 feat: add annotation types management system
- Created annotation_types table with name, display_name, color, category, icon
- Implemented CRUD API endpoints for annotation types management
- Built annotation types management UI page at /annotation-types
- Updated Toolbox component to dynamically load and display annotation types
- Updated CandleChart component to use dynamic annotation types for markers
- Added seed functionality for default types (break_up, break_down, line)
- Cleaned up duplicate migration files
2026-02-12 18:17:44 +01:00
Marko Djordjevic
08e8ebd1e0 design: change to minimalistic and clean light theme
- 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
2026-02-12 16:18:14 +01:00
Marko Djordjevic
6f965c1cc9 fix: add automatic database migrations on startup and copy drizzle folder to Docker
- 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
2026-02-12 15:40:57 +01:00
Marko Djordjevic
957663e29a fix: use proper Drizzle query syntax in health endpoint instead of execute() 2026-02-12 15:19:50 +01:00
Marko Djordjevic
23979ad2df chore: add Input component from shadcn/ui for label search 2026-02-12 15:15:13 +01:00
Marko Djordjevic
a1fa86fe55 feat: implement label management with sidebar, hacker theme, and Docker support
- Add label selection on chart with visual highlight (size 2x, color change)
- Implement keyboard delete handler (Delete/Backspace keys)
- Add comprehensive label management sidebar with:
  - Collapsible label annotations section
  - Search by timestamp
  - Filter by type (Break Up, Break Down, All)
  - Individual delete buttons
  - Count display
  - Click to select/highlight on chart
- Transform UI with hacker theme:
  - Matrix green (#00ff41) on dark background (#0a0e0a)
  - Monospace font (JetBrains Mono)
  - Glow effects on button hover and active states
  - Custom scrollbar styling
  - Terminal-inspired aesthetic
- Add Docker deployment:
  - Multi-stage Dockerfile with standalone output
  - docker-compose.yml with volume persistence
  - Non-root user (nextjs) for security
  - Health check endpoint integration
- Tailwind and CSS enhancements:
  - Custom colors (matrix, matrixDim, neonRed, etc.)
  - Glow box shadows and animations
  - Selection and scrollbar styling
2026-02-12 15:12:59 +01:00
Marko Djordjevic
37c3adf42f feat: implement Phase 4 endpoint dragging with visual handles 2026-02-12 14:32:00 +01:00
Marko Djordjevic
91c516999d feat: implement Phase 3 line selection with visual feedback 2026-02-12 14:24:11 +01:00
Marko Djordjevic
c3292b4f6c fix: improve cursor circle visibility with white fill and larger radius 2026-02-12 14:20:57 +01:00
Marko Djordjevic
30b13d6898 feat: add cursor circle visual feedback during line drawing (Phase 2) 2026-02-12 14:09:01 +01:00
Marko Djordjevic
006e95c266 feat: add color support for line annotations
- 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
2026-02-12 14:04:51 +01:00
Marko Djordjevic
daec116aab fix svg overlay z-index 2026-02-12 13:54:57 +01:00
Marko Djordjevic
551e8423b2 fix: sort markers by timestamp before setting on chart
- 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
2026-02-12 11:54:41 +01:00
Marko Djordjevic
17eb2ca745 fix: sort candle data before displaying in chart
- 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
2026-02-12 11:52:43 +01:00
Marko Djordjevic
11f0759b0e fix: resolve chart visibility issues after CSV upload
- 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
2026-02-12 11:50:48 +01:00
Marko Djordjevic
23f18f405a feat: complete candle annotator implementation
- 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
2026-02-12 11:20:29 +01:00
Marko Djordjevic
8d1e72579e feat: create UI shell and components
- 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
2026-02-12 10:24:52 +01:00
Marko Djordjevic
096a80b229 feat: implement backend API endpoints
- CSV upload with papaparse (handles date strings and Unix timestamps)
- Annotations CRUD (GET, POST, DELETE)
- Candles GET endpoint
- Export annotations as CSV
2026-02-12 10:24:03 +01:00
Marko Djordjevic
d04b673cfa feat: initialize Next.js project with database schema
- 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
2026-02-12 10:23:02 +01:00