Skip to content
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: add commands support and make logout searchable #1659

Open
wants to merge 1 commit into
base: DHIS2-18943/fix-apps-menu-redirect
Choose a base branch
from

Conversation

d-rita
Copy link
Contributor

@d-rita d-rita commented Feb 3, 2025

Implements LIBS-735


Description

This PR is an attempt to start the work on adding commands to the command palette, which means users can search for them too.

The current implementation:

  • adds a hook for the logout command functionality.
  • retrieves all commands created through a useCommands hook, which are then passed to the headerbar component making them available and searchable. (In this case, only the logout command has been added)

(TBD: whether commands are fetched from the backend or defined in the UI here)

This PR also handles:

  • updating the action handlers in the useActions hook to have an action attribute with its associated action handler, for example, for Browse Apps, its action is a function to switch views to the all apps list view.
  • passing the actions array to the useNavigation hook to simplify the Enter key logic.
  • refactoring the Enter key down logic by utilising the app's defaultAction(url) attribute to open it in a new window, and the commands/actions action attribute to trigger its attached handler.
  • differentiating between an icon and image

Conclusion: Users can search for the logout command across the command palette.


Checklist

  • API docs are generated
  • Tests were added
  • Storybook demos were added

All points above should be relevant for feature PRs. For bugfixes, some points might not be relevant. In that case, just check them anyway to signal the work is done.


Screenshots

Logout Search Results
logout results

All Commands View
browse cmds

- add a hook for the logout command functionality
- retrieve all commands created through the new useCommands hook
- refactor Enter key logic by utilising the action's and item's action attributes
- differentiate between an icon and image
- update action handlers in the useActions hook
@d-rita d-rita requested a review from a team as a code owner February 3, 2025 07:37
@d-rita d-rita requested a review from amcgee February 3, 2025 07:38
Copy link

sonarqubecloud bot commented Feb 3, 2025

@dhis2-bot
Copy link
Contributor

🚀 Deployed on https://pr-1659--dhis2-ui.netlify.app

@dhis2-bot dhis2-bot temporarily deployed to netlify February 3, 2025 07:41 Inactive
@d-rita d-rita requested a review from a team February 3, 2025 07:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants