From 56c9eb37bb26cb179e0156ce96d75527b5b3e31b Mon Sep 17 00:00:00 2001 From: evlist Date: Mon, 12 Dec 2022 21:35:00 +0100 Subject: [PATCH] Minor modifications --- src/components/dialog/Dialog.tsx | 2 +- src/components/gpx-dialog/GpxDialog.tsx | 18 ++++++++++++------ src/components/gpx-import/GpxImport.tsx | 11 +++++++++-- src/i18n/en.ts | 1 + src/i18n/fr.ts | 1 + 5 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/components/dialog/Dialog.tsx b/src/components/dialog/Dialog.tsx index 09ef2a3..a65ca72 100644 --- a/src/components/dialog/Dialog.tsx +++ b/src/components/dialog/Dialog.tsx @@ -11,7 +11,7 @@ import CloseIcon from '@suid/icons-material/Close'; const Dialog: Component<{ open: boolean; title: JSXElement; - closeHandler: () => void; + closeHandler: (event: any, reason?: string) => void; children: JSXElement; }> = (props) => { return ( diff --git a/src/components/gpx-dialog/GpxDialog.tsx b/src/components/gpx-dialog/GpxDialog.tsx index 87cdff1..be04b63 100644 --- a/src/components/gpx-dialog/GpxDialog.tsx +++ b/src/components/gpx-dialog/GpxDialog.tsx @@ -53,8 +53,15 @@ const GpxDialog: Component<{}> = (props) => { gpx: gpx(), }); }; - const handleClose = () => { - setOpen(false); + const handleClose = (event: any, reason?: string) => { + console.log({ + caller: 'GpxDialog / handleClose', + event, + reason, + }); + if (reason === undefined) { + setOpen(false); + } }; const gpxChangeHandler = async (event: any) => { setSelectedGpxId(event.target.value); @@ -178,10 +185,9 @@ const GpxDialog: Component<{}> = (props) => { > {(gpx) => ( - + )} diff --git a/src/components/gpx-import/GpxImport.tsx b/src/components/gpx-import/GpxImport.tsx index 6eacee1..af3537d 100644 --- a/src/components/gpx-import/GpxImport.tsx +++ b/src/components/gpx-import/GpxImport.tsx @@ -71,8 +71,15 @@ const GpxImport: Component = () => { // } }; - const handleClose = () => { - setFilesToImport(undefined); + const handleClose = (event: any, reason?: string) => { + console.log({ + caller: 'GpxImport / handleClose', + event, + reason, + }); + if (reason === undefined) { + setFilesToImport(undefined); + } }; return ( diff --git a/src/i18n/en.ts b/src/i18n/en.ts index d00dba3..3ffe5d9 100644 --- a/src/i18n/en.ts +++ b/src/i18n/en.ts @@ -37,6 +37,7 @@ const dict = { gpxDialog: 'Current journey', gpxChooser: 'Journey', gpxName: 'Name', + gpxNoName:'No name', gpxDesc: 'Description', gpxTime: 'Start date', gpxSave: 'Save', diff --git a/src/i18n/fr.ts b/src/i18n/fr.ts index 9437897..0f2a300 100644 --- a/src/i18n/fr.ts +++ b/src/i18n/fr.ts @@ -41,6 +41,7 @@ const dict = { gpxDialog: 'Voyage en cours', gpxChooser: 'Voyage', gpxName: 'Nom', + gpxNoName:'Pas de nom', gpxDesc: 'Description', gpxTime: 'Date de début', gpxSave: 'Sauvegarder',