From 1ced4a10696057b8df114dc95adf9868e8d7aa43 Mon Sep 17 00:00:00 2001 From: N3WT DE COMPET Date: Fri, 2 May 2025 15:49:46 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20Limite=20du=20nombre=20de=20responsables?= =?UTF-8?q?=20l=C3=A9gaux=20=C3=A0=202=20[#27]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Front-End/src/components/FileUpload.js | 4 +++- .../Inscription/ResponsableInputFields.js | 17 +++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Front-End/src/components/FileUpload.js b/Front-End/src/components/FileUpload.js index a461a9b..f809323 100644 --- a/Front-End/src/components/FileUpload.js +++ b/Front-End/src/components/FileUpload.js @@ -69,7 +69,9 @@ export default function FileUpload({

- {existingFile.split('/').pop()} + {typeof existingFile === 'string' + ? existingFile.split('/').pop() + : existingFile?.name || 'Fichier inconnu'}

diff --git a/Front-End/src/components/Inscription/ResponsableInputFields.js b/Front-End/src/components/Inscription/ResponsableInputFields.js index a9f5b18..e2397d4 100644 --- a/Front-End/src/components/Inscription/ResponsableInputFields.js +++ b/Front-End/src/components/Inscription/ResponsableInputFields.js @@ -14,6 +14,7 @@ export default function ResponsableInputFields({ }) { const t = useTranslations('ResponsableInputFields'); const { selectedEstablishmentId } = useEstablishment(); + const MAX_GUARDIANS = 2; useEffect(() => { const isValid = @@ -241,8 +242,20 @@ export default function ResponsableInputFields({
addGuardian(e)} + className={`w-8 h-8 ${ + guardians.length >= MAX_GUARDIANS + ? 'text-gray-400 cursor-not-allowed' + : 'text-green-500 cursor-pointer hover:text-green-700' + } transition-colors border-2 ${ + guardians.length >= MAX_GUARDIANS + ? 'border-gray-400' + : 'border-green-500 hover:border-green-700' + } rounded-full p-1`} + onClick={(e) => { + if (guardians.length < MAX_GUARDIANS) { + addGuardian(e); + } + }} />