Skip to content

Commit

Permalink
(fix) O3-4135 - Disable help icon while user is logged out (#1186)
Browse files Browse the repository at this point in the history
  • Loading branch information
suubi-joshua authored Oct 30, 2024
1 parent 3a2620e commit 8d4ef13
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions packages/apps/esm-help-menu-app/src/help-menu/help.component.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import React, { useState, useEffect, useRef } from 'react';
import classNames from 'classnames';
import { Help } from '@carbon/react/icons';
import { useSession } from '@openmrs/esm-framework'
import HelpMenuPopup from './help-popup.component';
import styles from './help.styles.scss';

export default function HelpMenu() {
const { user } = useSession();
const [helpMenuOpen, setHelpMenuOpen] = useState(false);
const helpMenuButtonRef = useRef(null);
const popupRef = useRef(null);
Expand Down Expand Up @@ -35,15 +37,17 @@ export default function HelpMenu() {

return (
<>
<button
aria-expanded={helpMenuOpen}
aria-controls="help-menu-popup"
onClick={toggleHelpMenu}
ref={helpMenuButtonRef}
className={classNames(styles.helpMenuButton)}
>
<Help size={24} />
</button>
{user && (
<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 />
Expand Down

0 comments on commit 8d4ef13

Please sign in to comment.