import { CheckIcon, ChevronsUpDown, Globe } from 'lucide-react' import { useId, useState } from 'react' import { Button, cn, Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, Popover, PopoverContent, PopoverTrigger, ScrollArea, } from 'ui' import { ALL_TIMEZONES } from './PITR.constants' import type { Timezone } from './PITR.types' interface TimezoneSelectionProps { selectedTimezone: Timezone onSelectTimezone: (timezone: Timezone) => void } export const TimezoneSelection = ({ selectedTimezone, onSelectTimezone, }: TimezoneSelectionProps) => { const [open, setOpen] = useState(false) const listboxId = useId() const timezoneOptions = ALL_TIMEZONES.map((option) => option.text) return (
No timezones found... {timezoneOptions.map((option) => ( { const selectedTimezone = ALL_TIMEZONES.find( (option) => option.text === text ) if (selectedTimezone) { onSelectTimezone(selectedTimezone) setOpen(false) } }} > {option} ))}
) }