'use client'; import { useState, useEffect } from 'react'; import { FormControl, InputLabel, Select, MenuItem, SelectChangeEvent, Box, Typography, } from '@mui/material'; import { useLocale, MeasurementSystem } from '@/hooks/useLocale'; import { useTranslation } from '@/hooks/useTranslation'; interface MeasurementUnitSelectorProps { variant?: 'standard' | 'outlined' | 'filled'; fullWidth?: boolean; showDescription?: boolean; } /** * Measurement unit selector component for choosing between Metric and Imperial systems */ export function MeasurementUnitSelector({ variant = 'outlined', fullWidth = true, showDescription = true, }: MeasurementUnitSelectorProps) { const { measurementSystem, setMeasurementSystem } = useLocale(); const { t } = useTranslation('settings'); const [selectedSystem, setSelectedSystem] = useState(measurementSystem); useEffect(() => { setSelectedSystem(measurementSystem); }, [measurementSystem]); const handleSystemChange = (event: SelectChangeEvent) => { const newSystem = event.target.value as MeasurementSystem; setSelectedSystem(newSystem); setMeasurementSystem(newSystem); }; return ( {t('preferences.measurementUnits')} ); }