fix(eq): show the active AutoEQ profile name in the preset picker (#1147)

* fix(eq): surface the active AutoEQ profile name in the preset picker

* i18n(settings): add AutoEQ preset group label (10 locales)

* docs(changelog): AutoEQ active-profile picker fix (#1147)
This commit is contained in:
Psychotoxical
2026-06-21 22:58:33 +02:00
committed by GitHub
parent 887c940e1b
commit ec8cfbc1c8
13 changed files with 75 additions and 1 deletions
+52
View File
@@ -0,0 +1,52 @@
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
import { cleanup, screen } from '@testing-library/react';
import { renderWithProviders } from '../test/helpers/renderWithProviders';
import Equalizer from './Equalizer';
import { useEqStore } from '../store/eqStore';
const FLAT = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
function resetEq(over: Record<string, unknown> = {}): void {
useEqStore.setState({
gains: [...FLAT],
enabled: true,
preGain: 0,
activePreset: 'Flat',
customPresets: [],
...over,
});
}
describe('Equalizer preset picker', () => {
beforeEach(() => resetEq());
afterEach(() => cleanup());
it('shows the active AutoEQ profile name in the picker', () => {
// AutoEQ sets activePreset to the headphone name — neither a built-in nor a
// saved custom preset. It must still be visible in the picker.
resetEq({ activePreset: 'Sennheiser HD 600', customPresets: [] });
const { container } = renderWithProviders(<Equalizer />);
expect(screen.getByText('Sennheiser HD 600')).toBeInTheDocument();
// AutoEQ profiles are not deletable custom presets → no delete button.
expect(container.querySelector('[data-tooltip="Delete preset"]')).toBeNull();
});
it('shows the delete button only for a saved custom preset', () => {
resetEq({
activePreset: 'My Mix',
customPresets: [{ name: 'My Mix', gains: [...FLAT], builtin: false }],
});
const { container } = renderWithProviders(<Equalizer />);
expect(screen.getByText('My Mix')).toBeInTheDocument();
expect(container.querySelector('[data-tooltip="Delete preset"]')).not.toBeNull();
});
it('shows no delete button for a built-in preset', () => {
resetEq({ activePreset: 'Rock' });
const { container } = renderWithProviders(<Equalizer />);
expect(container.querySelector('[data-tooltip="Delete preset"]')).toBeNull();
});
});
+7 -1
View File
@@ -55,7 +55,12 @@ export default function Equalizer() {
return () => details.removeEventListener('toggle', onToggle);
}, [redraw]);
const isCustomSaved = activePreset && !BUILTIN_PRESETS.some(p => p.name === activePreset);
const isCustomSaved = activePreset !== null && customPresets.some(p => p.name === activePreset);
const isBuiltin = activePreset !== null && BUILTIN_PRESETS.some(p => p.name === activePreset);
// AutoEQ profiles store the headphone name in activePreset, which is neither a
// built-in nor a saved custom preset — surface it in the picker so the active
// profile name stays visible after the lookup clears.
const isAutoEq = activePreset !== null && !isBuiltin && !isCustomSaved;
const selectValue = activePreset ?? '__custom__';
const handleSave = () => {
@@ -85,6 +90,7 @@ export default function Equalizer() {
onChange={v => applyPreset(v)}
options={[
...(activePreset === null ? [{ value: '__custom__', label: t('settings.eqPresetCustom'), disabled: true }] : []),
...(isAutoEq ? [{ value: activePreset!, label: activePreset!, group: t('settings.eqPresetAutoEqGroup') }] : []),
...BUILTIN_PRESETS.map(p => ({ value: p.name, label: p.name, group: t('settings.eqPresetBuiltin') })),
...customPresets.map(p => ({ value: p.name, label: p.name, group: t('settings.eqPresetCustomGroup') })),
]}