import { type ShowCoordinates } from '@scrabble-solver/types'; import { type ChangeEvent, type FunctionComponent } from 'react'; import { useDispatch } from 'react-redux'; import { Radio } from '@/components'; import { selectShowCoordinates, settingsSlice, useTranslate, useTypedSelector } from '@/state'; import styles from './ShowCoordinatesSetting.module.scss'; interface Props { className?: string; disabled?: boolean; } export const ShowCoordinatesSetting: FunctionComponent = ({ className, disabled }) => { const dispatch = useDispatch(); const translate = useTranslate(); const value = useTypedSelector(selectShowCoordinates); const options = [ { label: translate('settings.showCoordinates.hidden'), value: 'hidden', }, { label: translate('settings.showCoordinates.original'), value: 'original', }, { label: translate('settings.showCoordinates.alternative'), value: 'alternative', }, ]; const handleChange = (event: ChangeEvent) => { const showCoordinates = event.target.value as ShowCoordinates; dispatch(settingsSlice.actions.changeShowCoordinates(showCoordinates)); }; return (
{options.map((option) => (
{option.label}
))}
); };