mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-06-28 23:35:27 +08:00
fix: hide voice options until enabled
This commit is contained in:
@@ -28,6 +28,9 @@ export default function QuickSettingsContent({
|
|||||||
onPreferenceChange,
|
onPreferenceChange,
|
||||||
}: QuickSettingsContentProps) {
|
}: QuickSettingsContentProps) {
|
||||||
const { t } = useTranslation('settings');
|
const { t } = useTranslation('settings');
|
||||||
|
const inputSettingToggles = preferences.voiceEnabled
|
||||||
|
? INPUT_SETTING_TOGGLES
|
||||||
|
: INPUT_SETTING_TOGGLES.filter(({ key }) => key !== 'voiceEnabled');
|
||||||
|
|
||||||
const renderToggleRows = (items: PreferenceToggleItem[]) => (
|
const renderToggleRows = (items: PreferenceToggleItem[]) => (
|
||||||
items.map(({ key, labelKey, icon }) => (
|
items.map(({ key, labelKey, icon }) => (
|
||||||
@@ -67,7 +70,7 @@ export default function QuickSettingsContent({
|
|||||||
</QuickSettingsSection>
|
</QuickSettingsSection>
|
||||||
|
|
||||||
<QuickSettingsSection title={t('quickSettings.sections.inputSettings')}>
|
<QuickSettingsSection title={t('quickSettings.sections.inputSettings')}>
|
||||||
{renderToggleRows(INPUT_SETTING_TOGGLES)}
|
{renderToggleRows(inputSettingToggles)}
|
||||||
<p className="ml-3 text-xs text-gray-500 dark:text-gray-400">
|
<p className="ml-3 text-xs text-gray-500 dark:text-gray-400">
|
||||||
{t('quickSettings.sendByCtrlEnterDescription')}
|
{t('quickSettings.sendByCtrlEnterDescription')}
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ export default function VoiceSettingsTab() {
|
|||||||
const { t } = useTranslation('settings');
|
const { t } = useTranslation('settings');
|
||||||
const { preferences, setPreference } = useUiPreferences();
|
const { preferences, setPreference } = useUiPreferences();
|
||||||
const { config, update } = useVoiceConfig();
|
const { config, update } = useVoiceConfig();
|
||||||
|
const voiceEnabled = preferences.voiceEnabled;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-8">
|
<div className="space-y-8">
|
||||||
@@ -31,13 +32,14 @@ export default function VoiceSettingsTab() {
|
|||||||
<div className="text-xs text-muted-foreground">{t('voiceSettings.enableDescription')}</div>
|
<div className="text-xs text-muted-foreground">{t('voiceSettings.enableDescription')}</div>
|
||||||
</div>
|
</div>
|
||||||
<SettingsToggle
|
<SettingsToggle
|
||||||
checked={preferences.voiceEnabled}
|
checked={voiceEnabled}
|
||||||
onChange={(v) => setPreference('voiceEnabled', v)}
|
onChange={(v) => setPreference('voiceEnabled', v)}
|
||||||
ariaLabel={t('voiceSettings.enable')}
|
ariaLabel={t('voiceSettings.enable')}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</SettingsSection>
|
</SettingsSection>
|
||||||
|
|
||||||
|
{voiceEnabled && (
|
||||||
<SettingsSection title={t('voiceSettings.backendTitle')} description={t('voiceSettings.backendDescription')}>
|
<SettingsSection title={t('voiceSettings.backendTitle')} description={t('voiceSettings.backendDescription')}>
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<Field
|
<Field
|
||||||
@@ -83,6 +85,7 @@ export default function VoiceSettingsTab() {
|
|||||||
<p className="text-xs text-muted-foreground">{t('voiceSettings.note')}</p>
|
<p className="text-xs text-muted-foreground">{t('voiceSettings.note')}</p>
|
||||||
</div>
|
</div>
|
||||||
</SettingsSection>
|
</SettingsSection>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user