We have a menu endpoint here: https://decoupled-menus.jsonapi.dev/system/menu/main/linkset

Please post ideas about what we could have as tasks for those who participate in the Decoupled Menu initiative hackathon at DrupalCon NA 2021.

Comments

baddysonja created an issue.

D34dMan’s picture

Idea

Create a framework agnostic javascript library to wrap menu (and its item) as object, so that developers don't have to check and manipulate "string" based ids and Drupal internals.

--
Rough Structure

Tree Object is a collection of TreeItem

--

Possible Sub Task

- TreeItem can be checked for its various property without leaking Drupal internal
    - TreeItem::getParent() : TreeItem
    - TreeItem::getChildren() : [TreeItem]
    - TreeItem::getType() : string // [internal, external, undefined, route, relative, ...]
    - TreeItem::getUrl() : Url // Maybe a <a href="https://developer.mozilla.org/en-US/docs/Web/API/URL">URL</a> obj?
    - TreeItem::getLabel() : string
    - TreeItem::isHtmlLabel() : Bool
    - TreeItem::getActiveTrail() : 
    - Tree::isItemInActiveTrail(TreeItem) : Bool // Pass current tree item as known to Decoupled frontend as parameter.
    - Tree::getActiveMenuTrail(TreeItem) : Tree // Pass current tree item as known to Decoupled frontend as parameter.
- Tree object that can be traversed as Tree like Depth-first-search/Bread-first-search
eojthebrave’s picture

A couple of ideas, just brainstorming here:

  • Writing tests for this component and any others
  • Figuring out (and documenting) how to get the tests running via GitLab CI (though I'm not sure that's open to everyone yet?)
  • Provide usage examples for the components. Maybe in the form of jsbin, glitch.com, codepen etc that can be linked to and embedded from documentation
  • Some kind of "menu item decorator" that is a Node.js server that sits between a client and the Drupal site and can decorate the Drupal menu API response with additional data
  • A library for voice navigation of a menu. Think Alexa, etc.
  • Add more documentation and other info to the project page.
vulcanr’s picture

- Create a mega menu with additional fields (Fly-out text, images)
- Create additional components for other menus (The initial component fetches the main navigation, but would be good if people can play around getting user menu, footer, etc)

eojthebrave’s picture

More ideas:

Add support for TypeScript?
Add support for StoryBook?

And, not specific to any one component but some other tasks include:

Drafting documentation of the current proposed menu response format. There's an issue here https://www.drupal.org/project/decoupled_menus/issues/3196342 where the format for the current response is discussed. Someone could turn the relevant information in that issue into a draft documentation of the format. Specifically the details here are super valuable: https://www.drupal.org/project/decoupled_menus/issues/3196342#comment-14...

Help move this forward #3205001: Make it easier to discover how to create a new project

vulcanr’s picture

Drafting documentation of the current proposed menu response format. There's an issue here https://www.drupal.org/project/decoupled_menus/issues/3196342 where the format for the current response is discussed. Someone could turn the relevant information in that issue into a draft documentation of the format. Specifically the details here are super valuable: https://www.drupal.org/project/decoupled_menus/issues/3196342#comment-14...

I like this idea, but I like it more towards a "Sprint" than a Hackathon