import SwitchButtonGroup from '@/components/SwitchButtonGroup'; import { ZONES } from './constants'; import type { ModeType, UnitType, ZoneType } from './constants'; import LiveClock from './LiveClock'; import ResultView from './ResultView'; import { useTimestampConverter } from './useTimestampConverter'; import { useI18n } from '@/utils/chromeI18n'; import { cn } from '@/lib/utils'; import { Input } from '@/components/ui/input'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from '@/components/ui/select'; const MODE_OPTIONS: { value: ModeType; label: string }[] = [ { value: 'ts2dt', label: 'timestamp:tsToDate' }, { value: 'dt2ts', label: 'timestamp:dateToTs' }, ]; const UNIT_OPTIONS: { value: UnitType; label: string }[] = [ { value: 'ms', label: 'timestamp:unitMs' }, { value: 's', label: 'timestamp:unitS' }, ]; export default function Index() { const { t } = useI18n('timestamp'); const { mode, input, unit, zone, result, error, setMode, setInput, setUnit, setZone, handleUseNow, } = useTimestampConverter(); return (
({ ...o, label: t(o.label) }))} onChange={setMode} size="small" />
setInput(e.target.value)} className={cn( 'font-mono font-semibold h-10 shadow-sm placeholder:text-muted-foreground/60 focus:bg-background', error && 'border-destructive focus-visible:ring-destructive', )} /> {error &&

{error}

}
({ ...o, label: t(o.label) }))} onChange={setUnit} size="small" className="sm:w-auto shrink-0" />
); }