import React from 'react'; import type { TFunction } from 'i18next'; import { useAuthStore } from '../../../store/authStore'; interface Props { t: TFunction; } /** * Crossfade ↔ Gapless are mutually exclusive — enabling one forces the * other off (`setGaplessEnabled(false)` / `setCrossfadeEnabled(false)` * on the toggle handlers) and the inactive row dims via opacity + * pointerEvents:none. * * When crossfade is on, a "Crossfade | Smart crossfade" segmented switch * (`crossfadeTrimSilence` false/true) picks the mode: classic crossfade * exposes the seconds slider, smart crossfade is content-driven and has * no duration to configure (just a short explainer). * * The `preservePlayNextOrder` toggle is independent of both and pinned * to the bottom of the block. */ export function PlaybackBehaviorBlock({ t }: Props) { const auth = useAuthStore(); return ( <>
{t('settings.crossfade')}
{auth.gaplessEnabled ? t('settings.notWithGapless') : t('settings.crossfadeDesc')}
{auth.crossfadeEnabled && !auth.gaplessEnabled && (
{auth.crossfadeTrimSilence ? (
{t('settings.autoDjDesc')}
) : (
auth.setCrossfadeSecs(parseFloat(e.target.value))} style={{ flex: 1, minWidth: 80, maxWidth: 200 }} id="crossfade-secs-slider" /> {t('settings.crossfadeSecs', { n: auth.crossfadeSecs.toFixed(1) })}
)}
)}
{t('settings.gapless')}
{auth.crossfadeEnabled ? t('settings.notWithCrossfade') : t('settings.gaplessDesc')}
{t('settings.preservePlayNextOrder')}
{t('settings.preservePlayNextOrderDesc')}
); }