{% load i18n wise_icons wise_nav %}
{% comment %}
Renders wise_nav_sections (see wise_core/context_processors.py + WISE_NAV_SECTIONS
in docs/getting-started.md) as the design system's Tree: `nav.tree` >
`details.tree-item` sections with a `.tree-item-chevron`, `a.tree-leaf`
links. Each section: {"title": ..., "items": [...]}. Each item: {"label",
"url_name", "url_kwargs" (optional), "icon" (lucide name), "match" (the prefix
of request.resolver_match.url_name that marks it selected - e.g. "invoice_"
for every invoice_* route, or a list of prefixes), "staff_only" (optional)}.
`nav_tree` (wise_core/templatetags/wise_nav.py) resolves the sections for
this request: the selected item is the longest matching `match` prefix, and
the section holding it renders `open` - every section does on a page that
belongs to none, such as the dashboard. Selection and hover come from the
tree's own tokens, and each section collapses without JavaScript, which is
what keeps a long menu usable in the phone's slide-out.
Both the desktop sidebar and the mobile slide-out render this component.
{% endcomment %}
{% if request.user.is_authenticated %}
{% nav_tree as sections %}