import { useEffect, useState } from 'react' import { Save, Settings2 } from 'lucide-react' import { useTranslation } from 'react-i18next' import type { TimeGranularity } from '@/lib/time' import { Button } from '@/components/ui/button' import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from '@/components/ui/dialog' import { Label } from '@/components/ui/label' import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from '@/components/ui/select' import { CONSUMPTION_DISTRIBUTION_CHART_OPTIONS, MODEL_ANALYTICS_CHART_OPTIONS, TIME_GRANULARITY_OPTIONS, TIME_RANGE_PRESETS, } from '@/features/dashboard/constants' import type { ConsumptionDistributionChartType, DashboardChartPreferences, ModelAnalyticsChartTab, } from '@/features/dashboard/types' interface ModelsChartPreferencesProps { preferences: DashboardChartPreferences onPreferencesChange: (preferences: DashboardChartPreferences) => void } export function ModelsChartPreferences(props: ModelsChartPreferencesProps) { const { t } = useTranslation() const [open, setOpen] = useState(false) const [draft, setDraft] = useState( props.preferences ) useEffect(() => { if (open) setDraft(props.preferences) }, [open, props.preferences]) const handleSave = () => { props.onPreferencesChange(draft) setOpen(false) } return ( }> {t('Preferences')} {t('Dashboard Preferences')} {t( 'Choose the default charts, range, and time granularity for model analytics.' )}
) }