import React from "react"; import { Dropdown } from "../ui/Dropdown"; import { SettingContainer } from "../ui/SettingContainer"; import { ResetButton } from "../ui/ResetButton"; import { useSettings } from "../../hooks/useSettings"; interface MicrophoneSelectorProps { descriptionMode?: "inline" | "tooltip"; grouped?: boolean; } export const MicrophoneSelector: React.FC = React.memo(({ descriptionMode = "tooltip", grouped = false, }) => { const { getSetting, updateSetting, resetSetting, isUpdating, isLoading, audioDevices, refreshAudioDevices, } = useSettings(); const selectedMicrophone = getSetting("selected_microphone") === "default" ? "Default" : getSetting("selected_microphone") || "Default"; const handleMicrophoneSelect = async (deviceName: string) => { await updateSetting("selected_microphone", deviceName); }; const handleReset = async () => { await resetSetting("selected_microphone"); }; const microphoneOptions = audioDevices.map(device => ({ value: device.name, label: device.name })); return (
); });