From 7941c7a37be70699c99828a4a4acacf7da08a1d4 Mon Sep 17 00:00:00 2001 From: Munyua123 Date: Mon, 28 Oct 2024 16:52:23 +0300 Subject: [PATCH 1/9] O3-4026 Add an icon for vitals and biometrics on the left nav --- .../src/dashboards/DashboardExtension.tsx | 9 ++++++++- .../src/dashboards/dashboardextension.scss | 8 ++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/esm-patient-common-lib/src/dashboards/DashboardExtension.tsx b/packages/esm-patient-common-lib/src/dashboards/DashboardExtension.tsx index e91d2bdfe7..642a31b394 100644 --- a/packages/esm-patient-common-lib/src/dashboards/DashboardExtension.tsx +++ b/packages/esm-patient-common-lib/src/dashboards/DashboardExtension.tsx @@ -4,6 +4,8 @@ import last from 'lodash-es/last'; import { useTranslation } from 'react-i18next'; import { useLocation } from 'react-router-dom'; import { ConfigurableLink } from '@openmrs/esm-framework'; +import { ActivityIcon } from '@openmrs/esm-framework'; +import styling from './dashboardextension.scss'; export interface DashboardExtensionProps { path: string; @@ -22,13 +24,18 @@ export const DashboardExtension = ({ const location = useLocation(); const navLink = useMemo(() => decodeURIComponent(last(location.pathname.split('/'))), [location.pathname]); + const renderIcon = title === 'Vitals & Biometrics' ? : null; + return (
- {t(title)} + + {renderIcon} + {t(title)} +
); diff --git a/packages/esm-patient-common-lib/src/dashboards/dashboardextension.scss b/packages/esm-patient-common-lib/src/dashboards/dashboardextension.scss index e69de29bb2..e601c417ed 100644 --- a/packages/esm-patient-common-lib/src/dashboards/dashboardextension.scss +++ b/packages/esm-patient-common-lib/src/dashboards/dashboardextension.scss @@ -0,0 +1,8 @@ +.menu { + display: flex; + align-items: center; +} + +.icons { + margin-right: 0.5rem; +} From 4ee007c3c9298ffdfbee360ffd411a81f1472235 Mon Sep 17 00:00:00 2001 From: Earl Munyua <142984533+Munyua123@users.noreply.github.com> Date: Tue, 29 Oct 2024 14:19:45 +0300 Subject: [PATCH 2/9] Update DashboardExtension.tsx --- .../src/dashboards/DashboardExtension.tsx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/esm-patient-common-lib/src/dashboards/DashboardExtension.tsx b/packages/esm-patient-common-lib/src/dashboards/DashboardExtension.tsx index 642a31b394..1824c82d1e 100644 --- a/packages/esm-patient-common-lib/src/dashboards/DashboardExtension.tsx +++ b/packages/esm-patient-common-lib/src/dashboards/DashboardExtension.tsx @@ -3,9 +3,8 @@ import classNames from 'classnames'; import last from 'lodash-es/last'; import { useTranslation } from 'react-i18next'; import { useLocation } from 'react-router-dom'; -import { ConfigurableLink } from '@openmrs/esm-framework'; -import { ActivityIcon } from '@openmrs/esm-framework'; -import styling from './dashboardextension.scss'; +import { ConfigurableLink , ActivityIcon } from '@openmrs/esm-framework'; +import styles from './dashboardextension.scss'; export interface DashboardExtensionProps { path: string; @@ -24,7 +23,14 @@ export const DashboardExtension = ({ const location = useLocation(); const navLink = useMemo(() => decodeURIComponent(last(location.pathname.split('/'))), [location.pathname]); - const renderIcon = title === 'Vitals & Biometrics' ? : null; + const menuIcon = (title) => { + switch(title){ + case 'Vitals & Biometrics': + return + } + } + + const renderIcon = menuIcon(title) return (
@@ -32,7 +38,7 @@ export const DashboardExtension = ({ className={classNames('cds--side-nav__link', { 'active-left-nav-link': path === navLink })} to={`${basePath}/${encodeURIComponent(path)}`} > - + {renderIcon} {t(title)} From eef52acee29ae243f9aec905680bbbf97354cfd6 Mon Sep 17 00:00:00 2001 From: Earl Munyua <142984533+Munyua123@users.noreply.github.com> Date: Tue, 29 Oct 2024 14:20:21 +0300 Subject: [PATCH 3/9] Update dashboardextension.scss --- .../src/dashboards/dashboardextension.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/esm-patient-common-lib/src/dashboards/dashboardextension.scss b/packages/esm-patient-common-lib/src/dashboards/dashboardextension.scss index e601c417ed..d99be391a0 100644 --- a/packages/esm-patient-common-lib/src/dashboards/dashboardextension.scss +++ b/packages/esm-patient-common-lib/src/dashboards/dashboardextension.scss @@ -3,6 +3,6 @@ align-items: center; } -.icons { +.icon { margin-right: 0.5rem; } From d222915b0d2ebfb6224f4cdf9cdb5dbf233ce4c9 Mon Sep 17 00:00:00 2001 From: Earl Munyua <142984533+Munyua123@users.noreply.github.com> Date: Tue, 29 Oct 2024 14:26:18 +0300 Subject: [PATCH 4/9] Update DashboardExtension.tsx --- .../src/dashboards/DashboardExtension.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/esm-patient-common-lib/src/dashboards/DashboardExtension.tsx b/packages/esm-patient-common-lib/src/dashboards/DashboardExtension.tsx index 1824c82d1e..8f694cbfbd 100644 --- a/packages/esm-patient-common-lib/src/dashboards/DashboardExtension.tsx +++ b/packages/esm-patient-common-lib/src/dashboards/DashboardExtension.tsx @@ -26,7 +26,9 @@ export const DashboardExtension = ({ const menuIcon = (title) => { switch(title){ case 'Vitals & Biometrics': - return + return ; + default: + return null; } } From a8acd6d4cfddd18090cd86e4910e01a0b5f916f6 Mon Sep 17 00:00:00 2001 From: Earl Munyua <142984533+Munyua123@users.noreply.github.com> Date: Tue, 29 Oct 2024 16:04:52 +0300 Subject: [PATCH 5/9] Update DashboardExtension.tsx --- .../src/dashboards/DashboardExtension.tsx | 47 ++++++++++++++++--- 1 file changed, 40 insertions(+), 7 deletions(-) diff --git a/packages/esm-patient-common-lib/src/dashboards/DashboardExtension.tsx b/packages/esm-patient-common-lib/src/dashboards/DashboardExtension.tsx index 8f694cbfbd..176d66b4b9 100644 --- a/packages/esm-patient-common-lib/src/dashboards/DashboardExtension.tsx +++ b/packages/esm-patient-common-lib/src/dashboards/DashboardExtension.tsx @@ -3,8 +3,21 @@ import classNames from 'classnames'; import last from 'lodash-es/last'; import { useTranslation } from 'react-i18next'; import { useLocation } from 'react-router-dom'; -import { ConfigurableLink , ActivityIcon } from '@openmrs/esm-framework'; -import styles from './dashboardextension.scss'; +import { + ConfigurableLink, + ActivityIcon, + ShoppingCartIcon, + MedicationIcon, + ChartAverageIcon, + CalendarHeatMapIcon, + WarningIcon, + ListCheckedIcon, + DocumentAttachmentIcon, + TableIcon, + EventScheduleIcon, +} from '@openmrs/esm-framework'; +import { Report } from '@carbon/react/icons'; +import styles from './dashboard-extension.scss'; export interface DashboardExtensionProps { path: string; @@ -23,16 +36,36 @@ export const DashboardExtension = ({ const location = useLocation(); const navLink = useMemo(() => decodeURIComponent(last(location.pathname.split('/'))), [location.pathname]); - const menuIcon = (title) => { - switch(title){ + const menuIcon = (title: string) => { + switch (title) { + case 'Patient Summary': + return ; case 'Vitals & Biometrics': - return ; + return ; + case 'Orders': + return ; + case 'Medications': + return ; + case 'Results': + return ; + case 'Visits': + return ; + case 'Allergies': + return ; + case 'Conditions': + return ; + case 'Attachments': + return ; + case 'Programs': + return ; + case 'Appointments': + return ; default: return null; } - } + }; - const renderIcon = menuIcon(title) + const renderIcon = menuIcon(title); return (
From 7cc94cf4532daa8ae2c97e61e24ed7b0941dfbf5 Mon Sep 17 00:00:00 2001 From: Earl Munyua <142984533+Munyua123@users.noreply.github.com> Date: Tue, 29 Oct 2024 16:05:21 +0300 Subject: [PATCH 6/9] Rename dashboardextension.scss to dashboard-extension.scss --- .../{dashboardextension.scss => dashboard-extension.scss} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename packages/esm-patient-common-lib/src/dashboards/{dashboardextension.scss => dashboard-extension.scss} (100%) diff --git a/packages/esm-patient-common-lib/src/dashboards/dashboardextension.scss b/packages/esm-patient-common-lib/src/dashboards/dashboard-extension.scss similarity index 100% rename from packages/esm-patient-common-lib/src/dashboards/dashboardextension.scss rename to packages/esm-patient-common-lib/src/dashboards/dashboard-extension.scss From 57cbf35744fa1e57dcfa50f742c2e0b12c8d14bb Mon Sep 17 00:00:00 2001 From: Earl Munyua <142984533+Munyua123@users.noreply.github.com> Date: Sat, 2 Nov 2024 12:18:21 +0300 Subject: [PATCH 7/9] Update DashboardExtension.tsx --- .../src/dashboards/DashboardExtension.tsx | 48 ++++++++----------- 1 file changed, 20 insertions(+), 28 deletions(-) diff --git a/packages/esm-patient-common-lib/src/dashboards/DashboardExtension.tsx b/packages/esm-patient-common-lib/src/dashboards/DashboardExtension.tsx index 176d66b4b9..420bf0c19a 100644 --- a/packages/esm-patient-common-lib/src/dashboards/DashboardExtension.tsx +++ b/packages/esm-patient-common-lib/src/dashboards/DashboardExtension.tsx @@ -36,36 +36,28 @@ export const DashboardExtension = ({ const location = useLocation(); const navLink = useMemo(() => decodeURIComponent(last(location.pathname.split('/'))), [location.pathname]); - const menuIcon = (title: string) => { - switch (title) { - case 'Patient Summary': - return ; - case 'Vitals & Biometrics': - return ; - case 'Orders': - return ; - case 'Medications': - return ; - case 'Results': - return ; - case 'Visits': - return ; - case 'Allergies': - return ; - case 'Conditions': - return ; - case 'Attachments': - return ; - case 'Programs': - return ; - case 'Appointments': - return ; - default: - return null; - } + type MenuTitle = keyof typeof MenuIcons; + + const MenuIcons = { + Allergies: WarningIcon, + Appointments: EventScheduleIcon, + Attachments: DocumentAttachmentIcon, + Conditions: ListCheckedIcon, + Medications: MedicationIcon, + Orders: ShoppingCartIcon, + 'Patient Summary': Report, + Programs: TableIcon, + Results: ChartAverageIcon, + Visits: CalendarHeatMapIcon, + 'Vitals & Biometrics': ActivityIcon, + } as const; + + const menuIcon = (title: MenuTitle) => { + const Icon = MenuIcons[title]; + return Icon ? : null; }; - const renderIcon = menuIcon(title); + const renderIcon = menuIcon(title as MenuTitle); return (
From 3769c4ffe2ee4761368edd8e5c25f0f2abb3d9aa Mon Sep 17 00:00:00 2001 From: Earl Munyua <142984533+Munyua123@users.noreply.github.com> Date: Tue, 5 Nov 2024 21:15:52 +0300 Subject: [PATCH 8/9] Update DashboardExtension.tsx --- .../src/dashboards/DashboardExtension.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/esm-patient-common-lib/src/dashboards/DashboardExtension.tsx b/packages/esm-patient-common-lib/src/dashboards/DashboardExtension.tsx index 420bf0c19a..548ac49a8f 100644 --- a/packages/esm-patient-common-lib/src/dashboards/DashboardExtension.tsx +++ b/packages/esm-patient-common-lib/src/dashboards/DashboardExtension.tsx @@ -15,8 +15,8 @@ import { DocumentAttachmentIcon, TableIcon, EventScheduleIcon, + ReportIcon } from '@openmrs/esm-framework'; -import { Report } from '@carbon/react/icons'; import styles from './dashboard-extension.scss'; export interface DashboardExtensionProps { @@ -45,7 +45,7 @@ export const DashboardExtension = ({ Conditions: ListCheckedIcon, Medications: MedicationIcon, Orders: ShoppingCartIcon, - 'Patient Summary': Report, + 'Patient Summary': ReportIcon, Programs: TableIcon, Results: ChartAverageIcon, Visits: CalendarHeatMapIcon, From d4cfa4d2e029526e90b197f490a8f0b08e708608 Mon Sep 17 00:00:00 2001 From: Earl Munyua <142984533+Munyua123@users.noreply.github.com> Date: Wed, 6 Nov 2024 21:51:42 +0300 Subject: [PATCH 9/9] Update DashboardExtension.tsx --- .../src/dashboards/DashboardExtension.tsx | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/packages/esm-patient-common-lib/src/dashboards/DashboardExtension.tsx b/packages/esm-patient-common-lib/src/dashboards/DashboardExtension.tsx index 548ac49a8f..b7ed52c2b9 100644 --- a/packages/esm-patient-common-lib/src/dashboards/DashboardExtension.tsx +++ b/packages/esm-patient-common-lib/src/dashboards/DashboardExtension.tsx @@ -15,7 +15,8 @@ import { DocumentAttachmentIcon, TableIcon, EventScheduleIcon, - ReportIcon + ReportIcon, + SyringeIcon, } from '@openmrs/esm-framework'; import styles from './dashboard-extension.scss'; @@ -39,17 +40,18 @@ export const DashboardExtension = ({ type MenuTitle = keyof typeof MenuIcons; const MenuIcons = { - Allergies: WarningIcon, - Appointments: EventScheduleIcon, - Attachments: DocumentAttachmentIcon, - Conditions: ListCheckedIcon, + 'Patient Summary': ReportIcon, + 'Vitals & Biometrics': ActivityIcon, Medications: MedicationIcon, Orders: ShoppingCartIcon, - 'Patient Summary': ReportIcon, - Programs: TableIcon, Results: ChartAverageIcon, Visits: CalendarHeatMapIcon, - 'Vitals & Biometrics': ActivityIcon, + Allergies: WarningIcon, + Conditions: ListCheckedIcon, + Immunizations: SyringeIcon, + Attachments: DocumentAttachmentIcon, + Programs: TableIcon, + Appointments: EventScheduleIcon, } as const; const menuIcon = (title: MenuTitle) => {