add: channels, messages

This commit is contained in:
trisua 2025-04-27 23:11:37 -04:00
parent 67492cf73f
commit 7774124bd0
40 changed files with 2238 additions and 115 deletions

View file

@ -54,8 +54,8 @@ community %}
class="card secondary w-full flex items-center gap-4"
href="/community/{{ community.title }}"
>
{{ components::community_avatar(id=community.id, community=community,
size="48px") }}
{{ self::community_avatar(id=community.id, community=community, size="48px")
}}
<div class="flex flex-col">
<h3 class="name lg:long">{{ community.context.display_name }}</h3>
<span class="fade"><b>{{ community.member_count }}</b> members</span>
@ -92,11 +92,16 @@ secondary=false) -%}
</button>
{% endif %} {%- endmacro %} {% macro full_username(user) -%}
<div class="flex items-center">
<a href="/@{{ user.username }}" class="flush" style="font-weight: 600">
{{ components::username(user=user) }}
<a
href="/@{{ user.username }}"
class="flush"
style="font-weight: 600"
target="_top"
>
{{ self::username(user=user) }}
</a>
{{ components::online_indicator(user=user) }} {% if user.is_verified %}
{{ self::online_indicator(user=user) }} {% if user.is_verified %}
<span
title="Verified"
style="color: var(--color-primary)"
@ -112,7 +117,7 @@ community=false, show_community=true, can_manage_post=false) -%}
<!-- prettier-ignore -->
<div style="display: none" id="repost-content:{{ post.id }}">
{% if repost %}
{{ components::post(post=repost[1], owner=repost[0], secondary=not secondary, community=false, show_community=false, can_manage_post=false) }}
{{ self::post(post=repost[1], owner=repost[0], secondary=not secondary, community=false, show_community=false, can_manage_post=false) }}
{% else %}
<div class="card tertiary red flex items-center gap-2">
{{ icon "frown" }}
@ -121,7 +126,7 @@ community=false, show_community=true, can_manage_post=false) -%}
{% endif %}
</div>
{{ components::post(post=post, owner=owner, secondary=secondary,
{{ self::post(post=post, owner=owner, secondary=secondary,
community=community, show_community=show_community,
can_manage_post=can_manage_post) }}
@ -149,15 +154,14 @@ community=false, show_community=true, can_manage_post=false) -%}
community=false, show_community=true, can_manage_post=false) -%} {% if community
and show_community and community.id != config.town_square or question %}
<div class="card-nest">
{% if question %} {{ components::question(question=question[0],
owner=question[1]) }} {% else %}
{% if question %} {{ self::question(question=question[0], owner=question[1])
}} {% else %}
<div class="card small">
<a
href="/api/v1/communities/find/{{ post.community }}"
class="flush flex gap-1 items-center"
>
{{ components::community_avatar(id=post.community,
community=community) }}
{{ self::community_avatar(id=post.community, community=community) }}
<b>
<!-- prettier-ignore -->
{% if community.context.display_name %}
@ -178,14 +182,14 @@ and show_community and community.id != config.town_square or question %}
>
<div class="w-full flex gap-2">
<a href="/@{{ owner.username }}">
{{ components::avatar(username=owner.username, size="52px",
{{ self::avatar(username=owner.username, size="52px",
selector_type="username") }}
</a>
<div class="flex flex-col w-full gap-1">
<div class="flex flex-wrap gap-2 items-center">
<span class="name"
>{{ components::full_username(user=owner) }}</span
>{{ self::full_username(user=owner) }}</span
>
{% if post.context.edited != 0 %}
@ -239,7 +243,7 @@ and show_community and community.id != config.town_square or question %}
<!-- prettier-ignore -->
{% if post.context.reactions_enabled %}
{% if post.content|length > 0 %}
{{ components::likes(id=post.id, asset_type="Post", likes=post.likes, dislikes=post.dislikes) }}
{{ self::likes(id=post.id, asset_type="Post", likes=post.likes, dislikes=post.dislikes) }}
{% endif %}
{% endif %}
@ -399,14 +403,14 @@ and show_community and community.id != config.town_square or question %}
{%- endmacro %} {% macro user_card(user) -%}
<a class="card-nest w-full" href="/@{{ user.username }}">
<div class="card small" style="padding: 0">
{{ components::banner(username=user.username, border_radius="0px") }}
{{ self::banner(username=user.username, border_radius="0px") }}
</div>
<div class="card secondary flex items-center gap-4">
{{ components::avatar(username=user.username, size="48px") }}
{{ self::avatar(username=user.username, size="48px") }}
<div class="flex items-center">
<b>{{ components::username(user=user) }}</b>
{{ components::online_indicator(user=user) }}
<b>{{ self::username(user=user) }}</b>
{{ self::online_indicator(user=user) }}
</div>
</div>
</a>
@ -522,25 +526,25 @@ user %} {% if user.settings.theme_hue %}
{% endif %}
<!-- prettier-ignore -->
<div style="display: none;">
{{ components::theme_color(color=user.settings.theme_color_surface, css="color-surface") }}
{{ components::theme_color(color=user.settings.theme_color_text, css="color-text") }}
{{ components::theme_color(color=user.settings.theme_color_text_link, css="color-link") }}
{{ 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") }}
{{ components::theme_color(color=user.settings.theme_color_lowered, css="color-lowered") }}
{{ components::theme_color(color=user.settings.theme_color_text_lowered, css="color-text-lowered") }}
{{ components::theme_color(color=user.settings.theme_color_super_lowered, css="color-super-lowered") }}
{{ 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") }}
{{ components::theme_color(color=user.settings.theme_color_raised, css="color-raised") }}
{{ components::theme_color(color=user.settings.theme_color_text_raised, css="color-text-raised") }}
{{ components::theme_color(color=user.settings.theme_color_super_raised, css="color-super-raised") }}
{{ 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") }}
{{ components::theme_color(color=user.settings.theme_color_primary, css="color-primary") }}
{{ components::theme_color(color=user.settings.theme_color_text_primary, css="color-text-primary") }}
{{ components::theme_color(color=user.settings.theme_color_primary_lowered, css="color-primary-lowered") }}
{{ 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") }}
{{ components::theme_color(color=user.settings.theme_color_secondary, css="color-secondary") }}
{{ components::theme_color(color=user.settings.theme_color_text_secondary, css="color-text-secondary") }}
{{ components::theme_color(color=user.settings.theme_color_secondary_lowered, css="color-secondary-lowered") }}
{{ 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") }}
{% if user.permissions|has_supporter %}
<style>{{ user.settings.theme_custom_css }}</style>
@ -609,12 +613,12 @@ show_community=true, secondary=false) -%}
loading="lazy"
style="--size: 52px"
/>
{% else %} {{ components::avatar(username=owner.username,
{% else %} {{ self::avatar(username=owner.username,
selector_type="username", size="52px") }} {% endif %}
</span>
{% else %}
<a href="/@{{ owner.username }}">
{{ components::avatar(username=owner.username, selector_type="username",
{{ self::avatar(username=owner.username, selector_type="username",
size="52px") }}
</a>
{% endif %}
@ -639,7 +643,7 @@ show_community=true, secondary=false) -%}
<b>anonymous</b>
{% endif %}
{% else %}
{{ components::full_username(user=owner) }}
{{ self::full_username(user=owner) }}
{% endif %}
</span>
@ -666,8 +670,7 @@ show_community=true, secondary=false) -%}
href="/api/v1/communities/find/{{ question.community }}"
class="flex items-center"
>
{{ components::community_avatar(id=question.community,
size="24px") }}
{{ self::community_avatar(id=question.community, size="24px") }}
</a>
{% endif %} {% if question.is_global %}
<a class="notification chip" href="/question/{{ question.id }}"
@ -751,7 +754,7 @@ header="", is_global=false) -%}
{%- endmacro %} {% macro global_question(question, can_manage_questions=false,
secondary=false, show_community=true) -%}
<div class="card-nest">
{{ components::question(question=question[0], owner=question[1],
{{ self::question(question=question[0], owner=question[1],
show_community=show_community) }}
<div
@ -762,7 +765,7 @@ secondary=false, show_community=true) -%}
hook="check_reactions"
hook-arg:id="{{ question[0].id }}"
>
{{ components::likes(id=question[0].id, asset_type="Question",
{{ self::likes(id=question[0].id, asset_type="Question",
likes=question[0].likes, dislikes=question[0].dislikes,
secondary=false) }}
</div>
@ -895,4 +898,64 @@ if state and state.data %}
</div>
</div>
</div>
{% endif %} {%- endmacro %}
{% 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/{{
value[0].data.name }} {% endif %} {%- endmacro %} {% macro message(user,
message, can_manage_message=false) -%}
<div class="card secondary message flex gap-2" id="message-{{ message.id }}">
<a href="/@{{ user.username }}" target="_top">
{{ self::avatar(username=user.username, size="52px") }}
</a>
<div class="flex flex-col gap-1 w-full">
<div class="flex gap-2 w-full justify-between">
<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">
{% if can_manage_message or (user and user.id == message.owner)
%}
<div class="dropdown">
<button
class="camo small"
onclick="trigger('atto::hooks::dropdown', [event])"
exclude="dropdown"
>
{{ icon "ellipsis" }}
</button>
<div class="inner">
<button
class="red"
onclick="delete_message('{{ message.id }}')"
>
{{ icon "trash" }}
<span>{{ text "general:action.delete" }}</span>
</button>
</div>
</div>
{% endif %}
</div>
</div>
<span class="no_p_margin">{{ message.content|markdown|safe }}</span>
</div>
</div>
{%- endmacro %}