radarr/frontend/src/Components/Form/Select/MonitorMoviesSelectInput.tsx
Mark McDowall 2c81f3be0f Improve typings in FormInputGroup
(cherry picked from commit 6838f068bcd04b770cd9c53873f160be97ea745f)
2025-04-15 22:30:42 +03:00

50 lines
1.1 KiB
TypeScript

import React from 'react';
import monitorOptions from 'Utilities/Movie/monitorOptions';
import translate from 'Utilities/String/translate';
import EnhancedSelectInput, {
EnhancedSelectInputProps,
EnhancedSelectInputValue,
} from './EnhancedSelectInput';
export interface MonitorMoviesSelectInputProps
extends Omit<
EnhancedSelectInputProps<EnhancedSelectInputValue<string>, string>,
'values'
> {
includeNoChange?: boolean;
includeMixed?: boolean;
}
function MonitorMoviesSelectInput(props: MonitorMoviesSelectInputProps) {
const {
includeNoChange = false,
includeMixed = false,
...otherProps
} = props;
const values: EnhancedSelectInputValue<string>[] = [...monitorOptions];
if (includeNoChange) {
values.unshift({
key: 'noChange',
get value() {
return translate('NoChange');
},
isDisabled: true,
});
}
if (includeMixed) {
values.unshift({
key: 'mixed',
get value() {
return `(${translate('Mixed')})`;
},
isDisabled: true,
});
}
return <EnhancedSelectInput {...otherProps} values={values} />;
}
export default MonitorMoviesSelectInput;