import { pushModal } from '@/modals'; import type { IReport, IChartRange, IChartType, IInterval, } from '@openpanel/validation'; import { SaveIcon } from 'lucide-react'; import { useState } from 'react'; import { ReportChart } from '../report-chart'; import { ReportChartType } from '../report/ReportChartType'; import { ReportInterval } from '../report/ReportInterval'; import { TimeWindowPicker } from '../time-window-picker'; import { Button } from '../ui/button'; export function ChatReport({ lazy, ...props }: { report: IReport & { startDate: string; endDate: string }; lazy: boolean }) { const [chartType, setChartType] = useState( props.report.chartType, ); const [startDate, setStartDate] = useState(props.report.startDate); const [endDate, setEndDate] = useState(props.report.endDate); const [range, setRange] = useState(props.report.range); const [interval, setInterval] = useState(props.report.interval); const report = { ...props.report, lineType: 'linear' as const, chartType, startDate: range === 'custom' ? startDate : null, endDate: range === 'custom' ? endDate : null, range, interval, }; return (
{props.report.name}
{ setChartType(type); }} />
); }