Skip to content

Commit cbc469b

Browse files
committed
Add upload page title and improve modal handling
1 parent 619f412 commit cbc469b

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

frontend/src/common/utils/i18n/resources/en/common.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@
8080
"pages": {
8181
"chat": {
8282
"title": "AI Assistant"
83+
},
84+
"upload": {
85+
"title": "Upload Report"
8386
}
8487
}
8588
}

frontend/src/pages/Upload/UploadPage.tsx

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { IonContent, IonHeader, IonPage, IonTitle, IonToolbar, IonButton } from '@ionic/react';
1+
import { IonContent, IonHeader, IonPage, IonTitle, IonToolbar } from '@ionic/react';
22
import { useTranslation } from 'react-i18next';
3-
import { useState } from 'react';
3+
import { useEffect, useState } from 'react';
44
import { useHistory } from 'react-router-dom';
55
import UploadModal from 'common/components/Upload/UploadModal';
66

@@ -10,7 +10,7 @@ import UploadModal from 'common/components/Upload/UploadModal';
1010
*/
1111
const UploadPage = (): JSX.Element => {
1212
const { t } = useTranslation();
13-
const [isModalOpen, setIsModalOpen] = useState(false);
13+
const [isModalOpen, setIsModalOpen] = useState(true);
1414
const history = useHistory();
1515

1616
const handleUploadComplete = () => {
@@ -21,6 +21,16 @@ const UploadPage = (): JSX.Element => {
2121
history.push('/tabs/home');
2222
};
2323

24+
useEffect(() => {
25+
// Automatically open the upload modal when the component mounts
26+
setIsModalOpen(true);
27+
28+
// Cleanup function to close the modal when the component unmounts
29+
return () => {
30+
setIsModalOpen(false);
31+
};
32+
}, []);
33+
2434
return (
2535
<IonPage>
2636
<IonHeader>
@@ -29,15 +39,6 @@ const UploadPage = (): JSX.Element => {
2939
</IonToolbar>
3040
</IonHeader>
3141
<IonContent>
32-
<div className="ion-padding">
33-
<h1>{t('pages.upload.subtitle')}</h1>
34-
<p>{t('pages.upload.description')}</p>
35-
36-
<IonButton expand="block" className="ion-margin-top" onClick={() => setIsModalOpen(true)}>
37-
{t('upload.selectFile')}
38-
</IonButton>
39-
</div>
40-
4142
<UploadModal
4243
isOpen={isModalOpen}
4344
onClose={() => setIsModalOpen(false)}

0 commit comments

Comments
 (0)