{% load avatars i18n rb_extensions %}

<div id="page-sidebar"
     class="rb-c-page-sidebar{% if page_sidebar_css_classes %} {{page_sidebar_css_classes}}{% endif %}">
 <header class="rb-c-page-sidebar__mobile-header">
{% if request.user.is_authenticated %}
{%  if siteconfig_settings.avatars_enabled %}
  {% avatar user 32 %}
{%  endif %}
  <span class="rb-c-page-sidebar__mobile-username">{{request.user.username}}</span>
  <ul class="rb-c-page-sidebar__mobile-user-actions">
   <li><a href="{% url 'logout' %}"><span class="fa fa-sign-out"></span> {% trans "Log out" %}</a></li>
   <li><a href="{% url 'user-preferences' %}" aria-label="{% trans 'My Account' %}"><span class="fa fa-gear"></span></a></li>
  </ul>
{% else %}
  <ul class="rb-c-page-sidebar__mobile-user-actions">
   <li><a href="{% url 'login' %}?next={{request.path}}"><span class="fa fa-sign-in"></span> {% trans "Log in" %}</a></li>
   <li><a href="{% url 'register' %}">{% trans "Register" %}</a></li>
  </ul>
{% endif %}
 </header>

 <div id="page-sidebar-panes" class="rb-c-page-sidebar__panes">
  <div id="page-sidebar-main-pane"
       class="rb-c-page-sidebar__pane -is-shown">
   <div id="page-sidebar-main-content"
        class="rb-c-page-sidebar__pane-content">
    <nav class="rb-c-sidebar{% if sidebar_css_classes %} {{sidebar_css_classes}}{% endif %}"
         aria-label="{% trans 'Sidebar' %}">
     <ul class="rb-c-sidebar__items">
{% if request.user.is_authenticated or not siteconfig_settings.auth_require_sitewide_login %}
      <li class="rb-c-sidebar__section -is-mobile-only">
       <header class="rb-c-sidebar__section-header">{{settings.PRODUCT_NAME}}</header>
       <ul class="rb-c-sidebar__items">
{%  if request.user.is_authenticated %}
        <li class="rb-c-sidebar__nav-item">
         <a class="rb-c-sidebar__item-label" href="{% url 'new-review-request' %}">{% trans "New Review Request" %}</a>
        </li>
        <li class="rb-c-sidebar__nav-item"><a class="rb-c-sidebar__item-label" href="{% url 'dashboard' %}">{% trans "My Dashboard" %}</a></li>
{%  endif %}
        <li class="rb-c-sidebar__nav-item"><a class="rb-c-sidebar__item-label" href="{% url 'all-review-requests' %}">{% trans "All Review Requests" %}</a></li>
        <li class="rb-c-sidebar__nav-item"><a class="rb-c-sidebar__item-label" href="{% url 'all-users' %}">{% trans "Users" %}</a></li>
        <li class="rb-c-sidebar__nav-item"><a class="rb-c-sidebar__item-label" href="{% url 'all-groups' %}">{% trans "Groups" %}</a></li>
{%  navigation_bar_hooks sidebar=True %}
       </ul>
      </li>
{% endif %}

      {{sidebar_content}}
     </ul>
    </nav>
   </div>
  </div>
 </div>

 <footer class="rb-c-page-sidebar__mobile-footer">
  <ul>
   <li><a href="{{RB_MANUAL_URL}}"><span class="fa fa-book"></span> {% trans "Docs" %}</a></li>
   <li><a href="{% url 'support' %}"><span class="fa fa-question-circle"></span> {% trans "Support" %}</a></li>
 {%  if request.user.is_staff %}
   <li><a href="{% url 'admin-dashboard' %}"><span class="fa fa-lock"></span> {% trans "Admin" %}</a></li>
 {%  endif %}
  </ul>
 </footer>
</div>
