@@ -55,6 +55,9 @@ import { processAdhesion } from "./process-adhesion"
5555/** Max file size: 2 MB (in bytes) */
5656const MAX_FILE_SIZE = 2 * 1024 * 1024
5757
58+ /** Max photo size: 5 MB (in bytes) */
59+ const MAX_PHOTO_SIZE = 5 * 1024 * 1024
60+
5861const emptyBureauMember : BureauMember = {
5962 isAdmin : false ,
6063 poste : "" ,
@@ -91,6 +94,7 @@ const emptyForm = {
9194 lettreEngagement : undefined as unknown as File ,
9295 reglementInterieur : undefined as unknown as File ,
9396 bilanFinancier : undefined as unknown as File ,
97+ photos : [ ] as File [ ] ,
9498 captchaToken : ""
9599}
96100
@@ -1380,6 +1384,61 @@ export function AdhesionForm(): React.ReactNode {
13801384 )
13811385 } }
13821386 />
1387+
1388+ < form . Field
1389+ name = "photos"
1390+ children = { ( field ) => {
1391+ const isInvalid =
1392+ field . state . meta . isTouched &&
1393+ ! field . state . meta . isValid
1394+ return (
1395+ < Field data-invalid = { isInvalid } >
1396+ < FieldLabel
1397+ htmlFor = { field . name }
1398+ >
1399+ Trombinoscope{ " " }
1400+ < span className = "text-muted-foreground" >
1401+ (optionnel)
1402+ </ span >
1403+ </ FieldLabel >
1404+ < FieldDescription >
1405+ Ajoutez une photo de votre
1406+ bureau pour qu'on apprenne à
1407+ vous reconnaître !< br />
1408+ Formats acceptés : images
1409+ (PNG, JPG, WebP, SVG) ou
1410+ PDF. Jusqu'à 15 fichiers, 5
1411+ Mo maximum par fichier.
1412+ </ FieldDescription >
1413+ < FilePondInput
1414+ allowMultiple
1415+ maxFiles = { 15 }
1416+ maxFileSize = { `${ MAX_PHOTO_SIZE / ( 1024 * 1024 ) } MB` }
1417+ acceptedFileTypes = { [
1418+ "image/png" ,
1419+ "image/jpeg" ,
1420+ "image/webp" ,
1421+ "image/svg+xml" ,
1422+ "application/pdf"
1423+ ] }
1424+ onChangeMultiple = { ( files ) =>
1425+ field . handleChange (
1426+ files
1427+ )
1428+ }
1429+ />
1430+ { isInvalid && (
1431+ < FieldError
1432+ errors = {
1433+ field . state . meta
1434+ . errors
1435+ }
1436+ />
1437+ ) }
1438+ </ Field >
1439+ )
1440+ } }
1441+ />
13831442 </ FieldGroup >
13841443 </ FieldSet >
13851444
0 commit comments