42 lines
1.0 KiB
TypeScript
42 lines
1.0 KiB
TypeScript
import DividerCard from './DividerCard';
|
|
import SignalsChart from './SignalsChart';
|
|
import TableViz from './TableViz';
|
|
import UpsChart from './UpsChart';
|
|
|
|
import type {
|
|
AlertConfig,
|
|
ChartConfig,
|
|
SessionBoundary,
|
|
SignalRow,
|
|
UpsRow,
|
|
TimeMode,
|
|
} from '@/lib/types';
|
|
|
|
export interface ChartCardProps {
|
|
config: ChartConfig;
|
|
rows: SignalRow[];
|
|
upsRows: UpsRow[];
|
|
sessions: SessionBoundary[];
|
|
alerts: AlertConfig[];
|
|
timeMode: TimeMode;
|
|
onEdit: () => void;
|
|
onDelete: () => void;
|
|
}
|
|
|
|
export default function ChartCard(props: ChartCardProps) {
|
|
const { config } = props;
|
|
if (config.chart_type === 'divider')
|
|
return <DividerCard title={config.title} onEdit={props.onEdit} onDelete={props.onDelete} />;
|
|
if (config.chart_type === 'ups') return <UpsChart {...props} />;
|
|
if (config.viz_type === 'table')
|
|
return (
|
|
<TableViz
|
|
config={props.config}
|
|
rows={props.rows}
|
|
onEdit={props.onEdit}
|
|
onDelete={props.onDelete}
|
|
/>
|
|
);
|
|
return <SignalsChart {...props} />;
|
|
}
|