import { Box, Field, Flex, Radio, Typography, } from '@strapi/design-system'; import { useIntl } from 'react-intl'; import { getTranslationKey, type OptimizationChoice } from '../pluginId'; interface OptimizationChoicePickerProps { value: OptimizationChoice; onChange: (choice: OptimizationChoice) => void; disabled?: boolean; } const CHOICES: OptimizationChoice[] = ['original', 'global', 'custom']; export const OptimizationChoicePicker = ({ value, onChange, disabled = false, }: OptimizationChoicePickerProps) => { const { formatMessage } = useIntl(); return ( onChange(nextValue as OptimizationChoice)} disabled={disabled} > {CHOICES.map((choice) => { const selected = value === choice; return ( { if (!disabled) { onChange(choice); } }} style={{ cursor: disabled ? 'not-allowed' : 'pointer' }} > {formatMessage({ id: getTranslationKey(`choice.${choice}`) })} {formatMessage({ id: getTranslationKey(`choice.${choice}.description`) })} ); })} ); };