fix: change is_active type from number to boolean to match API response

This commit is contained in:
Marko Djordjevic 2026-02-17 19:59:48 +01:00
parent a75c9307d4
commit 4352732630
8 changed files with 14 additions and 14 deletions

View file

@ -11,7 +11,7 @@ type AnnotationType = {
color: string; color: string;
category: string; category: string;
icon: string | null; icon: string | null;
is_active: number; is_active: boolean;
created_at: number; created_at: number;
}; };

View file

@ -153,7 +153,7 @@ interface SpanLabelType {
display_name: string; display_name: string;
color: string; color: string;
hotkey: string | null; hotkey: string | null;
is_active: number; is_active: boolean;
sort_order: number; sort_order: number;
created_at: number; created_at: number;
} }

View file

@ -10,7 +10,7 @@ type SpanLabelType = {
display_name: string; display_name: string;
color: string; color: string;
hotkey: string | null; hotkey: string | null;
is_active: number; is_active: boolean;
sort_order: number; sort_order: number;
created_at: number; created_at: number;
}; };

View file

@ -46,7 +46,7 @@ type AnnotationType = {
color: string; color: string;
category: string; category: string;
icon: string | null; icon: string | null;
is_active: number; is_active: boolean;
}; };
interface SpanAnnotation { interface SpanAnnotation {
@ -69,7 +69,7 @@ interface SpanLabelType {
display_name: string; display_name: string;
color: string; color: string;
hotkey: string | null; hotkey: string | null;
is_active: number; is_active: boolean;
sort_order: number; sort_order: number;
created_at: number; created_at: number;
} }
@ -189,7 +189,7 @@ const CandleChart = forwardRef<CandleChartHandle, CandleChartProps>(
try { try {
const response = await fetch('/api/annotation-types'); const response = await fetch('/api/annotation-types');
const data = await response.json(); const data = await response.json();
setAnnotationTypes(data.filter((t: AnnotationType) => t.is_active === 1)); setAnnotationTypes(data.filter((t: AnnotationType) => t.is_active));
return data; return data;
} catch (error) { } catch (error) {
console.error('Failed to fetch annotation types:', error); console.error('Failed to fetch annotation types:', error);

View file

@ -23,7 +23,7 @@ interface SpanLabelType {
display_name: string; display_name: string;
color: string; color: string;
hotkey: string | null; hotkey: string | null;
is_active: number; is_active: boolean;
sort_order: number; sort_order: number;
created_at: number; created_at: number;
} }

View file

@ -33,7 +33,7 @@ interface SpanLabelType {
display_name: string; display_name: string;
color: string; color: string;
hotkey: string | null; hotkey: string | null;
is_active: number; is_active: boolean;
sort_order: number; sort_order: number;
created_at: number; created_at: number;
} }
@ -461,7 +461,7 @@ export default function SpanAnnotationManager({
// Hotkey label assignment: only when span tool is active and a span range is selected (after first click) // Hotkey label assignment: only when span tool is active and a span range is selected (after first click)
if (activeTool === 'span' && interactionState === 'first-click-done' && startCandle) { if (activeTool === 'span' && interactionState === 'first-click-done' && startCandle) {
// Check if key matches any label hotkey // Check if key matches any label hotkey
const matchingLabel = spanLabelTypes.find((lt) => lt.hotkey === e.key && lt.is_active === 1); const matchingLabel = spanLabelTypes.find((lt) => lt.hotkey === e.key && lt.is_active);
if (matchingLabel && activeChartId) { if (matchingLabel && activeChartId) {
e.preventDefault(); e.preventDefault();

View file

@ -28,7 +28,7 @@ interface SpanLabelType {
display_name: string; display_name: string;
color: string; color: string;
hotkey: string | null; hotkey: string | null;
is_active: number; is_active: boolean;
sort_order: number; sort_order: number;
created_at: number; created_at: number;
} }
@ -136,7 +136,7 @@ export default function SpanPopover({
</SelectTrigger> </SelectTrigger>
<SelectContent> <SelectContent>
{spanLabelTypes {spanLabelTypes
.filter((type) => type.is_active === 1) .filter((type) => type.is_active)
.sort((a, b) => a.sort_order - b.sort_order) .sort((a, b) => a.sort_order - b.sort_order)
.map((type) => ( .map((type) => (
<SelectItem key={type.id} value={type.name}> <SelectItem key={type.id} value={type.name}>

View file

@ -13,7 +13,7 @@ type AnnotationType = {
color: string; color: string;
category: string; category: string;
icon: string | null; icon: string | null;
is_active: number; is_active: boolean;
}; };
interface Annotation { interface Annotation {
@ -44,7 +44,7 @@ interface SpanLabelType {
display_name: string; display_name: string;
color: string; color: string;
hotkey: string | null; hotkey: string | null;
is_active: number; is_active: boolean;
sort_order: number; sort_order: number;
created_at: number; created_at: number;
} }
@ -95,7 +95,7 @@ export default function Toolbox({
const res = await fetch('/api/annotation-types'); const res = await fetch('/api/annotation-types');
if (res.ok) { if (res.ok) {
const data = await res.json(); const data = await res.json();
setAnnotationTypes(data.filter((t: AnnotationType) => t.is_active === 1)); setAnnotationTypes(data.filter((t: AnnotationType) => t.is_active));
} }
} catch (error) { } catch (error) {
console.error('Failed to fetch annotation types:', error); console.error('Failed to fetch annotation types:', error);