2025-03-29 00:26:56 -04:00
|
|
|
{% macro avatar(username, size="24px", selector_type="username") -%}
|
|
|
|
<img
|
|
|
|
title="{{ username }}'s avatar"
|
2025-04-04 21:42:08 -04:00
|
|
|
src="/api/v1/auth/user/{{ username }}/avatar?selector_type={{ selector_type }}"
|
2025-03-29 00:26:56 -04:00
|
|
|
alt="@{{ username }}"
|
|
|
|
class="avatar shadow"
|
2025-03-31 11:45:34 -04:00
|
|
|
loading="lazy"
|
2025-03-29 00:26:56 -04:00
|
|
|
style="--size: {{ size }}"
|
|
|
|
/>
|
|
|
|
{%- endmacro %} {% macro community_avatar(id, community=false, size="24px") -%}
|
|
|
|
{% if community %}
|
|
|
|
<img
|
|
|
|
src="/api/v1/communities/{{ id }}/avatar"
|
2025-03-31 19:31:36 -04:00
|
|
|
alt="{{ community.title }}'s avatar"
|
2025-03-29 00:26:56 -04:00
|
|
|
class="avatar shadow"
|
2025-03-31 11:45:34 -04:00
|
|
|
loading="lazy"
|
2025-03-29 00:26:56 -04:00
|
|
|
style="--size: {{ size }}"
|
|
|
|
/>
|
|
|
|
{% else %}
|
|
|
|
<img
|
|
|
|
src="/api/v1/communities/{{ id }}/avatar"
|
2025-03-31 19:31:36 -04:00
|
|
|
alt="{{ id }}'s avatar"
|
2025-03-29 00:26:56 -04:00
|
|
|
class="avatar shadow"
|
2025-03-31 11:45:34 -04:00
|
|
|
loading="lazy"
|
2025-03-29 00:26:56 -04:00
|
|
|
style="--size: {{ size }}"
|
|
|
|
/>
|
2025-04-02 14:19:37 -04:00
|
|
|
{% endif %} {%- endmacro %} {% macro banner(username,
|
|
|
|
border_radius="var(--radius)") -%}
|
2025-03-31 19:31:36 -04:00
|
|
|
<img
|
|
|
|
title="{{ username }}'s banner"
|
2025-04-04 21:42:08 -04:00
|
|
|
src="/api/v1/auth/user/{{ username }}/banner"
|
2025-03-31 19:31:36 -04:00
|
|
|
alt="@{{ username }}'s banner"
|
2025-04-09 19:25:41 -04:00
|
|
|
class="banner shadow w-full"
|
2025-03-31 19:31:36 -04:00
|
|
|
loading="lazy"
|
2025-04-02 14:19:37 -04:00
|
|
|
style="border-radius: {{ border_radius }};"
|
2025-03-31 19:31:36 -04:00
|
|
|
/>
|
|
|
|
{%- endmacro %} {% macro community_banner(id, community=false) -%} {% if
|
|
|
|
community %}
|
|
|
|
<img
|
|
|
|
src="/api/v1/communities/{{ id }}/banner"
|
|
|
|
alt="{{ community.title }}'s banner"
|
|
|
|
class="banner shadow"
|
|
|
|
loading="lazy"
|
|
|
|
/>
|
|
|
|
{% else %}
|
|
|
|
<img
|
|
|
|
src="/api/v1/communities/{{ id }}/banner"
|
|
|
|
alt="{{ id }}'s banner"
|
|
|
|
class="banner shadow"
|
|
|
|
loading="lazy"
|
|
|
|
/>
|
2025-03-29 00:26:56 -04:00
|
|
|
{% endif %} {%- endmacro %} {% macro community_listing_card(community) -%}
|
|
|
|
<a
|
2025-04-02 23:26:43 -04:00
|
|
|
class="card secondary w-full flex items-center gap-4"
|
2025-03-29 00:26:56 -04:00
|
|
|
href="/community/{{ community.title }}"
|
|
|
|
>
|
2025-04-27 23:11:37 -04:00
|
|
|
{{ self::community_avatar(id=community.id, community=community, size="48px")
|
|
|
|
}}
|
2025-03-31 11:45:34 -04:00
|
|
|
<div class="flex flex-col">
|
2025-04-03 17:51:31 -04:00
|
|
|
<h3 class="name lg:long">{{ community.context.display_name }}</h3>
|
2025-03-29 00:26:56 -04:00
|
|
|
<span class="fade"><b>{{ community.member_count }}</b> members</span>
|
|
|
|
</div>
|
|
|
|
</a>
|
|
|
|
{%- endmacro %} {% macro username(user) -%}
|
|
|
|
<div style="display: contents">
|
|
|
|
{% if user.settings.display_name %} {{ user.settings.display_name }} {% else
|
|
|
|
%} {{ user.username }} {% endif %}
|
|
|
|
</div>
|
2025-04-13 12:44:08 -04:00
|
|
|
{%- endmacro %} {% macro likes(id, asset_type, likes=0, dislikes=0,
|
|
|
|
secondary=false) -%}
|
2025-03-29 22:27:57 -04:00
|
|
|
<button
|
|
|
|
title="Like"
|
2025-04-13 12:44:08 -04:00
|
|
|
class="{% if secondary %}quaternary{% else %}camo{% endif %} small"
|
2025-03-29 22:27:57 -04:00
|
|
|
hook_element="reaction.like"
|
|
|
|
onclick="trigger('me::react', [event.target, '{{ id }}', '{{ asset_type }}', true])"
|
|
|
|
>
|
|
|
|
{{ icon "heart" }} {% if likes > 0 %}
|
|
|
|
<span>{{ likes }}</span>
|
|
|
|
{% endif %}
|
|
|
|
</button>
|
|
|
|
|
2025-04-23 16:46:13 -04:00
|
|
|
{% if not user or not user.settings.hide_dislikes %}
|
2025-03-29 22:27:57 -04:00
|
|
|
<button
|
|
|
|
title="Dislike"
|
2025-04-13 12:44:08 -04:00
|
|
|
class="{% if secondary %}quaternary{% else %}camo{% endif %} small"
|
2025-03-29 22:27:57 -04:00
|
|
|
hook_element="reaction.dislike"
|
|
|
|
onclick="trigger('me::react', [event.target, '{{ id }}', '{{ asset_type }}', false])"
|
|
|
|
>
|
|
|
|
{{ icon "heart-crack" }} {% if dislikes > 0 %}
|
|
|
|
<span>{{ dislikes }}</span>
|
|
|
|
{% endif %}
|
|
|
|
</button>
|
2025-04-23 16:46:13 -04:00
|
|
|
{% endif %} {%- endmacro %} {% macro full_username(user) -%}
|
|
|
|
<div class="flex items-center">
|
2025-04-27 23:11:37 -04:00
|
|
|
<a
|
|
|
|
href="/@{{ user.username }}"
|
|
|
|
class="flush"
|
|
|
|
style="font-weight: 600"
|
|
|
|
target="_top"
|
|
|
|
>
|
|
|
|
{{ self::username(user=user) }}
|
2025-04-02 18:44:31 -04:00
|
|
|
</a>
|
|
|
|
|
2025-04-27 23:11:37 -04:00
|
|
|
{{ self::online_indicator(user=user) }} {% if user.is_verified %}
|
2025-04-02 18:44:31 -04:00
|
|
|
<span
|
|
|
|
title="Verified"
|
|
|
|
style="color: var(--color-primary)"
|
|
|
|
class="flex items-center"
|
|
|
|
>
|
|
|
|
{{ icon "badge-check" }}
|
|
|
|
</span>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
2025-04-10 18:16:52 -04:00
|
|
|
{%- endmacro %} {% macro repost(repost, post, owner, secondary=false,
|
|
|
|
community=false, show_community=true, can_manage_post=false) -%}
|
|
|
|
<div style="display: contents">
|
|
|
|
<!-- prettier-ignore -->
|
|
|
|
<div style="display: none" id="repost-content:{{ post.id }}">
|
|
|
|
{% if repost %}
|
2025-04-27 23:11:37 -04:00
|
|
|
{{ self::post(post=repost[1], owner=repost[0], secondary=not secondary, community=false, show_community=false, can_manage_post=false) }}
|
2025-04-10 18:16:52 -04:00
|
|
|
{% else %}
|
|
|
|
<div class="card tertiary red flex items-center gap-2">
|
|
|
|
{{ icon "frown" }}
|
|
|
|
<span>Could not find original post...</span>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
|
2025-04-27 23:11:37 -04:00
|
|
|
{{ self::post(post=post, owner=owner, secondary=secondary,
|
2025-04-10 18:16:52 -04:00
|
|
|
community=community, show_community=show_community,
|
|
|
|
can_manage_post=can_manage_post) }}
|
|
|
|
|
|
|
|
<script>
|
|
|
|
document.getElementById("post-content:{{ post.id }}").innerHTML +=
|
|
|
|
document.getElementById("repost-content:{{ post.id }}").innerHTML;
|
|
|
|
document.getElementById("repost-content:{{ post.id }}").remove();
|
|
|
|
|
|
|
|
document
|
|
|
|
.getElementById("post:{{ post.id }}")
|
|
|
|
.querySelector(".avatar")
|
|
|
|
.setAttribute("style", "--size: 24px");
|
|
|
|
|
|
|
|
document
|
|
|
|
.getElementById("post:{{ post.id }}")
|
|
|
|
.querySelector(".name")
|
|
|
|
.parentElement.prepend(
|
|
|
|
document
|
|
|
|
.getElementById("post:{{ post.id }}")
|
|
|
|
.querySelector(".avatar"),
|
|
|
|
);
|
|
|
|
</script>
|
|
|
|
</div>
|
2025-04-12 22:25:54 -04:00
|
|
|
{%- endmacro %} {% macro post(post, owner, question=false, secondary=false,
|
|
|
|
community=false, show_community=true, can_manage_post=false) -%} {% if community
|
|
|
|
and show_community and community.id != config.town_square or question %}
|
2025-03-31 22:35:11 -04:00
|
|
|
<div class="card-nest">
|
2025-04-27 23:11:37 -04:00
|
|
|
{% if question %} {{ self::question(question=question[0], owner=question[1])
|
|
|
|
}} {% else %}
|
2025-03-31 22:35:11 -04:00
|
|
|
<div class="card small">
|
|
|
|
<a
|
|
|
|
href="/api/v1/communities/find/{{ post.community }}"
|
|
|
|
class="flush flex gap-1 items-center"
|
|
|
|
>
|
2025-04-27 23:11:37 -04:00
|
|
|
{{ self::community_avatar(id=post.community, community=community) }}
|
2025-04-03 20:05:21 -04:00
|
|
|
<b>
|
|
|
|
<!-- prettier-ignore -->
|
|
|
|
{% if community.context.display_name %}
|
|
|
|
{{ community.context.display_name }}
|
|
|
|
{% else %}
|
|
|
|
{{ community.title }}
|
|
|
|
{% endif %}
|
|
|
|
</b>
|
2025-04-03 12:43:36 -04:00
|
|
|
|
2025-04-11 18:08:51 -04:00
|
|
|
{% if post.context.is_pinned or post.context.is_profile_pinned %} {{
|
|
|
|
icon "pin" }} {% endif %}
|
2025-03-29 00:26:56 -04:00
|
|
|
</a>
|
2025-03-31 22:35:11 -04:00
|
|
|
</div>
|
2025-04-12 22:25:54 -04:00
|
|
|
{% endif %} {% endif %}
|
2025-03-31 22:35:11 -04:00
|
|
|
<div
|
|
|
|
class="card flex flex-col gap-2 {% if secondary %}secondary{% endif %}"
|
2025-04-10 18:16:52 -04:00
|
|
|
id="post:{{ post.id }}"
|
2025-03-31 22:35:11 -04:00
|
|
|
>
|
|
|
|
<div class="w-full flex gap-2">
|
|
|
|
<a href="/@{{ owner.username }}">
|
2025-04-27 23:11:37 -04:00
|
|
|
{{ self::avatar(username=owner.username, size="52px",
|
2025-04-12 22:25:54 -04:00
|
|
|
selector_type="username") }}
|
2025-03-31 22:35:11 -04:00
|
|
|
</a>
|
2025-03-29 00:26:56 -04:00
|
|
|
|
2025-03-31 22:35:11 -04:00
|
|
|
<div class="flex flex-col w-full gap-1">
|
|
|
|
<div class="flex flex-wrap gap-2 items-center">
|
2025-04-03 17:42:03 -04:00
|
|
|
<span class="name"
|
2025-04-27 23:11:37 -04:00
|
|
|
>{{ self::full_username(user=owner) }}</span
|
2025-04-03 17:42:03 -04:00
|
|
|
>
|
2025-03-29 00:26:56 -04:00
|
|
|
|
2025-04-07 16:07:01 -04:00
|
|
|
{% if post.context.edited != 0 %}
|
|
|
|
<div class="flex">
|
|
|
|
<span class="fade date">{{ post.context.edited }}</span>
|
|
|
|
<sup title="Edited">*</sup>
|
|
|
|
</div>
|
|
|
|
{% else %}
|
2025-03-31 22:35:11 -04:00
|
|
|
<span class="fade date">{{ post.created }}</span>
|
2025-04-07 16:32:09 -04:00
|
|
|
{% endif %} {% if post.context.is_nsfw %}
|
|
|
|
<span
|
|
|
|
title="NSFW post"
|
|
|
|
class="flex items-center"
|
|
|
|
style="color: var(--color-primary)"
|
|
|
|
>
|
|
|
|
{{ icon "square-asterisk" }}
|
|
|
|
</span>
|
2025-04-10 18:16:52 -04:00
|
|
|
{% endif %} {% if post.context.repost and
|
|
|
|
post.context.repost.reposting %}
|
|
|
|
<span
|
|
|
|
title="Repost"
|
|
|
|
class="flex items-center"
|
|
|
|
style="color: var(--color-primary)"
|
|
|
|
>
|
|
|
|
{{ icon "repeat-2" }}
|
|
|
|
</span>
|
2025-04-12 10:57:17 -04:00
|
|
|
{% endif %} {% if post.community == config.town_square %}
|
|
|
|
<span
|
|
|
|
title="Posted to profile"
|
|
|
|
class="flex items-center"
|
|
|
|
style="color: var(--color-primary)"
|
|
|
|
>
|
|
|
|
{{ icon "user-round" }}
|
|
|
|
</span>
|
2025-03-29 00:26:56 -04:00
|
|
|
{% endif %}
|
2025-03-31 22:35:11 -04:00
|
|
|
</div>
|
2025-03-29 00:26:56 -04:00
|
|
|
|
2025-05-06 15:48:03 -04:00
|
|
|
{% if not post.context.content_warning %}
|
2025-04-08 23:33:22 -04:00
|
|
|
<span id="post-content:{{ post.id }}" class="no_p_margin"
|
2025-03-31 22:35:11 -04:00
|
|
|
>{{ post.content|markdown|safe }}</span
|
|
|
|
>
|
2025-05-06 15:48:03 -04:00
|
|
|
{% else %}
|
|
|
|
<details>
|
|
|
|
<summary
|
2025-05-06 16:13:48 -04:00
|
|
|
class="card flex gap-2 items-center tertiary red w-full"
|
2025-05-06 15:48:03 -04:00
|
|
|
>
|
|
|
|
{{ icon "triangle-alert" }}
|
|
|
|
<b>{{ post.context.content_warning }}</b>
|
|
|
|
</summary>
|
|
|
|
|
|
|
|
<span id="post-content:{{ post.id }}" class="no_p_margin"
|
|
|
|
>{{ post.content|markdown|safe }}</span
|
|
|
|
>
|
|
|
|
</details>
|
|
|
|
{% endif %}
|
2025-03-31 22:35:11 -04:00
|
|
|
</div>
|
2025-03-29 00:26:56 -04:00
|
|
|
</div>
|
|
|
|
|
2025-03-31 22:35:11 -04:00
|
|
|
<div class="flex justify-between items-center gap-2 w-full">
|
2025-04-11 18:08:51 -04:00
|
|
|
{% if user %}
|
2025-03-31 22:35:11 -04:00
|
|
|
<div
|
|
|
|
class="flex gap-1 reactions_box"
|
|
|
|
hook="check_reactions"
|
|
|
|
hook-arg:id="{{ post.id }}"
|
2025-03-29 00:26:56 -04:00
|
|
|
>
|
2025-04-11 18:08:51 -04:00
|
|
|
<!-- prettier-ignore -->
|
2025-04-13 00:42:10 -04:00
|
|
|
{% if post.context.reactions_enabled %}
|
|
|
|
{% if post.content|length > 0 %}
|
2025-04-27 23:11:37 -04:00
|
|
|
{{ self::likes(id=post.id, asset_type="Post", likes=post.likes, dislikes=post.dislikes) }}
|
2025-04-13 00:42:10 -04:00
|
|
|
{% endif %}
|
2025-04-11 18:08:51 -04:00
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% if post.context.repost and post.context.repost.reposting %}
|
|
|
|
<a
|
|
|
|
href="/post/{{ post.context.repost.reposting }}"
|
|
|
|
class="button small camo"
|
|
|
|
title='{{ text "communities:label.expand_original" }}'
|
|
|
|
>
|
|
|
|
{{ icon "expand" }}
|
|
|
|
</a>
|
|
|
|
{% endif %}
|
2025-03-31 22:35:11 -04:00
|
|
|
</div>
|
2025-04-11 18:08:51 -04:00
|
|
|
{% else %}
|
2025-03-31 22:35:11 -04:00
|
|
|
<div></div>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
<div class="flex gap-1 buttons_box">
|
|
|
|
<a href="/post/{{ post.id }}" class="button camo small">
|
|
|
|
{{ icon "message-circle" }}
|
|
|
|
<span>{{ post.comment_count }}</span>
|
|
|
|
</a>
|
2025-03-29 00:26:56 -04:00
|
|
|
|
2025-03-31 22:35:11 -04:00
|
|
|
<a
|
|
|
|
href="/post/{{ post.id }}"
|
|
|
|
class="button camo small"
|
|
|
|
target="_blank"
|
2025-03-29 00:26:56 -04:00
|
|
|
>
|
2025-03-31 22:35:11 -04:00
|
|
|
{{ icon "external-link" }}
|
|
|
|
</a>
|
2025-03-29 00:26:56 -04:00
|
|
|
|
2025-04-02 11:39:51 -04:00
|
|
|
{% if user %}
|
2025-03-31 22:35:11 -04:00
|
|
|
<div class="dropdown">
|
2025-03-29 00:26:56 -04:00
|
|
|
<button
|
2025-03-31 22:35:11 -04:00
|
|
|
class="camo small"
|
|
|
|
onclick="trigger('atto::hooks::dropdown', [event])"
|
|
|
|
exclude="dropdown"
|
2025-03-29 00:26:56 -04:00
|
|
|
>
|
2025-03-31 22:35:11 -04:00
|
|
|
{{ icon "ellipsis" }}
|
2025-03-29 00:26:56 -04:00
|
|
|
</button>
|
2025-03-31 22:35:11 -04:00
|
|
|
|
|
|
|
<div class="inner">
|
2025-04-10 18:16:52 -04:00
|
|
|
{% if config.town_square and
|
|
|
|
post.context.reposts_enabled %}
|
|
|
|
<b class="title">{{ text "general:label.share" }}</b>
|
|
|
|
<button
|
|
|
|
onclick="trigger('me::repost', ['{{ post.id }}', '', '{{ config.town_square }}'])"
|
|
|
|
>
|
|
|
|
{{ icon "repeat-2" }}
|
|
|
|
<span>{{ text "communities:label.repost" }}</span>
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<button
|
|
|
|
onclick="window.REPOST_ID = '{{ post.id }}'; document.getElementById('quote_dialog').showModal()"
|
|
|
|
>
|
|
|
|
{{ icon "quote" }}
|
|
|
|
<span
|
|
|
|
>{{ text "communities:label.quote_post" }}</span
|
|
|
|
>
|
|
|
|
</button>
|
|
|
|
{% endif %} {% if user.id != post.owner %}
|
|
|
|
<b class="title">{{ text "general:label.safety" }}</b>
|
2025-04-02 11:39:51 -04:00
|
|
|
<button
|
|
|
|
class="red"
|
|
|
|
onclick="trigger('me::report', ['{{ post.id }}', 'post'])"
|
|
|
|
>
|
|
|
|
{{ icon "flag" }}
|
|
|
|
<span>{{ text "general:action.report" }}</span>
|
|
|
|
</button>
|
|
|
|
{% endif %} {% if (user.id == post.owner) or is_helper
|
2025-04-03 12:43:36 -04:00
|
|
|
or can_manage_post %}
|
2025-04-02 11:39:51 -04:00
|
|
|
<b class="title">{{ text "general:action.manage" }}</b>
|
2025-04-07 16:07:01 -04:00
|
|
|
{% if user.id == post.owner %}
|
|
|
|
<a href="/post/{{ post.id }}#/edit">
|
|
|
|
{{ icon "pen" }}
|
|
|
|
<span
|
|
|
|
>{{ text "communities:label.edit_content"
|
|
|
|
}}</span
|
|
|
|
>
|
|
|
|
</a>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
<a href="/post/{{ post.id }}#/configure">
|
|
|
|
{{ icon "settings" }}
|
|
|
|
<span
|
|
|
|
>{{ text "communities:action.configure" }}</span
|
|
|
|
>
|
|
|
|
</a>
|
|
|
|
|
2025-03-31 22:35:11 -04:00
|
|
|
<button
|
|
|
|
class="red"
|
|
|
|
onclick="trigger('me::remove_post', ['{{ post.id }}'])"
|
|
|
|
>
|
|
|
|
{{ icon "trash" }}
|
|
|
|
<span>{{ text "general:action.delete" }}</span>
|
|
|
|
</button>
|
2025-04-02 11:39:51 -04:00
|
|
|
{% endif %}
|
2025-03-31 22:35:11 -04:00
|
|
|
</div>
|
2025-03-29 00:26:56 -04:00
|
|
|
</div>
|
2025-04-02 11:39:51 -04:00
|
|
|
{% endif %}
|
2025-03-29 00:26:56 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2025-04-12 22:25:54 -04:00
|
|
|
{% if community and show_community and community.id != config.town_square or
|
|
|
|
question %}
|
2025-03-29 00:26:56 -04:00
|
|
|
</div>
|
2025-03-31 22:35:11 -04:00
|
|
|
{% endif %} {%- endmacro %} {% macro notification(notification) -%}
|
2025-03-30 22:26:20 -04:00
|
|
|
<div class="w-full card-nest">
|
|
|
|
<div class="card small notif_title flex items-center">
|
|
|
|
{% if not notification.read %}
|
|
|
|
<svg
|
|
|
|
width="24"
|
|
|
|
height="24"
|
|
|
|
viewBox="0 0 24 24"
|
|
|
|
style="fill: var(--color-link)"
|
|
|
|
>
|
|
|
|
<circle cx="12" cy="12" r="6"></circle>
|
|
|
|
</svg>
|
|
|
|
{% endif %}
|
2025-04-09 20:09:43 -04:00
|
|
|
<b class="no_p_margin">{{ notification.title|markdown|safe }}</b>
|
2025-03-30 22:26:20 -04:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="card notif_content flex flex-col gap-2">
|
2025-04-09 20:09:43 -04:00
|
|
|
<span class="no_p_margin"
|
|
|
|
>{{ notification.content|markdown|safe }}</span
|
|
|
|
>
|
2025-03-30 22:26:20 -04:00
|
|
|
|
|
|
|
<div class="card secondary w-full flex flex-wrap gap-2">
|
|
|
|
{% if notification.read %}
|
|
|
|
<button
|
|
|
|
class="tertiary"
|
2025-04-12 22:25:54 -04:00
|
|
|
onclick="trigger('me::update_notification_read_status', ['{{ notification.id }}', false])"
|
2025-03-30 22:26:20 -04:00
|
|
|
>
|
|
|
|
{{ icon "undo" }}
|
|
|
|
<span>{{ text "notifs:action.mark_as_unread" }}</span>
|
|
|
|
</button>
|
|
|
|
{% else %}
|
|
|
|
<button
|
|
|
|
class="green tertiary"
|
2025-04-12 22:25:54 -04:00
|
|
|
onclick="trigger('me::update_notification_read_status', ['{{ notification.id }}', true])"
|
2025-03-30 22:26:20 -04:00
|
|
|
>
|
|
|
|
{{ icon "check" }}
|
|
|
|
<span>{{ text "notifs:action.mark_as_read" }}</span>
|
|
|
|
</button>
|
2025-04-09 20:09:43 -04:00
|
|
|
{% endif %}
|
2025-03-30 22:26:20 -04:00
|
|
|
|
|
|
|
<button
|
|
|
|
class="red tertiary"
|
|
|
|
onclick="trigger('me::remove_notification', ['{{ notification.id }}'])"
|
|
|
|
>
|
|
|
|
{{ icon "trash" }}
|
|
|
|
<span>{{ text "general:action.delete" }}</span>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2025-03-31 22:35:11 -04:00
|
|
|
{%- endmacro %} {% macro user_card(user) -%}
|
2025-04-02 14:19:37 -04:00
|
|
|
<a class="card-nest w-full" href="/@{{ user.username }}">
|
|
|
|
<div class="card small" style="padding: 0">
|
2025-04-27 23:11:37 -04:00
|
|
|
{{ self::banner(username=user.username, border_radius="0px") }}
|
2025-04-02 14:19:37 -04:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="card secondary flex items-center gap-4">
|
2025-04-27 23:11:37 -04:00
|
|
|
{{ self::avatar(username=user.username, size="48px") }}
|
2025-04-02 14:19:37 -04:00
|
|
|
<div class="flex items-center">
|
2025-04-27 23:11:37 -04:00
|
|
|
<b>{{ self::username(user=user) }}</b>
|
|
|
|
{{ self::online_indicator(user=user) }}
|
2025-04-02 14:19:37 -04:00
|
|
|
</div>
|
2025-03-31 22:35:11 -04:00
|
|
|
</div>
|
|
|
|
</a>
|
2025-04-10 21:37:33 -04:00
|
|
|
{%- endmacro %} {% macro pagination(page=0, items=0, key="", value="") -%}
|
2025-04-01 16:12:13 -04:00
|
|
|
<div class="flex justify-between gap-2 w-full">
|
|
|
|
{% if page > 0 %}
|
2025-04-10 21:37:33 -04:00
|
|
|
<a
|
|
|
|
class="button quaternary"
|
|
|
|
href="?page={{ page - 1 }}{{ key }}{{ value }}"
|
|
|
|
>
|
2025-04-01 16:12:13 -04:00
|
|
|
{{ icon "arrow-left" }}
|
|
|
|
<span>{{ text "general:link.previous" }}</span>
|
|
|
|
</a>
|
|
|
|
{% else %}
|
|
|
|
<div></div>
|
|
|
|
{% endif %} {% if items != 0 %}
|
2025-04-10 21:37:33 -04:00
|
|
|
<a
|
|
|
|
class="button quaternary"
|
|
|
|
href="?page={{ page + 1 }}{{ key }}{{ value }}"
|
|
|
|
>
|
2025-04-01 16:12:13 -04:00
|
|
|
<span>{{ text "general:link.next" }}</span>
|
|
|
|
{{ icon "arrow-right"}}
|
|
|
|
</a>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
2025-04-02 14:11:01 -04:00
|
|
|
{%- endmacro %} {% macro online_indicator(user) -%} {% if not
|
2025-04-12 10:57:17 -04:00
|
|
|
user.settings.private_last_seen or is_helper %}
|
2025-04-02 14:11:01 -04:00
|
|
|
<div
|
|
|
|
class="online_indicator"
|
|
|
|
style="display: contents"
|
|
|
|
hook="online_indicator"
|
|
|
|
hook-arg:last_seen="{{ user.last_seen }}"
|
|
|
|
>
|
|
|
|
<div style="display: none" hook_ui_ident="online" title="Online">
|
|
|
|
<svg
|
|
|
|
width="24"
|
|
|
|
height="24"
|
|
|
|
viewBox="0 0 24 24"
|
|
|
|
style="fill: var(--color-green)"
|
|
|
|
>
|
|
|
|
<circle cx="12" cy="12" r="6"></circle>
|
|
|
|
</svg>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div style="display: none" hook_ui_ident="idle" title="Idle">
|
|
|
|
<svg
|
|
|
|
width="24"
|
|
|
|
height="24"
|
|
|
|
viewBox="0 0 24 24"
|
|
|
|
style="fill: var(--color-yellow)"
|
|
|
|
>
|
|
|
|
<circle cx="12" cy="12" r="6"></circle>
|
|
|
|
</svg>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div style="display: none" hook_ui_ident="offline" title="Offline">
|
|
|
|
<svg
|
|
|
|
width="24"
|
|
|
|
height="24"
|
|
|
|
viewBox="0 0 24 24"
|
|
|
|
style="fill: hsl(0, 0%, 50%)"
|
|
|
|
>
|
|
|
|
<circle cx="12" cy="12" r="6"></circle>
|
|
|
|
</svg>
|
|
|
|
</div>
|
|
|
|
</div>
|
2025-04-12 10:57:17 -04:00
|
|
|
{% else %}
|
|
|
|
<div title="Offline" style="display: contents">
|
|
|
|
<svg
|
|
|
|
width="24"
|
|
|
|
height="24"
|
|
|
|
viewBox="0 0 24 24"
|
|
|
|
style="fill: hsl(0, 0%, 50%)"
|
|
|
|
>
|
|
|
|
<circle cx="12" cy="12" r="6"></circle>
|
|
|
|
</svg>
|
|
|
|
</div>
|
2025-04-11 18:08:51 -04:00
|
|
|
{% endif %} {%- endmacro %} {% macro theme(user, theme_preference) -%} {% if
|
|
|
|
user %} {% if user.settings.theme_hue %}
|
2025-04-08 15:49:41 -04:00
|
|
|
<style>
|
|
|
|
:root, * {
|
|
|
|
--hue: {{ user.settings.theme_hue }} !important;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
{% endif %} {% if user.settings.theme_sat %}
|
|
|
|
<style>
|
|
|
|
:root, * {
|
|
|
|
--sat: {{ user.settings.theme_sat }} !important;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
{% endif %} {% if user.settings.theme_lit %}
|
|
|
|
<style>
|
|
|
|
:root, * {
|
|
|
|
--lit: {{ user.settings.theme_lit }} !important;
|
|
|
|
}
|
|
|
|
</style>
|
2025-04-11 20:31:50 -04:00
|
|
|
{% endif %} {% if theme_preference %}
|
2025-04-09 19:25:41 -04:00
|
|
|
<script>
|
|
|
|
function match_user_theme() {
|
2025-04-11 18:08:51 -04:00
|
|
|
const pref = "{{ theme_preference }}".toLowerCase();
|
2025-04-09 19:25:41 -04:00
|
|
|
|
|
|
|
if (pref === "auto") {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
document.documentElement.className = pref;
|
|
|
|
}
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
match_user_theme();
|
|
|
|
}, 150);
|
|
|
|
</script>
|
2025-04-11 20:31:50 -04:00
|
|
|
{% endif %}
|
2025-04-11 18:08:51 -04:00
|
|
|
<!-- prettier-ignore -->
|
|
|
|
<div style="display: none;">
|
2025-04-27 23:11:37 -04:00
|
|
|
{{ self::theme_color(color=user.settings.theme_color_surface, css="color-surface") }}
|
|
|
|
{{ self::theme_color(color=user.settings.theme_color_text, css="color-text") }}
|
|
|
|
{{ self::theme_color(color=user.settings.theme_color_text_link, css="color-link") }}
|
2025-04-11 18:08:51 -04:00
|
|
|
|
2025-04-27 23:11:37 -04:00
|
|
|
{{ self::theme_color(color=user.settings.theme_color_lowered, css="color-lowered") }}
|
|
|
|
{{ self::theme_color(color=user.settings.theme_color_text_lowered, css="color-text-lowered") }}
|
|
|
|
{{ self::theme_color(color=user.settings.theme_color_super_lowered, css="color-super-lowered") }}
|
2025-04-11 18:08:51 -04:00
|
|
|
|
2025-04-27 23:11:37 -04:00
|
|
|
{{ self::theme_color(color=user.settings.theme_color_raised, css="color-raised") }}
|
|
|
|
{{ self::theme_color(color=user.settings.theme_color_text_raised, css="color-text-raised") }}
|
|
|
|
{{ self::theme_color(color=user.settings.theme_color_super_raised, css="color-super-raised") }}
|
2025-04-11 18:08:51 -04:00
|
|
|
|
2025-04-27 23:11:37 -04:00
|
|
|
{{ self::theme_color(color=user.settings.theme_color_primary, css="color-primary") }}
|
|
|
|
{{ self::theme_color(color=user.settings.theme_color_text_primary, css="color-text-primary") }}
|
|
|
|
{{ self::theme_color(color=user.settings.theme_color_primary_lowered, css="color-primary-lowered") }}
|
2025-04-11 18:08:51 -04:00
|
|
|
|
2025-04-27 23:11:37 -04:00
|
|
|
{{ self::theme_color(color=user.settings.theme_color_secondary, css="color-secondary") }}
|
|
|
|
{{ self::theme_color(color=user.settings.theme_color_text_secondary, css="color-text-secondary") }}
|
|
|
|
{{ self::theme_color(color=user.settings.theme_color_secondary_lowered, css="color-secondary-lowered") }}
|
2025-04-12 12:17:30 -04:00
|
|
|
|
|
|
|
{% if user.permissions|has_supporter %}
|
|
|
|
<style>{{ user.settings.theme_custom_css }}</style>
|
|
|
|
{% endif %}
|
2025-04-11 18:08:51 -04:00
|
|
|
</div>
|
|
|
|
{% endif %} {%- endmacro %} {% macro theme_color(color, css) -%} {% if color %}
|
|
|
|
<!-- prettier-ignore -->
|
|
|
|
<style>
|
|
|
|
:root,
|
|
|
|
* {
|
|
|
|
--{{ css }}: {{ color|color }} !important;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
{% endif %} {%- endmacro %} {% macro quote_form() -%} {% if config.town_square
|
|
|
|
and user %}
|
2025-04-10 18:16:52 -04:00
|
|
|
<div class="card-nest">
|
|
|
|
<div class="card small flex flex-col">
|
|
|
|
<div class="flex items-center gap-2">
|
|
|
|
{{ icon "quote" }}
|
|
|
|
<span>{{ text "communities:label.quote_post" }}</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<form
|
|
|
|
class="card flex flex-col gap-2"
|
|
|
|
onsubmit="create_repost_from_form(event)"
|
|
|
|
>
|
|
|
|
<div class="flex flex-col gap-1">
|
|
|
|
<label for="content">{{ text "communities:label.content" }}</label>
|
|
|
|
<textarea
|
|
|
|
type="text"
|
|
|
|
name="content"
|
|
|
|
id="content"
|
|
|
|
placeholder="content"
|
|
|
|
required
|
|
|
|
minlength="2"
|
|
|
|
maxlength="4096"
|
|
|
|
></textarea>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<button class="primary">{{ text "communities:action.create" }}</button>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
async function create_repost_from_form(e) {
|
|
|
|
e.preventDefault();
|
|
|
|
await trigger("atto::debounce", ["posts::create"]);
|
|
|
|
await trigger("me::repost", [
|
|
|
|
window.REPOST_ID,
|
|
|
|
e.target.content.value,
|
|
|
|
"{{ config.town_square }}",
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
</script>
|
2025-04-12 22:25:54 -04:00
|
|
|
{% endif %} {%- endmacro %} {% macro question(question, owner,
|
|
|
|
show_community=true, secondary=false) -%}
|
|
|
|
<div class="card{% if secondary %} secondary{% endif %} flex gap-2">
|
2025-04-19 23:13:57 -04:00
|
|
|
{% if owner.id == 0 %}
|
|
|
|
<span>
|
|
|
|
{% if profile and profile.settings.anonymous_avatar_url %}
|
|
|
|
<img
|
|
|
|
src="/api/v1/util/proxy?url={{ profile.settings.anonymous_avatar_url }}"
|
|
|
|
alt="anonymous' avatar"
|
|
|
|
class="avatar shadow"
|
|
|
|
loading="lazy"
|
|
|
|
style="--size: 52px"
|
|
|
|
/>
|
2025-04-27 23:11:37 -04:00
|
|
|
{% else %} {{ self::avatar(username=owner.username,
|
2025-04-19 23:13:57 -04:00
|
|
|
selector_type="username", size="52px") }} {% endif %}
|
|
|
|
</span>
|
|
|
|
{% else %}
|
2025-04-12 22:25:54 -04:00
|
|
|
<a href="/@{{ owner.username }}">
|
2025-04-27 23:11:37 -04:00
|
|
|
{{ self::avatar(username=owner.username, selector_type="username",
|
2025-04-12 22:25:54 -04:00
|
|
|
size="52px") }}
|
|
|
|
</a>
|
2025-04-19 23:13:57 -04:00
|
|
|
{% endif %}
|
2025-04-12 22:25:54 -04:00
|
|
|
|
|
|
|
<div class="flex flex-col gap-1">
|
|
|
|
<div class="flex items-center gap-2 flex-wrap">
|
2025-04-19 23:13:57 -04:00
|
|
|
<!-- prettier-ignore -->
|
|
|
|
<span class="name">
|
|
|
|
{% if owner.id == 0 %}
|
|
|
|
{% if profile and profile.settings.anonymous_username %}
|
|
|
|
<span class="flex items-center gap-2">
|
|
|
|
<b>{{ profile.settings.anonymous_username }}</b>
|
|
|
|
<span
|
|
|
|
title="Anonymous user"
|
|
|
|
class="flex items-center"
|
|
|
|
style="color: var(--color-primary)"
|
|
|
|
>
|
|
|
|
{{ icon "drama" }}
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
{% else %}
|
|
|
|
<b>anonymous</b>
|
|
|
|
{% endif %}
|
|
|
|
{% else %}
|
2025-04-27 23:11:37 -04:00
|
|
|
{{ self::full_username(user=owner) }}
|
2025-04-19 23:13:57 -04:00
|
|
|
{% endif %}
|
|
|
|
</span>
|
2025-04-12 22:25:54 -04:00
|
|
|
|
|
|
|
<span class="date">{{ question.created }}</span>
|
|
|
|
|
|
|
|
<span
|
|
|
|
title="Question"
|
|
|
|
class="flex items-center"
|
|
|
|
style="color: var(--color-primary)"
|
|
|
|
>
|
|
|
|
{{ icon "message-circle-heart" }}
|
|
|
|
</span>
|
|
|
|
|
2025-04-14 17:21:52 -04:00
|
|
|
{% if question.context.is_nsfw %}
|
|
|
|
<span
|
|
|
|
title="NSFW community"
|
|
|
|
class="flex items-center"
|
|
|
|
style="color: var(--color-primary)"
|
|
|
|
>
|
|
|
|
{{ icon "square-asterisk" }}
|
|
|
|
</span>
|
|
|
|
{% endif %} {% if question.community > 0 and show_community %}
|
2025-04-13 00:42:10 -04:00
|
|
|
<a
|
|
|
|
href="/api/v1/communities/find/{{ question.community }}"
|
|
|
|
class="flex items-center"
|
|
|
|
>
|
2025-04-27 23:11:37 -04:00
|
|
|
{{ self::community_avatar(id=question.community, size="24px") }}
|
2025-04-12 22:25:54 -04:00
|
|
|
</a>
|
|
|
|
{% endif %} {% if question.is_global %}
|
|
|
|
<a class="notification chip" href="/question/{{ question.id }}"
|
|
|
|
>{{ question.answer_count }} answers</a
|
|
|
|
>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<span class="no_p_margin" style="font-weight: 500"
|
|
|
|
>{{ question.content|markdown|safe }}</span
|
|
|
|
>
|
|
|
|
|
|
|
|
<div class="flex gap-2 items-center justify-between"></div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{%- endmacro %} {% macro create_question_form(receiver="0", community="",
|
2025-04-19 14:52:33 -04:00
|
|
|
header="", is_global=false) -%}
|
2025-04-12 22:25:54 -04:00
|
|
|
<div class="card-nest">
|
|
|
|
<div class="card small flex items-center gap-2">
|
|
|
|
{{ icon "message-circle-heart" }}
|
2025-04-19 14:52:33 -04:00
|
|
|
<span class="no_p_margin">
|
|
|
|
<!-- prettier-ignore -->
|
|
|
|
{% if header %}
|
|
|
|
{{ header|markdown|safe }}
|
|
|
|
{% else %}
|
|
|
|
{{ text "requests:label.ask_question" }}
|
|
|
|
{% endif %}
|
|
|
|
</span>
|
2025-04-12 22:25:54 -04:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<form
|
|
|
|
class="card flex flex-col gap-2"
|
|
|
|
onsubmit="create_question_from_form(event)"
|
|
|
|
>
|
|
|
|
<div class="flex flex-col gap-1">
|
|
|
|
<label for="content">{{ text "communities:label.content" }}</label>
|
|
|
|
<textarea
|
|
|
|
type="text"
|
|
|
|
name="content"
|
|
|
|
id="content"
|
|
|
|
placeholder="content"
|
|
|
|
required
|
|
|
|
minlength="2"
|
|
|
|
maxlength="4096"
|
|
|
|
></textarea>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<button class="primary">{{ text "communities:action.create" }}</button>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
async function create_question_from_form(e) {
|
|
|
|
e.preventDefault();
|
|
|
|
await trigger("atto::debounce", ["questions::create"]);
|
|
|
|
fetch("/api/v1/questions", {
|
|
|
|
method: "POST",
|
|
|
|
headers: {
|
|
|
|
"Content-Type": "application/json",
|
|
|
|
},
|
|
|
|
body: JSON.stringify({
|
|
|
|
content: e.target.content.value,
|
|
|
|
receiver: "{{ receiver }}",
|
|
|
|
community: "{{ community }}",
|
|
|
|
is_global: "{{ is_global }}" == "true",
|
|
|
|
}),
|
|
|
|
})
|
|
|
|
.then((res) => res.json())
|
|
|
|
.then((res) => {
|
|
|
|
trigger("atto::toast", [
|
|
|
|
res.ok ? "success" : "error",
|
|
|
|
res.message,
|
|
|
|
]);
|
|
|
|
|
|
|
|
if (res.ok) {
|
|
|
|
e.target.reset();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
</script>
|
2025-04-13 12:15:14 -04:00
|
|
|
{%- endmacro %} {% macro global_question(question, can_manage_questions=false,
|
2025-04-13 12:20:55 -04:00
|
|
|
secondary=false, show_community=true) -%}
|
2025-04-13 12:15:14 -04:00
|
|
|
<div class="card-nest">
|
2025-04-27 23:11:37 -04:00
|
|
|
{{ self::question(question=question[0], owner=question[1],
|
2025-04-13 12:20:55 -04:00
|
|
|
show_community=show_community) }}
|
2025-04-13 12:15:14 -04:00
|
|
|
|
|
|
|
<div
|
2025-04-13 12:44:08 -04:00
|
|
|
class="small card flex justify-between flex-wrap gap-2{% if secondary %} secondary{% endif %}"
|
2025-04-13 12:15:14 -04:00
|
|
|
>
|
2025-04-13 12:44:08 -04:00
|
|
|
<div
|
|
|
|
class="flex gap-1 reactions_box"
|
|
|
|
hook="check_reactions"
|
|
|
|
hook-arg:id="{{ question[0].id }}"
|
2025-04-13 12:15:14 -04:00
|
|
|
>
|
2025-04-27 23:11:37 -04:00
|
|
|
{{ self::likes(id=question[0].id, asset_type="Question",
|
2025-04-13 12:44:08 -04:00
|
|
|
likes=question[0].likes, dislikes=question[0].dislikes,
|
|
|
|
secondary=false) }}
|
|
|
|
</div>
|
2025-04-13 12:15:14 -04:00
|
|
|
|
2025-04-13 12:44:08 -04:00
|
|
|
<div class="flex gap-1 buttons_box">
|
|
|
|
<a href="/question/{{ question[0].id }}" class="button small">
|
|
|
|
{{ icon "external-link" }} {% if user %}
|
|
|
|
<span>{{ text "requests:label.answer" }}</span>
|
|
|
|
{% else %}
|
|
|
|
<span>{{ text "general:action.open" }}</span>
|
|
|
|
{% endif %}
|
|
|
|
</a>
|
|
|
|
|
|
|
|
{% if user %} {% if can_manage_questions or is_helper or
|
|
|
|
question[1].id == user.id %}
|
|
|
|
<div class="dropdown">
|
|
|
|
<button
|
|
|
|
class="camo small"
|
|
|
|
onclick="trigger('atto::hooks::dropdown', [event])"
|
|
|
|
exclude="dropdown"
|
|
|
|
>
|
|
|
|
{{ icon "ellipsis" }}
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<div class="inner">
|
|
|
|
<button
|
|
|
|
class="camo small red"
|
|
|
|
onclick="trigger('me::remove_question', ['{{ question[0].id }}'])"
|
|
|
|
>
|
|
|
|
{{ icon "trash" }}
|
|
|
|
<span>{{ text "general:action.delete" }}</span>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endif %} {% endif %}
|
|
|
|
</div>
|
2025-04-13 12:15:14 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
2025-04-26 16:27:18 -04:00
|
|
|
{%- endmacro %} {% macro spotify_playing(state, size="60px") -%} {% if state and
|
|
|
|
state.data %}
|
|
|
|
<div class="card-nest">
|
|
|
|
<div class="card flex items-center justify-between gap-2 small">
|
|
|
|
<div class="flex items-center gap-2">
|
|
|
|
<b>Listening on</b>
|
|
|
|
{{ icon "spotify" }}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<span class="fade date short">{{ state.data.timestamp }}</span>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="card secondary flex gap-2">
|
|
|
|
<a href="{{ state.external_urls.album }}">
|
|
|
|
<img
|
|
|
|
src="{{ state.external_urls.album_img }}"
|
|
|
|
alt="Album cover"
|
|
|
|
loading="lazy"
|
|
|
|
class="avatar"
|
|
|
|
style="--size: {{ size }}"
|
|
|
|
/>
|
|
|
|
</a>
|
|
|
|
|
|
|
|
<div class="flex flex-col">
|
|
|
|
<h5 class="w-full">
|
|
|
|
<a href="{{ state.external_urls.track }}" class="flush"
|
|
|
|
>{{ state.data.track }}</a
|
|
|
|
>
|
|
|
|
</h5>
|
|
|
|
|
|
|
|
<span class="fade"
|
|
|
|
><a href="{{ state.external_urls.artist }}" class="flush"
|
|
|
|
>{{ state.data.artist }}</a
|
|
|
|
></span
|
|
|
|
>
|
|
|
|
|
|
|
|
<span
|
|
|
|
hook="spotify_time_text"
|
|
|
|
hook-arg:updated="{{ state.data.timestamp }}"
|
|
|
|
hook-arg:progress="{{ state.data.progress_ms }}"
|
|
|
|
hook-arg:duration="{{ state.data.duration_ms }}"
|
|
|
|
hook-arg:display="full"
|
|
|
|
></span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2025-04-26 19:23:30 -04:00
|
|
|
{% endif %} {%- endmacro %} {% macro last_fm_playing(state, size="60px") -%} {%
|
|
|
|
if state and state.data %}
|
|
|
|
<div class="card-nest">
|
|
|
|
<div class="card flex items-center justify-between gap-2 small">
|
|
|
|
<div class="flex items-center gap-2">
|
|
|
|
<b>Listening on</b>
|
|
|
|
{{ icon "last_fm" }}
|
|
|
|
</div>
|
2025-04-26 19:31:15 -04:00
|
|
|
|
|
|
|
<span class="fade date short">{{ state.data.timestamp }}</span>
|
2025-04-26 19:23:30 -04:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="card secondary flex gap-2">
|
2025-04-26 21:12:29 -04:00
|
|
|
<a href="{{ state.external_urls.track }}">
|
|
|
|
<img
|
|
|
|
src="{{ state.external_urls.track_img }}"
|
|
|
|
alt="Track cover"
|
|
|
|
loading="lazy"
|
|
|
|
class="avatar"
|
|
|
|
style="--size: {{ size }}"
|
|
|
|
/>
|
|
|
|
</a>
|
2025-04-26 19:23:30 -04:00
|
|
|
|
|
|
|
<div class="flex flex-col">
|
|
|
|
<h5 class="w-full">
|
|
|
|
<a href="{{ state.external_urls.track }}" class="flush"
|
|
|
|
>{{ state.data.track }}</a
|
|
|
|
>
|
|
|
|
</h5>
|
|
|
|
|
|
|
|
<span class="fade"
|
|
|
|
><a href="{{ state.external_urls.artist }}" class="flush"
|
|
|
|
>{{ state.data.artist }}</a
|
|
|
|
></span
|
|
|
|
>
|
2025-04-26 21:12:29 -04:00
|
|
|
|
|
|
|
{% if state.data.duration_ms and state.data.duration_ms != "0" %}
|
|
|
|
<span
|
|
|
|
hook="spotify_time_text"
|
|
|
|
hook-arg:updated="{{ state.data.timestamp }}"
|
|
|
|
hook-arg:progress="25000"
|
|
|
|
hook-arg:duration="{{ state.data.duration_ms }}"
|
|
|
|
hook-arg:display="full"
|
|
|
|
></span>
|
|
|
|
{% endif %}
|
2025-04-26 19:23:30 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2025-04-27 23:11:37 -04:00
|
|
|
{% endif %} {%- endmacro %} {% macro connection_icon(key) -%}
|
|
|
|
<!-- prettier-ignore -->
|
|
|
|
<div style="display: contents;">
|
|
|
|
{% if key == "Spotify" %}
|
|
|
|
{{ icon "spotify" }}
|
|
|
|
{% elif key == "LastFm" %}
|
|
|
|
{{ icon "last_fm" }}
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
{%- endmacro %} {% macro connection_url(key, value) -%} {% if value[0].data.url
|
|
|
|
%} {{ value[0].data.url }} {% elif key == "LastFm" %} https://last.fm/user/{{
|
2025-05-01 16:43:58 -04:00
|
|
|
value[0].data.name }} {% endif %} {%- endmacro %} {% macro
|
2025-05-03 17:51:36 -04:00
|
|
|
message_actions(can_manage_message, user, message) -%}
|
2025-05-01 16:43:58 -04:00
|
|
|
<div class="dropdown">
|
|
|
|
<button
|
|
|
|
class="camo small"
|
|
|
|
onclick="trigger('atto::hooks::dropdown', [event])"
|
|
|
|
exclude="dropdown"
|
|
|
|
>
|
|
|
|
{{ icon "ellipsis" }}
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<div class="inner">
|
2025-05-03 17:51:36 -04:00
|
|
|
{% if can_manage_message or (user and user.id == message.owner) %}
|
2025-05-01 16:43:58 -04:00
|
|
|
<button class="red" onclick="delete_message('{{ message.id }}')">
|
|
|
|
{{ icon "trash" }}
|
|
|
|
<span>{{ text "general:action.delete" }}</span>
|
|
|
|
</button>
|
2025-05-03 17:51:36 -04:00
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
<button
|
|
|
|
onclick="window.location.href = `${window.location.origin}/chats/{{ community }}/{{ channel }}?message={{ message.id }}`"
|
|
|
|
>
|
|
|
|
{{ icon "external-link" }}
|
|
|
|
<span>{{ text "general:action.open" }}</span>
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<button
|
|
|
|
onclick="trigger('atto::copy_text', [`${window.location.origin}/chats/{{ community }}/{{ channel }}?message={{ message.id }}`])"
|
|
|
|
>
|
|
|
|
{{ icon "copy" }}
|
|
|
|
<span>{{ text "general:action.copy_link" }}</span>
|
|
|
|
</button>
|
2025-05-01 16:43:58 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
2025-05-03 17:51:36 -04:00
|
|
|
{%- endmacro %} {% macro message(user, message, can_manage_message=false,
|
|
|
|
grouped=false) -%}
|
2025-05-01 16:43:58 -04:00
|
|
|
<div
|
|
|
|
class="card secondary message flex gap-2 {% if grouped %}grouped{% endif %}"
|
|
|
|
id="message-{{ message.id }}"
|
|
|
|
>
|
|
|
|
{% if not grouped %}
|
2025-04-27 23:11:37 -04:00
|
|
|
<a href="/@{{ user.username }}" target="_top">
|
|
|
|
{{ self::avatar(username=user.username, size="52px") }}
|
|
|
|
</a>
|
2025-05-01 16:43:58 -04:00
|
|
|
{% endif %}
|
2025-04-27 23:11:37 -04:00
|
|
|
|
|
|
|
<div class="flex flex-col gap-1 w-full">
|
2025-05-01 16:43:58 -04:00
|
|
|
{% if not grouped %}
|
|
|
|
<div class="flex gap-2 w-full justify-between flex-wrap">
|
2025-04-27 23:11:37 -04:00
|
|
|
<div class="flex gap-2">
|
|
|
|
{{ self::full_username(user=user) }} {% if message.edited !=
|
|
|
|
message.created %}
|
|
|
|
<span class="date"
|
|
|
|
>{{ message.edited }}<sup title="Edited">*</sup></span
|
|
|
|
>
|
|
|
|
{% else %}
|
|
|
|
<span class="date">{{ message.created }}</span>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="flex gap-2 hidden">
|
2025-05-01 16:43:58 -04:00
|
|
|
{{ self::message_actions(user=user, message=message,
|
|
|
|
can_manage_message=can_manage_message) }}
|
2025-04-27 23:11:37 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
2025-05-01 16:43:58 -04:00
|
|
|
{% endif %}
|
2025-04-27 23:11:37 -04:00
|
|
|
|
2025-05-01 23:35:40 -04:00
|
|
|
<div class="flex w-full gap-2 justify-between">
|
|
|
|
<span class="no_p_margin">{{ message.content|markdown|safe }}</span>
|
|
|
|
|
|
|
|
{% if grouped %}
|
|
|
|
<div class="hidden">
|
|
|
|
{{ self::message_actions(user=user, message=message,
|
|
|
|
can_manage_message=can_manage_message) }}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
2025-04-27 23:11:37 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
2025-05-03 11:29:31 -04:00
|
|
|
{%- endmacro %} {% macro user_menu() -%}
|
|
|
|
<div class="inner">
|
|
|
|
<b class="title">{{ user.username }}</b>
|
|
|
|
<a href="/@{{ user.username }}">
|
|
|
|
{{ icon "circle-user-round" }}
|
|
|
|
<span>{{ text "auth:link.my_profile" }}</span>
|
|
|
|
</a>
|
|
|
|
|
|
|
|
<a href="/settings">
|
|
|
|
{{ icon "settings" }}
|
|
|
|
<span>{{ text "auth:link.settings" }}</span>
|
|
|
|
</a>
|
|
|
|
|
|
|
|
{% if is_helper %}
|
|
|
|
<b class="title">{{ text "general:label.mod" }}</b>
|
|
|
|
|
|
|
|
<a href="/mod_panel/audit_log">
|
|
|
|
{{ icon "scroll-text" }}
|
|
|
|
<span>{{ text "general:link.audit_log" }}</span>
|
|
|
|
</a>
|
|
|
|
|
|
|
|
<a href="/mod_panel/reports">
|
|
|
|
{{ icon "flag" }}
|
|
|
|
<span>{{ text "general:link.reports" }}</span>
|
|
|
|
</a>
|
|
|
|
|
|
|
|
<a href="/mod_panel/ip_bans">
|
|
|
|
{{ icon "ban" }}
|
|
|
|
<span>{{ text "general:link.ip_bans" }}</span>
|
|
|
|
</a>
|
|
|
|
|
|
|
|
<a href="/mod_panel/stats">
|
|
|
|
{{ icon "chart-line" }}
|
|
|
|
<span>{{ text "general:link.stats" }}</span>
|
|
|
|
</a>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
<b class="title">{{ config.name }}</b>
|
|
|
|
|
2025-05-03 19:30:46 -04:00
|
|
|
<a href="https://trisua.com/t/tetratto">
|
2025-05-03 11:29:31 -04:00
|
|
|
{{ icon "code" }}
|
|
|
|
<span>{{ text "general:link.source_code" }}</span>
|
|
|
|
</a>
|
|
|
|
|
2025-05-03 19:30:46 -04:00
|
|
|
<!-- <a href="https://trisuaso.github.io/tetratto">
|
2025-05-03 11:29:31 -04:00
|
|
|
{{ icon "book" }}
|
|
|
|
<span>{{ text "general:link.reference" }}</span>
|
2025-05-03 19:30:46 -04:00
|
|
|
</a> -->
|
2025-05-03 11:29:31 -04:00
|
|
|
|
|
|
|
<div class="title"></div>
|
|
|
|
<button onclick="trigger('me::switch_account')">
|
|
|
|
{{ icon "ellipsis" }}
|
|
|
|
<span>{{ text "general:action.switch_account" }}</span>
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<button class="red" onclick="trigger('me::logout')">
|
|
|
|
{{ icon "log-out" }}
|
|
|
|
<span>{{ text "auth:action.logout" }}</span>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
{%- endmacro %} {% macro user_status(other_user) -%} {% if
|
|
|
|
other_user.settings.status %}
|
|
|
|
<div class="flex items-center gap-2">
|
|
|
|
<span>{{ other_user.settings.status }}</span>
|
|
|
|
|
|
|
|
<!-- connection icon -->
|
|
|
|
{% if (other_user.connections.LastFm[1].data and
|
|
|
|
other_user.connections.LastFm[1].data.track) or
|
|
|
|
(other_user.connections.Spotify[1].data and
|
|
|
|
other_user.connections.Spotify[1].data.track) %} {{ icon "music" }} {% endif
|
|
|
|
%}
|
|
|
|
</div>
|
|
|
|
{% elif other_user.connections.LastFm[0].data.name and
|
|
|
|
other_user.connections.LastFm[1].data and
|
|
|
|
other_user.connections.LastFm[1].data.track %}
|
|
|
|
<div class="flex items-center gap-2">
|
|
|
|
{{ icon "music" }}
|
|
|
|
<span
|
|
|
|
><b>Listening to</b> {{ other_user.connections.LastFm[1].data.artist
|
|
|
|
}}</span
|
|
|
|
>
|
|
|
|
</div>
|
|
|
|
{% elif other_user.connections.Spotify[0].data.name and
|
|
|
|
other_user.connections.Spotify[1].data and
|
|
|
|
other_user.connections.Spotify[1].data.track %}
|
|
|
|
<div class="flex items-center gap-2">
|
|
|
|
{{ icon "music" }}
|
|
|
|
<span
|
|
|
|
><b>Listening to</b> {{ other_user.connections.Spotify[1].data.artist
|
|
|
|
}}</span
|
|
|
|
>
|
|
|
|
</div>
|
|
|
|
{% endif %} {%- endmacro %} {% macro user_plate(user, show_menu=false,
|
|
|
|
secondary=false) -%}
|
|
|
|
<div
|
|
|
|
class="flex gap-2 items-center card tiny user_plate {% if secondary %}secondary{% endif %}"
|
|
|
|
>
|
|
|
|
<a href="/@{{ user.username }}">
|
|
|
|
{{ self::avatar(username=user.username, size="42px",
|
|
|
|
selector_type="username") }}
|
|
|
|
</a>
|
|
|
|
|
|
|
|
<div
|
|
|
|
class="flex justify-center flex-col"
|
|
|
|
style="{% if show_menu %}width: 60%{% endif %}"
|
|
|
|
>
|
|
|
|
{{ self::full_username(user=user) }}
|
|
|
|
<div class="user_status">{{ self::user_status(other_user=user) }}</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{% if show_menu %}
|
|
|
|
<div class="dropdown">
|
|
|
|
<button
|
|
|
|
class="camo small square"
|
|
|
|
onclick="trigger('atto::hooks::dropdown', [event])"
|
|
|
|
exclude="dropdown"
|
|
|
|
>
|
|
|
|
{{ icon "settings" c(dropdown-arrow) }}
|
|
|
|
</button>
|
|
|
|
|
|
|
|
{{ self::user_menu() }}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
2025-05-05 23:12:46 -04:00
|
|
|
{%- endmacro %} {% macro emoji_picker(element_id, render_dialog=false) -%}
|
|
|
|
<button
|
|
|
|
class="button small square quaternary"
|
|
|
|
onclick="window.EMOJI_PICKER_TEXT_ID = '{{ element_id }}'; document.getElementById('emoji_dialog').showModal()"
|
|
|
|
title="Emojis"
|
|
|
|
type="button"
|
|
|
|
>
|
|
|
|
{{ icon "smile-plus" }}
|
|
|
|
</button>
|
|
|
|
|
|
|
|
{% if render_dialog %}
|
|
|
|
<dialog id="emoji_dialog">
|
|
|
|
<div class="inner flex flex-col gap-2">
|
|
|
|
<script
|
|
|
|
type="module"
|
|
|
|
src="https://unpkg.com/emoji-picker-element@1.22.8/index.js"
|
|
|
|
></script>
|
|
|
|
|
|
|
|
<emoji-picker
|
|
|
|
style="
|
|
|
|
--border-radius: var(--radius);
|
|
|
|
--background: var(--color-super-raised);
|
|
|
|
--input-border-radiFus: var(--radius);
|
|
|
|
--input-border-color: var(--color-primary);
|
|
|
|
--indicator-color: var(--color-primary);
|
|
|
|
--emoji-padding: 0.25rem;
|
|
|
|
box-shadow: 0 0 4px var(--color-shadow);
|
|
|
|
"
|
|
|
|
class="w-full"
|
|
|
|
></emoji-picker>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
document
|
|
|
|
.querySelector("emoji-picker")
|
2025-05-05 23:44:10 -04:00
|
|
|
.addEventListener("emoji-click", async (event) => {
|
|
|
|
if (event.detail.skinTone > 0) {
|
|
|
|
document.getElementById(
|
|
|
|
window.EMOJI_PICKER_TEXT_ID,
|
|
|
|
).value += event.detail.unicode;
|
|
|
|
|
|
|
|
document.getElementById("emoji_dialog").close();
|
|
|
|
return;
|
2025-05-05 23:12:46 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
document.getElementById(
|
|
|
|
window.EMOJI_PICKER_TEXT_ID,
|
2025-05-05 23:44:10 -04:00
|
|
|
).value += ` :${await (
|
|
|
|
await fetch("/api/v1/lookup_emoji", {
|
|
|
|
method: "POST",
|
|
|
|
body: event.detail.unicode,
|
|
|
|
})
|
|
|
|
).text()}:`;
|
|
|
|
|
2025-05-05 23:12:46 -04:00
|
|
|
document.getElementById("emoji_dialog").close();
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<div class="flex justify-between">
|
|
|
|
<div></div>
|
|
|
|
|
|
|
|
<div class="flex gap-2">
|
|
|
|
<button
|
|
|
|
class="bold red quaternary"
|
|
|
|
onclick="document.getElementById('emoji_dialog').close()"
|
|
|
|
type="button"
|
|
|
|
>
|
|
|
|
{{ icon "x" }} {{ text "dialog:action.close" }}
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</dialog>
|
|
|
|
{% endif %} {%- endmacro %}
|