diff --git a/packages/pn-commons/src/components/CodeModal/CodeInput.tsx b/packages/pn-commons/src/components/CodeModal/CodeInput.tsx index 838c753c0..4f01c1407 100644 --- a/packages/pn-commons/src/components/CodeModal/CodeInput.tsx +++ b/packages/pn-commons/src/components/CodeModal/CodeInput.tsx @@ -12,6 +12,8 @@ import { import { TextField } from '@mui/material'; +import { getLocalizedOrDefaultLabel } from '../../utility/localization.utility'; + type Props = { initialValues: Array; onChange: (values: Array) => void; @@ -126,13 +128,15 @@ const CodeInput = ({ initialValues, isReadOnly, hasError, onChange }: Props) => onChange(currentValues); }, [currentValues]); - const cifre = ['primo', 'secondo', 'terzo', 'quarto', 'ultimo']; + const digits = getLocalizedOrDefaultLabel('common', 'code-modal.digits', undefined, { + returnObjects: true, + }); return ( {initialValues.map((_value, index) => ( void; + cancelLabel: string; + cancelCallback: () => void; confirmCallback?: (values: Array) => void; isReadOnly?: boolean; error?: { title: string; message: string; hasError: boolean }; @@ -38,24 +38,6 @@ type ModalHandle = { updateError: (error: ErrorMessage, codeNotValid: boolean) => void; }; -const RenderCopyToClipboardButton: React.FC<{ - isReadOnly: boolean; - initialValues: Array; -}> = ({ isReadOnly, initialValues }) => - isReadOnly && ( - - ); - /** * This modal allows the user to input a verification code. * @param title title to show @@ -140,7 +122,7 @@ const CodeModal = forwardRef( return ( ( {codeSectionTitle} - {codeSectionAdditional && {codeSectionAdditional}} ( hasError={internalHasError} onChange={changeHandler} /> + {isReadOnly && ( + + )} - + {codeSectionAdditional && {codeSectionAdditional}} {internalHasError && ( @@ -174,16 +164,14 @@ const CodeModal = forwardRef( )} - {cancelLabel && cancelCallback && ( - - )} + {confirmLabel && confirmCallback && (