@@ -36,7 +36,8 @@ const UploadOptionsPopup: React.FC<UploadOptionsPopupProps> = ({
3636 questionSetId,
3737 identifier,
3838 onSubmissionSuccess,
39- setAssessmentTrackingData
39+ setAssessmentTrackingData,
40+ customMaxImages = 4
4041} ) => {
4142 const { t } = useTranslation ( ) ;
4243 const [ isCameraOpen , setIsCameraOpen ] = useState ( false ) ;
@@ -79,8 +80,8 @@ const UploadOptionsPopup: React.FC<UploadOptionsPopupProps> = ({
7980 if ( ! files || files . length === 0 ) return ;
8081
8182 // Check if adding new files would exceed the limit
82- if ( uploadedImages . length + files . length > 4 ) {
83- showToast ( ' You can only upload up to 4 images' , 'warning' ) ;
83+ if ( uploadedImages . length + files . length > customMaxImages ) {
84+ showToast ( ` You can only upload up to ${ customMaxImages } images` , 'warning' ) ;
8485 return ;
8586 }
8687
@@ -150,8 +151,8 @@ const UploadOptionsPopup: React.FC<UploadOptionsPopupProps> = ({
150151
151152 const handleCameraCapture = async ( imageData : string , fileName : string ) => {
152153 // Check if adding new image would exceed the limit
153- if ( uploadedImages . length >= 4 ) {
154- showToast ( ' You can only upload up to 4 images' , 'warning' ) ;
154+ if ( uploadedImages . length >= customMaxImages ) {
155+ showToast ( ` You can only upload up to ${ customMaxImages } images` , 'warning' ) ;
155156 setIsCameraOpen ( false ) ;
156157 return ;
157158 }
@@ -332,7 +333,7 @@ const UploadOptionsPopup: React.FC<UploadOptionsPopupProps> = ({
332333 fontWeight : 400 ,
333334 } }
334335 >
335- { t ( 'AI.FORMAT_JPG_SIZE_5MB_UP_TO_4_IMAGES' ) }
336+ { t ( 'ASSESSMENTS.FORMAT_JPG_SIZE_MB_UP_TO_IMAGES' , { mb : 5 , count : customMaxImages } ) }
336337 </ Typography >
337338 </ Box >
338339
@@ -358,7 +359,7 @@ const UploadOptionsPopup: React.FC<UploadOptionsPopupProps> = ({
358359 { /* Take Photo Button */ }
359360 < Button
360361 onClick = { ! isUploading ? handleTakePhoto : undefined }
361- disabled = { isUploading || uploadedImages . length >= 4 }
362+ disabled = { isUploading || uploadedImages . length >= customMaxImages }
362363 variant = "outlined"
363364 startIcon = { < PhotoCameraIcon /> }
364365 sx = { {
@@ -381,15 +382,15 @@ const UploadOptionsPopup: React.FC<UploadOptionsPopupProps> = ({
381382 >
382383 { isUploading
383384 ? 'Uploading...'
384- : uploadedImages . length >= 4
385- ? ' Max 4 Images'
385+ : uploadedImages . length >= customMaxImages
386+ ? ` Max ${ customMaxImages } Images`
386387 : 'Take A Photo' }
387388 </ Button >
388389
389390 { /* Upload Photo Button */ }
390391 < Button
391392 onClick = { ! isUploading ? handleChooseFromGallery : undefined }
392- disabled = { isUploading || uploadedImages . length >= 4 }
393+ disabled = { isUploading || uploadedImages . length >= customMaxImages }
393394 variant = "outlined"
394395 startIcon = { < CloudUploadIcon /> }
395396 sx = { {
@@ -412,8 +413,8 @@ const UploadOptionsPopup: React.FC<UploadOptionsPopupProps> = ({
412413 >
413414 { isUploading
414415 ? 'Uploading...'
415- : uploadedImages . length >= 4
416- ? ' Max 4 Images'
416+ : uploadedImages . length >= customMaxImages
417+ ? ` Max ${ customMaxImages } Images`
417418 : 'Upload A Photo' }
418419 </ Button >
419420 </ Box >
0 commit comments