From eb74a4a906cde3aace5b3d52d0e13f471b9e2764 Mon Sep 17 00:00:00 2001 From: olewandowski1 Date: Wed, 30 Oct 2024 08:45:07 +0100 Subject: [PATCH] OM-3329: dashboard init --- src/index.js | 2 ++ src/pages/DashboardPage.js | 38 ++++++++++++++++++++++++++++++++++++++ src/translations/en.json | 3 ++- 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 src/pages/DashboardPage.js diff --git a/src/index.js b/src/index.js index 4b029e7..5bae641 100644 --- a/src/index.js +++ b/src/index.js @@ -44,6 +44,7 @@ import WorkerSearcherSelectActions from './components/WorkerSearcherSelectAction import GroupsPage from './pages/GroupsPage'; import GroupDetailsPage from './pages/GroupDetailsPage'; import PublicVoucherDetailsPage from './pages/PublicVoucherDetailsPage'; +import DashboardPage from './pages/DashboardPage'; const ROUTE_PUBLIC_WORKER_VOUCHER_PAGE = 'voucher/check'; const ROUTE_WORKER_VOUCHERS_LIST = 'voucher/vouchers'; @@ -183,6 +184,7 @@ const DEFAULT_CONFIG = { ], 'workerVoucher.VoucherHeadPanel': [BillVoucherHeadPanel], 'workerVoucher.WorkerSearcherAction.select': WorkerSearcherSelectActions, + 'home.HomePage.customDashboard': DashboardPage, }; export const WorkerVoucherModule = (cfg) => ({ ...DEFAULT_CONFIG, ...cfg }); diff --git a/src/pages/DashboardPage.js b/src/pages/DashboardPage.js new file mode 100644 index 0000000..6d676dd --- /dev/null +++ b/src/pages/DashboardPage.js @@ -0,0 +1,38 @@ +import React, { useEffect } from 'react'; +import { useSelector } from 'react-redux'; + +import { Typography } from '@material-ui/core'; +import { makeStyles } from '@material-ui/styles'; + +import { useTranslations } from '@openimis/fe-core'; +import { MODULE_NAME } from '../constants'; + +export const useStyles = makeStyles((theme) => ({ + page: theme.page, + pageTitle: { + fontWeight: 600, + }, +})); + +function DashboardPage() { + const classes = useStyles(); + const { formatMessageWithValues } = useTranslations(MODULE_NAME); + const { economicUnit } = useSelector((state) => state.policyHolder); + + useEffect(() => { + // eslint-disable-next-line no-console + console.log('Refetch data when EU changes'); + }, [economicUnit]); + + return ( +
+ + {formatMessageWithValues('DashboardPage.title', { + employer: 'Employer', + })} + +
+ ); +} + +export default DashboardPage; diff --git a/src/translations/en.json b/src/translations/en.json index 51c14fd..7d4352a 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -205,5 +205,6 @@ "workerVoucher.PublicVoucherDetailsPage.noVoucherUuid": " Voucher UUID not provided.", "workerVoucher.PublicVoucherDetailsPage.voucherNotFound": "Voucher not found.", "workerVoucher.PublicVoucherDetailsPage.invalidVoucherFound": "Voucher is no longer valid. It was valid on the day {assignedDate} at the {employer} employer.", - "workerVoucher.PublicVoucherDetailsPage.voucherFound": "Voucher found. It is valid on the day {assignedDate} at the {employer} employer." + "workerVoucher.PublicVoucherDetailsPage.voucherFound": "Voucher found. It is valid on the day {assignedDate} at the {employer} employer.", + "workerVoucher.DashboardPage.title": "Welcome, {employer}!" }