{#
Copyright 2022 The Matrix.org Foundation C.I.C.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
#}

{% macro top() %}
  <nav class="container mx-auto py-2 flex-initial flex items-center px-8" role="navigation" aria-label="main navigation">
    <div class="flex-1"></div>

    <div class="grid grid-flow-col auto-cols-max gap-4 place-items-center">
      {% if current_session %}
        <div class="text-grey-200 dark:text-grey-250 mx-2">
          {{ _("mas.navbar.signed_in_as", username=current_session.user.username) }}
        </div>

        {{ button.link(text=_("mas.navbar.my_account"), href="/account/") }}
        {{ logout.button(text=_("action.sign_out"), csrf_token=csrf_token) }}
      {% else %}
        {{ button.link(text=_("action.sign_in"), href="/login") }}
        {{ button.link_outline(text=_("mas.navbar.register"), href="/register") }}
      {% endif %}
    </div>
  </nav>
{% endmacro %}
