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

190 lines
6.1 KiB
HTML
Raw Normal View History

2025-05-03 11:29:31 -04:00
{% macro nav(selected="", show_lhs=true, hide_user_menu=false) -%}
<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="{{ home }}"
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>
{% 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-04-08 22:13:55 -04:00
<a
href="/communities/intents/post"
2025-04-08 22:13:55 -04:00
class="button"
2025-04-06 13:43:12 -04:00
title="Create post"
>
{{ icon "square-pen" }}
2025-04-08 22:13:55 -04:00
</a>
2025-04-06 13:43:12 -04:00
2025-04-27 23:11:37 -04:00
<a
href="/chats/0/0"
class="button {% if selected == 'chats' %}active{% endif %}"
title="Chats"
>
{{ icon "message-circle" }}
</a>
2025-04-12 22:25:54 -04:00
<a
href="/requests"
class="button {% if selected == 'requests' %}active{% endif %}"
title="Requests"
>
2025-05-02 20:08:35 -04:00
{{ icon "inbox" }}
<span
class="notification tr {% if user.request_count <= 0 %}hidden{% endif %}"
id="requests_span"
>{{ user.request_count }}</span
>
2025-04-12 22:25:54 -04:00
</a>
2025-03-31 11:45:34 -04:00
<a
href="/notifs"
class="button {% if selected == 'notifications' %}active{% endif %}"
title="Notifications"
>
2025-05-02 20:08:35 -04:00
{{ icon "bell" }}
<span
class="notification tr {% if user.notification_count <= 0 %}hidden{% endif %}"
id="notifications_span"
>{{ user.notification_count }}</span
>
</a>
2025-05-03 11:29:31 -04:00
{% if not hide_user_menu %}
<div class="dropdown">
<button
class="flex-row title"
onclick="trigger('atto::hooks::dropdown', [event])"
exclude="dropdown"
style="gap: 0.25rem !important"
>
2025-05-03 11:29:31 -04:00
{{ components::avatar(username=user.username, size="24px")
}} {{ icon "chevron-down" c(dropdown-arrow) }}
</button>
2025-03-23 16:37:43 -04:00
2025-05-03 11:29:31 -04:00
{{ components::user_menu() }}
</div>
2025-05-03 11:29:31 -04:00
{% endif %} {% 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>
2025-05-03 19:30:46 -04:00
<a href="https://trisua.com/t/tetratto">
2025-03-31 19:31:36 -04:00
{{ 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">
2025-05-05 19:38:01 -04:00
{% if user %}
2025-03-31 19:31:36 -04:00
<a href="/" class="{% if selected == 'home' %}active{% endif %}">
{{ icon "newspaper" }}
<span>{{ text "general:link.home" }}</span>
</a>
2025-05-05 19:38:01 -04:00
{% else %}
<a href="/" class="{% if selected == 'all' %}active{% endif %}">
{{ icon "earth" }}
<span>{{ text "general:link.all" }}</span>
</a>
{% endif %}
2025-03-31 19:31:36 -04:00
<a href="/popular" class="{% if selected == 'popular' %}active{% endif %}">
{{ icon "trending-up" }}
<span>{{ text "general:link.popular" }}</span>
</a>
{% if user %}
2025-04-09 22:00:45 -04:00
<a
href="/following"
class="{% if selected == 'following' %}active{% endif %}"
>
{{ icon "rss" }}
2025-04-09 22:00:45 -04:00
<span>{{ text "general:link.following" }}</span>
</a>
<a href="/all" class="{% if selected == 'all' %}active{% endif %}">
{{ icon "earth" }}
<span>{{ text "general:link.all" }}</span>
2025-03-31 19:31:36 -04:00
</a>
{% endif %}
2025-03-31 19:31:36 -04:00
</div>
2025-04-13 12:15:14 -04:00
{%- endmacro %} {% macro timelines_secondary_nav(posts="", questions="",
selected="posts") -%} {% if user %}
<div class="pillmenu w-full">
<a href="{{ posts }}" class="{% if selected == 'posts' %}active{% endif %}">
{{ icon "newspaper" }}
<span>{{ text "communities:label.posts" }}</span>
</a>
<a
href="{{ questions }}"
class="{% if selected == 'questions' %}active{% endif %}"
>
{{ icon "message-circle-heart" }}
<span>{{ text "communities:label.questions" }}</span>
</a>
</div>
{% endif %} {%- endmacro %} {% macro community_nav(community, selected="") -%}
{% if community.context.enable_questions %}
2025-04-12 22:25:54 -04:00
<div class="pillmenu">
<a
href="/community/{{ community.title }}"
class="{% if selected == 'posts' %}active{% endif %}"
>
{{ icon "newspaper" }}
<span>{{ text "communities:tab.posts" }}</span>
</a>
<a
href="/community/{{ community.title }}/questions"
class="{% if selected == 'questions' %}active{% endif %}"
>
{{ icon "message-circle-heart" }}
<span>{{ text "communities:tab.questions" }}</span>
</a>
</div>
{% endif %} {%- endmacro %}