{% from "_macros.html" import icon %}
{#
  Reports, Messages and Scheduled: the three places activity lands that is not
  a conversation you started.

  Placed below pinned models and above the folder tree, and deliberately
  OUTSIDE `#sidebar-tree`. Pinned models and "New chat" are outside it for the
  same reason: they are not part of the Chat/Agent fork, so they must not vanish
  or be re-rendered when the switch moves. Their unread dots ride the existing
  out-of-band `/api/chats/unread` response, which is also outside the tree.

  Not the footer, where Library and Connections live. Those are places you go to
  configure or consult something; these receive activity while you are elsewhere
  and therefore need a dot, and a dot down in the footer reads as a settings
  notification rather than as news. Scheduled also grows, and the footer is for
  fixed destinations.

  Each entry is gated on its own permission, so a section somebody cannot use is
  absent rather than present and refusing.
#}
<div class="nav-group" id="sidebar-sections">
  {% if can.get("reports.use") %}
  <a class="nav-item {{ 'is-active' if section == 'reports' }}" href="/reports">
    {{ icon("archive", "icon--sm") }}
    <span class="nav-item__label">Reports</span>
    {# Toggled out of band by the unread poll, exactly as a chat row's is. #}
    <span id="unread-reports" class="unread-dot"
          {{ '' if unread_reports else 'hidden' }} title="New reports"></span>
  </a>
  {% endif %}

  {#
    No permission of its own: it is one conversation the reader owns, and
    `chat.create` already decides whether they may say anything anywhere.
  #}
  <a class="nav-item {{ 'is-active' if section == 'messages' }}" href="/messages">
    {{ icon("chat", "icon--sm") }}
    <span class="nav-item__label">Messages</span>
    <span id="unread-messages" class="unread-dot"
          {{ '' if unread_messages else 'hidden' }} title="New messages"></span>
  </a>

  {% if can.get("schedule.use") %}
  <a class="nav-item {{ 'is-active' if section == 'scheduled' }}" href="/scheduled">
    {{ icon("clock", "icon--sm") }}
    <span class="nav-item__label">Scheduled</span>
  </a>
  {% endif %}
</div>
