{% macro render_username(user, add_domain=True) -%}
<span class="render_username">
    {% if user.deleted -%}
        [deleted]
    {% else -%}
        <a href="/u/{{ user.link() }}" title="{{ user.ap_id if user.ap_id != none else user.user_name }}" aria-label="{{ _('Author') }}">
            {{ user.display_name() }}{% if not user.is_local() %}<span class="text-muted">@{{ user.ap_domain }}</span>{% endif %}
        </a>
        {% if user.bot -%}
            <span class="fe fe-bot-account" title="Bot account"> </span>
        {% endif -%}
    {% endif -%}
</span>
{% endmacro -%}

{% macro render_communityname(community, add_domain=True) -%}
    <span class="render_community">
        <a href="/c/{{ community.link() }}" aria-label="{{ _('Go to community %(name)s', name=community.name) }}">
            {{ community.title }}{% if not community.is_local() %}<span class="text-muted">@{{ community.ap_domain }}</span>{% endif %}
        </a>
    </span>
{% endmacro -%}


<!doctype html>
<html lang="en" data-bs-theme="auto">
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <title id="head_title"></title>

  <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/>
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="mobile-web-app-capable" content="yes">
  <meta name="HandheldFriendly" content="True">
  <meta name="MobileOptimized" content="320">
  <link rel="manifest" href="/static/manifest.json">

  <link id="icon_152" rel="apple-touch-icon" sizes="152x152" href="">
  <link id="icon_32" rel="icon" type="image/png" sizes="32x32" href="">
  <link id="icon_16" rel="icon" type="image/png" sizes="16x16" href="">
  <link id="icon_shortcut" rel="shortcut icon" type="image/png" href="">
  <link id="favicon" rel='icon' type="image/x-icon" href="">

  {{ bootstrap.load_css() }}
  <link href="{{ '/static/themes/' + theme() + '/css/navbars.css' }}" rel="stylesheet">
  <link href="{{ '/static/themes/' + theme() + '/css/color-modes.css' }}" rel="stylesheet">

  <script src="{{ '/static/themes/' + theme() + '/js/color-modes.js' }}"></script>
</head>

<body>
  <div class="dropdown position-fixed bottom-0 end-0 mb-3 me-3 bd-mode-toggle">
    <button class="btn btn-bd-primary py-2 dropdown-toggle d-flex align-items-center" id="bd-theme" type="button" aria-expanded="false" data-bs-toggle="dropdown" aria-label="Toggle theme (auto)">
      <svg class="bi my-1 theme-icon-active" width="1em" height="1em"><use href="{{ '/static/themes/' + theme() + '/svg/color-modes.svg#circle-half' }}"></use></svg>
      <span class="visually-hidden" id="bd-theme-text">Toggle theme</span>
    </button>
    <ul class="dropdown-menu dropdown-menu-end shadow" aria-labelledby="bd-theme-text">
      <li>
        <button type="button" class="dropdown-item d-flex align-items-center" data-bs-theme-value="light" aria-pressed="false">
          <svg class="bi me-2 opacity-50" width="1em" height="1em"><use href="{{ '/static/themes/' + theme() + '/svg/color-modes.svg#sun-fill' }}"></use></svg>
          Light
          <svg class="bi ms-auto d-none" width="1em" height="1em"><use href="{{ '/static/themes/' + theme() + '/svg/color-modes.svg#check2' }}"></use></svg>
        </button>
      </li>
      <li>
        <button type="button" class="dropdown-item d-flex align-items-center" data-bs-theme-value="dark" aria-pressed="false">
          <svg class="bi me-2 opacity-50" width="1em" height="1em"><use href="{{ '/static/themes/' + theme() + '/svg/color-modes.svg#moon-stars-fill' }}"></use></svg>
          Dark
          <svg class="bi ms-auto d-none" width="1em" height="1em"><use href="{{ '/static/themes/' + theme() + '/svg/color-modes.svg#check2' }}"></use></svg>
        </button>
      </li>
      <li>
        <button type="button" class="dropdown-item d-flex align-items-center active" data-bs-theme-value="auto" aria-pressed="true">
          <svg class="bi me-2 opacity-50" width="1em" height="1em"><use href="{{ '/static/themes/' + theme() + '/svg/color-modes.svg#circle-half' }}"></use></svg>
          Auto
          <svg class="bi ms-auto d-none" width="1em" height="1em"><use href="{{ '/static/themes/' + theme() + '/svg/color-modes.svg#check2' }}"></use></svg>
        </button>
      </li>
    </ul>
  </div>

  <nav class="navbar navbar-expand-lg sticky-top bg-body-tertiary">
    <div class="container-fluid">
      <a class="navbar-brand" href="/api/alpha" id="navbar_title"></a>
      <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
      </button>
      <div class="collapse navbar-collapse" id="navbarSupportedContent">
        <ul class="navbar-nav me-auto mb-2 mb-lg-0" id="navbar_items">
        </ul>
      </div>
    </div>
  </nav>

  <main class="container">
    {% block app_content %}{% endblock %}
    <hr />
  </main>
        
  <footer class="text-center">
    <small>
      <a href="/donate">{{ _('Donate') }}</a><br />
      <a href="/about">{{ _('About') }}</a><br />
      <a href="/keyboard_shortcuts">{{ _('Keyboard shortcuts') }}</a><br/>
      <a href="https://codeberg.org/rimu/pyfedi">PieFed</a> is free and open source.<br />Please <a href="https://codeberg.org/rimu/pyfedi/issues">report bugs</a> or <a href="https://join.piefed.social/get-involved/">get involved</a>.<br />
      <a href="/privacy">Privacy policy</a>
    </small>
  </footer>

  {{ bootstrap.load_js() }}
  <script src="{{ '/static/themes/' + theme() + '/js/site.js' }}" type="module"></script>
</body>
</html>