-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(feat) O3-4026 Add an icon for vitals and biometrics on the left nav #2079
base: main
Are you sure you want to change the base?
Conversation
@denniskigen I have made the changes on the icon using the Activity Icon. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making the changes, @Munyua123. It's close. I've left a few more recommendations.
import { ConfigurableLink } from '@openmrs/esm-framework'; | ||
import { ActivityIcon } from '@openmrs/esm-framework'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we consolidate these imports?
@@ -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'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import styling from './dashboardextension.scss'; | |
import styles from './dashboardextension.scss'; |
Can we rename this file to dashboard-extension.scss
for consistency? https://o3-docs.openmrs.org/docs/coding-conventions#naming
@@ -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' ? <ActivityIcon className={styling.icons} /> : null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const renderIcon = title === 'Vitals & Biometrics' ? <ActivityIcon className={styling.icons} /> : null; | |
const renderIcon = title === 'Vitals & Biometrics' ? <ActivityIcon className={styles.icons} /> : null; |
return ( | ||
<div key={path}> | ||
<ConfigurableLink | ||
className={classNames('cds--side-nav__link', { 'active-left-nav-link': path === navLink })} | ||
to={`${basePath}/${encodeURIComponent(path)}`} | ||
> | ||
{t(title)} | ||
<span className={styling.menu}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<span className={styling.menu}> | |
<span className={styling.menu}> |
Ditto
align-items: center; | ||
} | ||
|
||
.icons { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would .icon
be more preferable here? It's just one icon, right?
@denniskigen I have made the changes that you had suggested. I have also made a change to use the switch case method, so that someone who is implementing more icons can just add the icons easily |
@denniskigen I have made the changes and added the icons for all of them but the immunizations tab. It seems that it has not been added to the openmrs framework and also there is none in the carbon react one. Also the icon i have used for the patient summary has not been added yet to the framework so i have used the one in the carbon react icons. |
const menuIcon = (title: string) => { | ||
switch (title) { | ||
case 'Patient Summary': | ||
return <Report className={styles.icon} />; | ||
case 'Vitals & Biometrics': | ||
return <ActivityIcon className={styles.icon} />; | ||
case 'Orders': | ||
return <ShoppingCartIcon className={styles.icon} />; | ||
case 'Medications': | ||
return <MedicationIcon className={styles.icon} />; | ||
case 'Results': | ||
return <ChartAverageIcon className={styles.icon} />; | ||
case 'Visits': | ||
return <CalendarHeatMapIcon className={styles.icon} />; | ||
case 'Allergies': | ||
return <WarningIcon className={styles.icon} />; | ||
case 'Conditions': | ||
return <ListCheckedIcon className={styles.icon} />; | ||
case 'Attachments': | ||
return <DocumentAttachmentIcon className={styles.icon} />; | ||
case 'Programs': | ||
return <TableIcon className={styles.icon} />; | ||
case 'Appointments': | ||
return <EventScheduleIcon className={styles.icon} />; | ||
default: | ||
return null; | ||
} | ||
}; | ||
|
||
const renderIcon = menuIcon(title); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe an object lookup like the following is more preferable. It has less code and better type inference, and it should be straightforward to pop in more icons:
const menuIcon = (title: string) => { | |
switch (title) { | |
case 'Patient Summary': | |
return <Report className={styles.icon} />; | |
case 'Vitals & Biometrics': | |
return <ActivityIcon className={styles.icon} />; | |
case 'Orders': | |
return <ShoppingCartIcon className={styles.icon} />; | |
case 'Medications': | |
return <MedicationIcon className={styles.icon} />; | |
case 'Results': | |
return <ChartAverageIcon className={styles.icon} />; | |
case 'Visits': | |
return <CalendarHeatMapIcon className={styles.icon} />; | |
case 'Allergies': | |
return <WarningIcon className={styles.icon} />; | |
case 'Conditions': | |
return <ListCheckedIcon className={styles.icon} />; | |
case 'Attachments': | |
return <DocumentAttachmentIcon className={styles.icon} />; | |
case 'Programs': | |
return <TableIcon className={styles.icon} />; | |
case 'Appointments': | |
return <EventScheduleIcon className={styles.icon} />; | |
default: | |
return null; | |
} | |
}; | |
const renderIcon = menuIcon(title); | |
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 ? <Icon className={styles.icon} /> : null; | |
}; | |
const renderIcon = menuIcon(title as MenuTitle); |
@denniskigen The above is noted and will be implemented. I had a question will it be okay if i add the missing icons to the framework? or do i have to wait for directive on this |
Yes, please go ahead and add them in Core. |
@denniskigen I have added all the icons , kindly review |
@paulsonder @ciaranduffy could you give this a design review? |
@denniskigen Works for me. We'll just need to coordinate on making sure these are reflected in the design docs. |
@@ -22,13 +37,40 @@ export const DashboardExtension = ({ | |||
const location = useLocation(); | |||
const navLink = useMemo(() => decodeURIComponent(last(location.pathname.split('/'))), [location.pathname]); | |||
|
|||
type MenuTitle = keyof typeof MenuIcons; | |||
|
|||
const MenuIcons = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Munyua123 for this, what will be the approach for adding icons for packages that do not live in the patient chart ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@CynthiaKamau The approach may be adding the icons in their respective packages.
Requirements
Summary
Screenshots
Related Issue
Other