1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-22 22:15:17 -04:00

Convert Form Components to TypeScript

Co-authored-by: Mark McDowall <mark@mcdowall.ca>

Remove defaultProps from TypeScript components

(cherry picked from commit a90c13e86f798841cb6db038bb6b6d1408a00585)

Fix multi-select checkboxes not appearing

(cherry picked from commit e199710c15fbfa643a9f71c7a20f70b1722d0df6)
This commit is contained in:
Bogdan
2025-04-13 14:55:32 +03:00
parent 445babbca8
commit c8299f7e57
135 changed files with 5013 additions and 5530 deletions
@@ -0,0 +1,43 @@
import React, { useMemo } from 'react';
import { EnhancedSelectInputChanged } from 'typings/inputs';
import EnhancedSelectInput, {
EnhancedSelectInputValue,
} from './EnhancedSelectInput';
interface LanguageSelectInputProps {
name: string;
value: number;
values: EnhancedSelectInputValue<number>[];
onChange: (change: EnhancedSelectInputChanged<number>) => void;
}
function LanguageSelectInput({
values,
onChange,
...otherProps
}: LanguageSelectInputProps) {
const mappedValues = useMemo(() => {
const minId = values.reduce(
(min: number, v) => (v.key < 1 ? v.key : min),
values[0].key
);
return values.map(({ key, value }) => {
return {
key,
value,
dividerAfter: minId < 1 ? key === minId : false,
};
});
}, [values]);
return (
<EnhancedSelectInput
{...otherProps}
values={mappedValues}
onChange={onChange}
/>
);
}
export default LanguageSelectInput;