From 073d0c4dc5148a7967b889e4325b272322c00fcd Mon Sep 17 00:00:00 2001 From: EmVal Date: Thu, 6 Feb 2025 14:54:58 +0100 Subject: [PATCH] Create importDetails model --- src/App.tsx | 7 ---- .../ImportFlowPage/ImportFlowPage.tsx | 2 +- src/models/ImportDetails.ts | 35 +++++++++++++++++++ src/routes/routes.ts | 34 ------------------ 4 files changed, 36 insertions(+), 42 deletions(-) create mode 100644 src/models/ImportDetails.ts diff --git a/src/App.tsx b/src/App.tsx index aff1759..1268f2d 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -36,13 +36,6 @@ import { Overlay } from './components/Overlay'; import { useStore } from './store/GlobalStore'; import ImportFlow from './routes/ImportFlowPage'; -console.log('PageRoutesConf:', PageRoutesConf); -console.log('IMPORT:', PageRoutesConf.IMPORT); -console.log('IMPORT children:', PageRoutesConf.IMPORT?.children); -console.log('IMPORT_FLOWS path:', PageRoutesConf.IMPORT?.children?.FLOWS?.path); - - - const router = createBrowserRouter([ { element: , diff --git a/src/components/ImportFlowPage/ImportFlowPage.tsx b/src/components/ImportFlowPage/ImportFlowPage.tsx index 4c3dc90..bcb5425 100644 --- a/src/components/ImportFlowPage/ImportFlowPage.tsx +++ b/src/components/ImportFlowPage/ImportFlowPage.tsx @@ -5,8 +5,8 @@ import { useTranslation } from 'react-i18next'; import { AltRoute, ArrowBack } from '@mui/icons-material'; import { useState } from 'react'; import { useNavigate, useParams } from 'react-router-dom'; -import { importFlowConfig } from '../../routes/routes'; import TitleComponent from '../TitleComponent/TitleComponent'; +import { importFlowConfig } from '../../models/ImportDetails'; const ImportFlow = () => { diff --git a/src/models/ImportDetails.ts b/src/models/ImportDetails.ts new file mode 100644 index 0000000..f728bfd --- /dev/null +++ b/src/models/ImportDetails.ts @@ -0,0 +1,35 @@ +import { PageRoutes } from '../routes/routes'; + +interface ImportFlowDetail { + title: string, + fileExtensionsAllowed: string[], + backRoute: string, + successRoute: string, + requiredFieldDescription?: string, + flowTypes?: string[] +} + +type ImportFlowDetails = Record + +export const importFlowConfig: ImportFlowDetails = { + 'telematic-receipt': { + title: 'commons.routes.TELEMATIC_RECEIPT_IMPORT_FLOW', + fileExtensionsAllowed: ['zip'], + backRoute: PageRoutes.TELEMATIC_RECEIPT_IMPORT_OVERVIEW, + successRoute: PageRoutes.TELEMATIC_RECEIPT_IMPORT_FLOW_THANK_YOU_PAGE + }, + 'reporting': { + title: 'commons.routes.REPORTING_IMPORT_FLOW', + fileExtensionsAllowed: ['zip'], + backRoute: PageRoutes.REPORTING_IMPORT_OVERVIEW, + successRoute: PageRoutes.REPORTING_IMPORT_FLOW_THANK_YOU_PAGE + }, + 'treasury': { + title: 'commons.routes.TREASURY_IMPORT_FLOW', + fileExtensionsAllowed: ['zip'], + backRoute: PageRoutes.TREASURY, + successRoute: PageRoutes.REPORTING_IMPORT_FLOW_THANK_YOU_PAGE, + requiredFieldDescription: 'commons.requiredFieldDescription', + flowTypes: ['Giornale di Cassa XLS', 'Giornale di Cassa CSV', 'Giornale di Cassa OPI', 'Estrato conto poste'] + } +}; diff --git a/src/routes/routes.ts b/src/routes/routes.ts index 3d49404..a9c0a21 100644 --- a/src/routes/routes.ts +++ b/src/routes/routes.ts @@ -64,37 +64,3 @@ export const generateFlatRoutes = (routes: PageRoutes = PageRoutesConf): Record< }; export const PageRoutes = generateFlatRoutes(); - -interface ImportFlowDetail { - title: string, - fileExtensionsAllowed: string[], - backRoute: string, - successRoute: string, - requiredFieldDescription?: string, - flowTypes?: string[] -} - -type ImportFlowDetails = Record - -export const importFlowConfig: ImportFlowDetails = { - 'telematic-receipt': { - title: 'commons.routes.TELEMATIC_RECEIPT_IMPORT_FLOW', - fileExtensionsAllowed: ['zip'], - backRoute: PageRoutes.TELEMATIC_RECEIPT_IMPORT_OVERVIEW, - successRoute: PageRoutes.TELEMATIC_RECEIPT_IMPORT_FLOW_THANK_YOU_PAGE - }, - 'reporting': { - title: 'commons.routes.REPORTING_IMPORT_FLOW', - fileExtensionsAllowed: ['zip'], - backRoute: PageRoutes.REPORTING_IMPORT_OVERVIEW, - successRoute: PageRoutes.REPORTING_IMPORT_FLOW_THANK_YOU_PAGE - }, - 'treasury': { - title: 'commons.routes.TREASURY_IMPORT_FLOW', - fileExtensionsAllowed: ['zip'], - backRoute: PageRoutes.TREASURY, - successRoute: PageRoutes.REPORTING_IMPORT_FLOW_THANK_YOU_PAGE, - requiredFieldDescription: 'commons.requiredFieldDescription', - flowTypes: ['Giornale di Cassa XLS', 'Giornale di Cassa CSV', 'Giornale di Cassa OPI', 'Estrato conto poste'] - } -};