-
Notifications
You must be signed in to change notification settings - Fork 208
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-3390: Implement the help menu #1034
Conversation
@Piumal1999 @jayasanka-sack @ibacher @denniskigen seeking you review |
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.
A couple of broader things:
- Ideally, this would be located where the devtools button is. Maybe we move the devtools.
- I'm not a massive fan of the modal side menu. I think a larger modal in the middle of the screen makes more sense.
- The release notes should be an accordion that expands to show the notes.
packages/apps/esm-help-menu-app/src/helpMenu/subHelpMenu/tutorial.tsx
Outdated
Show resolved
Hide resolved
packages/apps/esm-help-menu-app/src/helpMenu/help-popup.component.tsx
Outdated
Show resolved
Hide resolved
packages/apps/esm-help-menu-app/src/helpMenu/help-popup.styles.scss
Outdated
Show resolved
Hide resolved
packages/apps/esm-help-menu-app/src/helpMenu/help-popup.styles.scss
Outdated
Show resolved
Hide resolved
<button className={styles.helpButton} onClick={props.close}> | ||
{t('releaseNotes', 'Release Notes')} | ||
</button> | ||
<button className={styles.helpButton} onClick={handleTutorialsModalOpen}> | ||
{t('tutorials', 'Tutorials')} | ||
</button> | ||
<button className={styles.helpButton} onClick={props.close}> | ||
{t('contactUs', 'Contact us')} | ||
</button> | ||
<button className={styles.helpButton} onClick={props.close}> | ||
{t('docs', 'Docs')} | ||
</button> | ||
<button className={styles.helpButton} onClick={props.close}> | ||
{t('feedbackForum', 'Feedback Forum')} | ||
</button> | ||
<button className={styles.helpButton} onClick={props.close}> | ||
{t('version', 'OpenMRS 3.0.1')} | ||
</button> |
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.
@Vijaykv5 The extension slot should come here, right? Not the help.component.tsx
<button className={styles.helpButton} onClick={props.close}> | |
{t('releaseNotes', 'Release Notes')} | |
</button> | |
<button className={styles.helpButton} onClick={handleTutorialsModalOpen}> | |
{t('tutorials', 'Tutorials')} | |
</button> | |
<button className={styles.helpButton} onClick={props.close}> | |
{t('contactUs', 'Contact us')} | |
</button> | |
<button className={styles.helpButton} onClick={props.close}> | |
{t('docs', 'Docs')} | |
</button> | |
<button className={styles.helpButton} onClick={props.close}> | |
{t('feedbackForum', 'Feedback Forum')} | |
</button> | |
<button className={styles.helpButton} onClick={props.close}> | |
{t('version', 'OpenMRS 3.0.1')} | |
</button> | |
<ExtensionSlot className={styles.helpMenuExtension} name="help-menu-slot"/> |
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.
yeah that's right!
I thought the help menu button should also have to be an extension.
Thanks @jayasanka-sack
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.
@jayasanka-sack, just to clarify, we will be using extension slots in two scenarios, right?
- To get the list of items in the help menu
- To load the tutorials list
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.
By the way, if we do the suggested change now, we will have to create an extension for the help-menu-slot
that has an entry point to packages/apps/esm-help-menu-app/src/helpMenu/subHelpMenu/tutorial.tsx
component. Otherwise, there won’t be a way to open the tutorial modal.
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.
just to clarify, we will be using extension slots in two scenarios, right?
@Piumal1999 yes
packages/apps/esm-help-menu-app/src/helpMenu/subHelpMenu/tutorial.tsx
Outdated
Show resolved
Hide resolved
packages/apps/esm-help-menu-app/src/helpMenu/help.component.test.tsx
Outdated
Show resolved
Hide resolved
packages/apps/esm-help-menu-app/src/helpMenu/help-popup.styles.scss
Outdated
Show resolved
Hide resolved
packages/apps/esm-help-menu-app/src/helpMenu/help.component.tsx
Outdated
Show resolved
Hide resolved
packages/apps/esm-help-menu-app/src/helpMenu/help.component.tsx
Outdated
Show resolved
Hide resolved
<button className={styles.helpButton} onClick={props.close}> | ||
{t('releaseNotes', 'Release Notes')} | ||
</button> | ||
<button className={styles.helpButton} onClick={handleTutorialsModalOpen}> | ||
{t('tutorials', 'Tutorials')} | ||
</button> | ||
<button className={styles.helpButton} onClick={props.close}> | ||
{t('contactUs', 'Contact us')} | ||
</button> | ||
<button className={styles.helpButton} onClick={props.close}> | ||
{t('docs', 'Docs')} | ||
</button> | ||
<button className={styles.helpButton} onClick={props.close}> | ||
{t('feedbackForum', 'Feedback Forum')} | ||
</button> | ||
<button className={styles.helpButton} onClick={props.close}> | ||
{t('version', 'OpenMRS 3.0.1')} | ||
</button> |
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.
@jayasanka-sack, just to clarify, we will be using extension slots in two scenarios, right?
- To get the list of items in the help menu
- To load the tutorials list
<button className={styles.helpButton} onClick={props.close}> | ||
{t('releaseNotes', 'Release Notes')} | ||
</button> | ||
<button className={styles.helpButton} onClick={handleTutorialsModalOpen}> | ||
{t('tutorials', 'Tutorials')} | ||
</button> | ||
<button className={styles.helpButton} onClick={props.close}> | ||
{t('contactUs', 'Contact us')} | ||
</button> | ||
<button className={styles.helpButton} onClick={props.close}> | ||
{t('docs', 'Docs')} | ||
</button> | ||
<button className={styles.helpButton} onClick={props.close}> | ||
{t('feedbackForum', 'Feedback Forum')} | ||
</button> | ||
<button className={styles.helpButton} onClick={props.close}> | ||
{t('version', 'OpenMRS 3.0.1')} | ||
</button> |
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.
By the way, if we do the suggested change now, we will have to create an extension for the help-menu-slot
that has an entry point to packages/apps/esm-help-menu-app/src/helpMenu/subHelpMenu/tutorial.tsx
component. Otherwise, there won’t be a way to open the tutorial modal.
The updated changes looks like this
helpmenu-new.mov |
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.
Good job @Vijaykv5. I requested few minor changes.
Btw, for the contact us, docs, and release notes buttons, we could use a single reusable component, as all three have the same structure, styles, and behavior. But we can do it later as this PR needs to be merged as soon as possible in order to continue the project.
packages/apps/esm-help-menu-app/src/help-menu/components/release-notes.component.tsx
Outdated
Show resolved
Hide resolved
packages/apps/esm-help-menu-app/src/help-menu/components/contact-us.component.tsx
Outdated
Show resolved
Hide resolved
packages/apps/esm-help-menu-app/src/help-menu/components/docs.component.tsx
Outdated
Show resolved
Hide resolved
packages/apps/esm-help-menu-app/src/help-menu/components/contact-us.component.tsx
Outdated
Show resolved
Hide resolved
|
||
useEffect(() => { | ||
const handleClickOutside = (event) => { | ||
if (!event.target.closest(`.${styles.helpMenuButton}`) && !event.target.closest(`.${styles.popup}`)) { |
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.
It would be better if we could identify the event in some other way than using styles. maybe with react 'ref's
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.
Looks good to me
Could we change "Contact us" to "Community Forum" and link that to talk.openmrs.org ? |
@paulsonder @gracepotma do you have any input on this suggestion? This is the provided design: Regarding the the icon location, I'm all in with Ian's suggestion, but I'm not sure where to move the devtools icon. Any ideas? |
@Vijaykv5 could you please check why the CI build is failing? |
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.
Good start, @Vijaykv5. I've left some feedback.
"name": "@openmrs/esm-help-menu-app", | ||
"version": "5.6.0", | ||
"license": "MPL-2.0", | ||
"description": " A microfrontend that provides a help menu for the OpenMRS Microfrontend 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.
"description": " A microfrontend that provides a help menu for the OpenMRS Microfrontend Framework", | |
"description": " A microfrontend that provides a help menu for O3", |
], | ||
"noEmit": true | ||
}, | ||
"include": ["src/**/*", "../esm-help-menu-app/src/help-menu copy"] |
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.
"include": ["src/**/*", "../esm-help-menu-app/src/help-menu copy"] | |
"include": ["src/**/*"] |
Why is the second bit necessary?
(window as any).importMapOverrides = { | ||
getOverrideMap: jest.fn().mockReturnValue({ imports: {} }), | ||
}; |
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.
(window as any).importMapOverrides = { | |
getOverrideMap: jest.fn().mockReturnValue({ imports: {} }), | |
}; | |
import '@testing-library/jest-dom'; | |
(window as any).importMapOverrides = { | |
getOverrideMap: jest.fn().mockReturnValue({ imports: {} }), | |
}; |
], | ||
"extensions": [ | ||
{ | ||
"name": "release-note", |
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.
"name": "release-note", | |
"name": "release-notes", |
import Release from './help-menu/components/release-notes.component'; | ||
import Docs from './help-menu/components/docs.component'; | ||
import contactus from './help-menu/components/contact-us.component'; |
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 Release from './help-menu/components/release-notes.component'; | |
import Docs from './help-menu/components/docs.component'; | |
import contactus from './help-menu/components/contact-us.component'; | |
import ReleaseNotesComponent from './help-menu/components/release-notes.component'; | |
import DocsComponent from './help-menu/components/docs.component'; | |
import ContactUsComponent from './help-menu/components/contact-us.component'; |
<div role="button" onClick={toggleHelpMenu} ref={helpMenuButtonRef} className={classNames(styles.helpMenuButton)}> | ||
<Help size={24} /> | ||
</div> | ||
{helpMenuOpen && ( | ||
<div ref={popupRef}> | ||
<HelpMenuPopup /> | ||
</div> | ||
)} |
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.
<div role="button" onClick={toggleHelpMenu} ref={helpMenuButtonRef} className={classNames(styles.helpMenuButton)}> | |
<Help size={24} /> | |
</div> | |
{helpMenuOpen && ( | |
<div ref={popupRef}> | |
<HelpMenuPopup /> | |
</div> | |
)} | |
<button | |
aria-expanded={helpMenuOpen} | |
aria-controls="help-menu-popup" | |
onClick={toggleHelpMenu} | |
ref={helpMenuButtonRef} | |
className={classNames(styles.helpMenuButton)} | |
> | |
<Help size={24} /> | |
</button> | |
{helpMenuOpen && ( | |
<div id="help-menu-popup" ref={popupRef} className={styles.helpMenuPopup}> | |
<HelpMenuPopup /> | |
</div> | |
)} |
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.
This file should have a .scss
extension.
z-index: 7900; | ||
background-color: #c6c6c6; | ||
height: 2.5rem !important; | ||
width: 2.5rem !important; | ||
bottom: 5rem; | ||
position: fixed; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
right: 0.5rem; | ||
border-radius: 2rem; |
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.
z-index: 7900; | |
background-color: #c6c6c6; | |
height: 2.5rem !important; | |
width: 2.5rem !important; | |
bottom: 5rem; | |
position: fixed; | |
display: flex; | |
justify-content: center; | |
align-items: center; | |
right: 0.5rem; | |
border-radius: 2rem; | |
z-index: 7900; | |
background-color: white; | |
height: 2.5rem !important; | |
width: 2.5rem !important; | |
bottom: 5rem; | |
position: fixed; | |
display: flex; | |
justify-content: center; | |
align-items: center; | |
right: 0.5rem; | |
border: none; | |
box-shadow: | |
0 1px 3px rgba(0, 0, 0, 0.1), | |
0 1px 2px -1px rgba(0, 0, 0, 0.1); | |
border-radius: 2rem; |
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.
To get the button aligned with https://zpl.io/5E6PWgW.
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.
Just realized the link I posted might not be the latest available design. If not, feel free to ignore the background color change suggestion above.
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.
Yes that's the latest design @denniskigen
Thank you :)
@@ -0,0 +1,21 @@ | |||
module.exports = { | |||
transform: { | |||
'\\.(m?j|t)sx?$': ['@swc/jest'], |
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.
'\\.(m?j|t)sx?$': ['@swc/jest'], | |
'^.+\\.tsx?$': ['@swc/jest'], |
}, | ||
setupFiles: ['<rootDir>/src/setup-tests.ts'], | ||
moduleNameMapper: { | ||
'lodash-es': 'lodash', |
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.
'lodash-es': 'lodash', | |
'lodash-es': 'lodash', | |
'^lodash-es/(.*)$': 'lodash/$1', |
Latest changes looks like this help-menu.updated.mov |
"@carbon/react": "1.37.0", | ||
"fuzzy": "^0.1.3" | ||
} | ||
} |
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.
} | |
} | |
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 @Vijaykv5 !
Merging this PR because the dev tools icon is only visible to admins, who rarely use the help functionality. However, we should discuss a proper decision in the next UX call.
Requirements
feat
,fix
, orchore
, among others). See existing PR titles for inspiration.For changes to apps
If applicable
Summary
esm-help-menu-app
.Screenshots
help-menu.mov
Related Issue
O3-3390
Other
The help menu is design as per these Zeplin Designs