Files
Psychotoxical-psysonic/src/components/settings/audio/HiResCrossfadeResampleBlock.tsx
T
Psychotoxical 1031590742 fix(settings): align AutoDJ and Hi-Res sub-options with the Normalization design (#1175)
* fix(settings): box the AutoDJ and Hi-Res sub-options like Normalization

The AutoDJ overlap-cap and the Hi-Res blend-rate options sat bare in their
sections instead of in the bordered sub-card the Normalization block uses for
its per-mode controls. Wrap both (and the crossfade-seconds slider, for
consistency within Track transitions) in the shared settings-norm-block card,
and drop the redundant SettingsGroup wrapper from the Hi-Res block — the Audio
tab already wraps that section in a group, so the block added a second border.

* docs(changelog): audio sub-section design fix; move recent entries to the end of Fixed

The #1172 and #1174 entries were prepended to the Fixed section instead of
appended; move them to the end where new entries belong, and add the #1175
audio settings entry.
2026-06-24 21:53:04 +02:00

56 lines
1.8 KiB
TypeScript

import {
HI_RES_CROSSFADE_RESAMPLE_OPTIONS,
type HiResCrossfadeResampleHz,
sanitizeHiResCrossfadeResampleHz,
} from '../../../utils/audio/hiResCrossfadeResample';
import type { TFunction } from 'i18next';
interface Props {
enabled: boolean;
resampleHz: HiResCrossfadeResampleHz;
onResampleHzChange: (hz: HiResCrossfadeResampleHz) => void;
t: TFunction;
}
function labelForHz(t: TFunction, hz: HiResCrossfadeResampleHz): string {
if (hz === 88_200) return t('settings.hiResCrossfadeResample88');
if (hz === 96_000) return t('settings.hiResCrossfadeResample96');
return t('settings.hiResCrossfadeResample44');
}
/** Hi-Res crossfade / AutoDJ / gapless blend-rate picker (visible when hi-res is on). */
export function HiResCrossfadeResampleBlock({
enabled,
resampleHz,
onResampleHzChange,
t,
}: Props) {
if (!enabled) return null;
return (
<div className="settings-norm-block" style={{ marginTop: '0.85rem' }}>
<div className="settings-norm-field">
<span className="settings-norm-label" style={{ minWidth: 0 }}>
{t('settings.hiResCrossfadeResampleTitle')}
</span>
<div className="settings-norm-help">{t('settings.hiResCrossfadeResampleDesc')}</div>
<div className="settings-segmented">
{HI_RES_CROSSFADE_RESAMPLE_OPTIONS.map((hz) => (
<button
key={hz}
type="button"
className={`btn ${resampleHz === hz ? 'btn-primary' : 'btn-ghost'}`}
onClick={() => onResampleHzChange(sanitizeHiResCrossfadeResampleHz(hz))}
>
{labelForHz(t, hz)}
</button>
))}
</div>
<div className="settings-norm-help" role="note">
{t('settings.hiResCrossfadeResampleWarning')}
</div>
</div>
</div>
);
}