feat: add shared Annotation, AnnotationType, Geometry interfaces in src/types/annotations.ts
Creates src/types/annotations.ts with typed interfaces matching actual usage in CandleChart.tsx, page.tsx, and DB schema. Marks task 9.2 done. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
8b40a2cb9a
commit
f05a0081f7
2 changed files with 36 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
35
src/types/annotations.ts
Normal file
35
src/types/annotations.ts
Normal file
|
|
@ -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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue