refactor(Settings): external player options

This commit is contained in:
Tim 2023-12-18 14:49:03 +01:00
parent f0f11d15ba
commit 63d0a44fc7

View file

@ -213,14 +213,12 @@ const useProfileSettingsInputs = (profile) => {
const playInExternalPlayerSelect = React.useMemo(() => ({ const playInExternalPlayerSelect = React.useMemo(() => ({
options: externalPlayerOptions.map((opt) => ({ options: externalPlayerOptions.map((opt) => ({
value: opt.value, value: opt.value,
label: t(opt.label) label: t(opt.label),
})), })),
selected: [`${profile.settings.playerType || 'internal'}`], selected: [profile.settings.playerType],
renderLabelText: () => { renderLabelText: () => {
const selectedLabel = externalPlayerOptions.find( const selectedOption = externalPlayerOptions.find(({ value }) => value === profile.settings.playerType);
(opt) => opt.value === profile.settings.playerType return selectedOption ? t(selectedOption.label, { defaultValue: selectedOption.label }) : profile.settings.playerType;
)?.label;
return t(selectedLabel);
}, },
onSelect: (event) => { onSelect: (event) => {
core.transport.dispatch({ core.transport.dispatch({