tetratto/crates/app/src/public/html/macros.html

135 lines
4.7 KiB
HTML
Raw Normal View History

{% import "components.html" as components %} {% macro nav(selected="",
show_lhs=true) -%}
<nav>
<div class="content_container">
<div class="flex nav_side">
<a href="/" class="button desktop title">
<b>{{ config.name }}</b>
</a>
{% if show_lhs %}
<a
href="/"
class="button {% if selected == 'home' %}active{% endif %}"
>
{{ icon "house" }}
2025-03-23 16:37:43 -04:00
<span class="desktop">{{ text "general:link.home" }}</span>
</a>
2025-03-31 19:31:36 -04:00
<a
href="/popular"
class="button {% if selected == 'popular' %}active{% endif %}"
>
{{ icon "trending-up" }}
<span class="desktop">{{ text "general:link.popular" }}</span>
</a>
{% if user %}
<a
href="/communities"
class="button {% if selected == 'communities' %}active{% endif %}"
>
{{ icon "book-heart" }}
<span class="desktop"
>{{ text "general:link.communities" }}</span
>
</a>
{% endif %} {% endif %}
</div>
<div class="flex nav_side">
{% if user %}
2025-03-31 11:45:34 -04:00
<a
href="/notifs"
class="button {% if selected == 'notifications' %}active{% endif %}"
title="Notifications"
>
2025-03-30 22:26:20 -04:00
{% if user.notification_count > 0 %} {{ icon "bell-dot" }}
<span class="notification tr"
>{{ user.notification_count }}</span
>
2025-03-30 22:26:20 -04:00
{% else %} {{ icon "bell" }} {% endif %}
</a>
<div class="dropdown">
<!-- prettier-ignore -->
<button
class="flex-row title"
onclick="trigger('atto::hooks::dropdown', [event])"
exclude="dropdown"
style="gap: 0.25rem !important"
>
{{ components::avatar(username=user.username, size="24px") }}
{{ icon "chevron-down" c(dropdown-arrow) }}
</button>
2025-03-23 16:37:43 -04:00
<div class="inner">
<b class="title">{{ user.username }}</b>
2025-03-31 22:35:11 -04:00
<a href="/@{{ user.username }}">
{{ icon "circle-user-round" }}
2025-03-23 16:37:43 -04:00
<span>{{ text "auth:link.my_profile" }}</span>
</a>
<a href="/settings">
{{ icon "settings" }}
<span>{{ text "auth:link.settings" }}</span>
</a>
2025-03-23 16:37:43 -04:00
<div class="title"></div>
<button class="red" onclick="trigger('me::logout')">
{{ icon "log-out" }}
<span>{{ text "auth:action.logout" }}</span>
</button>
2025-03-31 19:31:36 -04:00
<div class="title"></div>
<a href="https://github.com/trisuaso/tetratto">
{{ icon "code" }}
<span>View source</span>
</a>
2025-03-23 16:37:43 -04:00
</div>
</div>
{% else %}
<div class="dropdown">
<button
class="title"
onclick="trigger('atto::hooks::dropdown', [event])"
exclude="dropdown"
>
{{ icon "chevron-down" c(dropdown-arrow) }}
</button>
<div class="inner">
<a href="/auth/login" class="button">
{{ icon "log-in" }}
2025-03-23 16:37:43 -04:00
<span>{{ text "auth:action.login" }}</span>
</a>
<a href="/auth/register" class="button">
{{ icon "user-plus" }}
2025-03-23 16:37:43 -04:00
<span>{{ text "auth:action.register" }}</span>
</a>
2025-03-31 19:31:36 -04:00
<div class="title"></div>
<a href="https://github.com/trisuaso/tetratto">
{{ icon "code" }}
<span>View source</span>
</a>
</div>
</div>
{% endif %}
</div>
</div>
</nav>
2025-03-31 19:31:36 -04:00
{%- endmacro %} {% macro timelines_nav(selected="") -%}
<div class="pillmenu w-full">
<a href="/" class="{% if selected == 'home' %}active{% endif %}">
{{ icon "newspaper" }}
<span>{{ text "general:link.home" }}</span>
</a>
<a href="/popular" class="{% if selected == 'popular' %}active{% endif %}">
{{ icon "trending-up" }}
<span>{{ text "general:link.popular" }}</span>
</a>
</div>
{%- endmacro %}