diff --git a/openspec/changes/code-review-fix/tasks.md b/openspec/changes/code-review-fix/tasks.md index fbb9a81..32ae428 100644 --- a/openspec/changes/code-review-fix/tasks.md +++ b/openspec/changes/code-review-fix/tasks.md @@ -82,7 +82,7 @@ ## 9. Frontend — Shared Types & Type Safety - [x] 9.1 `[sonnet]` Create `src/types/candles.ts` with `Candle` interface -- [ ] 9.2 `[sonnet]` Create `src/types/annotations.ts` with `Annotation`, `AnnotationType`, `Geometry` interfaces +- [x] 9.2 `[sonnet]` Create `src/types/annotations.ts` with `Annotation`, `AnnotationType`, `Geometry` interfaces - [ ] 9.3 `[sonnet]` Create `src/types/charts.ts` with `Chart` interface - [ ] 9.4 `[sonnet]` Create `src/types/predictions.ts` with `PredictionSpan`, `PredictionState`, `ModelInfo` interfaces - [ ] 9.5 `[sonnet]` Create `src/types/span-annotations.ts` with `SpanAnnotation`, `SpanLabelType`, `SubSpan` interfaces diff --git a/src/types/annotations.ts b/src/types/annotations.ts new file mode 100644 index 0000000..22dd726 --- /dev/null +++ b/src/types/annotations.ts @@ -0,0 +1,35 @@ +/** + * Annotation types for point and line/rectangle annotations on charts. + * + * Geometry fields use Unix epoch seconds for time values. + * startTime / endTime correspond to candle timestamps. + * startPrice / endPrice correspond to price axis values. + */ + +export interface Geometry { + startTime?: number; + startPrice?: number; + endTime?: number; + endPrice?: number; +} + +export interface AnnotationType { + id: number; + name: string; + display_name: string; + color: string; + category: string; // 'marker' | 'line' | 'rectangle' + icon: string | null; + is_active: boolean; + created_at?: number | Date; +} + +export interface Annotation { + id: number; + chart_id: number; + timestamp: number; // Unix epoch seconds + label_type: string; + color: string | null; + geometry: Geometry | null; + created_at: number | Date; +}