@@ -28,6 +28,8 @@ const UploadModal = ({ isOpen, onClose, onUploadComplete }: UploadModalProps): J
2828 const fileInputRef = useRef < HTMLInputElement > ( null ) ;
2929 // Track the upload result to use when the user closes the success screen
3030 const [ uploadResult , setUploadResult ] = useState < MedicalReport | null > ( null ) ;
31+ // Track when to show the upload cancelled notice
32+ const [ showCancelNotice , setShowCancelNotice ] = useState ( false ) ;
3133
3234 const {
3335 file,
@@ -49,6 +51,8 @@ const UploadModal = ({ isOpen, onClose, onUploadComplete }: UploadModalProps): J
4951 // Effect to automatically start upload when a file is selected and validated
5052 useEffect ( ( ) => {
5153 if ( file && status === UploadStatus . IDLE ) {
54+ // When starting a new upload, hide the cancel notice if it's showing
55+ setShowCancelNotice ( false ) ;
5256 uploadFile ( ) ;
5357 }
5458 } , [ file , status , uploadFile ] ) ;
@@ -71,6 +75,8 @@ const UploadModal = ({ isOpen, onClose, onUploadComplete }: UploadModalProps): J
7175 const handleCancel = ( ) => {
7276 if ( status === UploadStatus . UPLOADING ) {
7377 cancelUpload ?.( ) ;
78+ // Show the cancel notice when a user explicitly cancels an upload in progress
79+ setShowCancelNotice ( true ) ;
7480 } else {
7581 reset ( ) ;
7682 setUploadResult ( null ) ;
@@ -87,6 +93,7 @@ const UploadModal = ({ isOpen, onClose, onUploadComplete }: UploadModalProps): J
8793 // Reset state
8894 reset ( ) ;
8995 setUploadResult ( null ) ;
96+ setShowCancelNotice ( false ) ;
9097
9198 // Close modal
9299 onClose ( ) ;
@@ -107,7 +114,18 @@ const UploadModal = ({ isOpen, onClose, onUploadComplete }: UploadModalProps): J
107114 { t ( 'upload.imageSizeLimit' ) } / { t ( 'upload.pdfSizeLimit' ) }
108115 </ p >
109116 </ div >
110- { error &&
117+
118+ { /* Show cancel notice */ }
119+ { showCancelNotice && (
120+ < div className = "upload-modal__cancel-notice" >
121+ < div className = "upload-modal__cancel-notice-icon" >
122+ < FontAwesomeIcon icon = { faCircleXmark } />
123+ </ div >
124+ < span > Upload cancelled.</ span >
125+ </ div >
126+ ) }
127+
128+ { error && ! showCancelNotice &&
111129 < IonItem className = 'upload-modal__error-message' >
112130 < div className = 'upload-modal__error-icon' slot = 'start' >
113131 < FontAwesomeIcon icon = { faCircleXmark } aria-hidden = "true" />
0 commit comments