'use client'; import { Listbox, ListboxButton, ListboxOption, ListboxOptions, } from '@headlessui/react'; import { ChevronUpDownIcon } from '@/components/icons/Icons'; import { useConfig } from '@/contexts/ConfigContext'; const speedOptions = [ { value: 0.5, label: '0.5x' }, { value: 0.75, label: '0.75x' }, { value: 1, label: '1x' }, { value: 1.25, label: '1.25x' }, { value: 1.5, label: '1.5x' }, { value: 1.75, label: '1.75x' }, { value: 2, label: '2x' }, { value: 2.5, label: '2.5x' }, { value: 3, label: '3x' }, ]; export const SpeedControl = ({ setSpeedAndRestart }: { setSpeedAndRestart: (speed: number) => void; }) => { const { voiceSpeed } = useConfig(); // Use voiceSpeed as the source of truth const currentSpeed = voiceSpeed; return (
{currentSpeed}x {speedOptions.map((option) => ( `relative cursor-pointer select-none py-0.5 px-1.5 sm:py-2 sm:px-3 ${active ? 'bg-offbase' : ''} ${selected ? 'font-medium' : ''}` } > {option.label} ))}
); }