task 9.5: create src/types/span-annotations.ts

Add SpanAnnotation, SpanLabelType, and SubSpan interfaces extracted from
duplicate inline definitions across SpanAnnotationManager, SpanAnnotationList,
SpanPopover, Toolbox, and page.tsx components.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marko Djordjevic 2026-02-18 15:45:30 +01:00
parent 76c440d879
commit 18b2afe4a5

View file

@ -0,0 +1,50 @@
/**
* Span annotation types for chart pattern labeling
*/
/**
* A sub-span represents a nested time range within a parent span annotation,
* used to mark sub-structures or phases within a larger pattern.
*/
export interface SubSpan {
start_time: number;
end_time: number;
label: string;
color?: string;
notes?: string | null;
}
/**
* A span annotation marks a time range on a chart with a pattern label
* and optional metadata such as confidence, outcome, and notes.
*/
export interface SpanAnnotation {
id: number;
chart_id: number;
start_time: number;
end_time: number;
label: string;
confidence: number | null;
outcome: string | null;
notes: string | null;
sub_spans: SubSpan[] | null;
color: string;
source?: string;
model_prediction?: Record<string, unknown> | null;
created_at: number;
}
/**
* A span label type defines a named pattern category that can be applied
* to span annotations, with display metadata and optional keyboard shortcut.
*/
export interface SpanLabelType {
id: number;
name: string;
display_name: string;
color: string;
hotkey: string | null;
is_active: boolean;
sort_order: number;
created_at: number;
}