diff --git a/frontend/src/Components/Form/AvailabilitySelectInput.js b/frontend/src/Components/Form/AvailabilitySelectInput.js deleted file mode 100644 index 4b65ea1db..000000000 --- a/frontend/src/Components/Form/AvailabilitySelectInput.js +++ /dev/null @@ -1,69 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import translate from 'Utilities/String/translate'; -import EnhancedSelectInput from './EnhancedSelectInput'; - -const availabilityOptions = [ - { - key: 'announced', - get value() { - return translate('Announced'); - } - }, - { - key: 'inCinemas', - get value() { - return translate('InCinemas'); - } - }, - { - key: 'released', - get value() { - return translate('Released'); - } - } -]; - -function AvailabilitySelectInput(props) { - const values = [...availabilityOptions]; - - const { - includeNoChange, - includeMixed - } = props; - - if (includeNoChange) { - values.unshift({ - key: 'noChange', - value: translate('NoChange'), - isDisabled: true - }); - } - - if (includeMixed) { - values.unshift({ - key: 'mixed', - value: '(Mixed)', - isDisabled: true - }); - } - - return ( - - ); -} - -AvailabilitySelectInput.propTypes = { - includeNoChange: PropTypes.bool.isRequired, - includeMixed: PropTypes.bool.isRequired -}; - -AvailabilitySelectInput.defaultProps = { - includeNoChange: false, - includeMixed: false -}; - -export default AvailabilitySelectInput; diff --git a/frontend/src/Components/Form/AvailabilitySelectInput.tsx b/frontend/src/Components/Form/AvailabilitySelectInput.tsx new file mode 100644 index 000000000..3e161d18d --- /dev/null +++ b/frontend/src/Components/Form/AvailabilitySelectInput.tsx @@ -0,0 +1,67 @@ +import React from 'react'; +import translate from 'Utilities/String/translate'; +import EnhancedSelectInput from './EnhancedSelectInput'; + +interface AvailabilitySelectInputProps { + includeNoChange: boolean; + includeNoChangeDisabled?: boolean; + includeMixed?: boolean; +} + +interface IMovieAvailabilityOption { + key: string; + value: string; + format?: string; + isDisabled?: boolean; +} + +const movieAvailabilityOptions: IMovieAvailabilityOption[] = [ + { + key: 'announced', + get value() { + return translate('Announced'); + }, + }, + { + key: 'inCinemas', + get value() { + return translate('InCinemas'); + }, + }, + { + key: 'released', + get value() { + return translate('Released'); + }, + }, +]; + +function AvailabilitySelectInput(props: AvailabilitySelectInputProps) { + const values = [...movieAvailabilityOptions]; + + const { + includeNoChange = false, + includeNoChangeDisabled = true, + includeMixed = false, + } = props; + + if (includeNoChange) { + values.unshift({ + key: 'noChange', + value: translate('NoChange'), + isDisabled: includeNoChangeDisabled, + }); + } + + if (includeMixed) { + values.unshift({ + key: 'mixed', + value: `(${translate('Mixed')})`, + isDisabled: true, + }); + } + + return ; +} + +export default AvailabilitySelectInput;