fix: change is_active type from number to boolean to match API response
This commit is contained in:
parent
a75c9307d4
commit
4352732630
8 changed files with 14 additions and 14 deletions
|
|
@ -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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
|
|
|
||||||
|
|
@ -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}>
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue