add: user socket streams

add: group messages by author in ui
TODO: group messages by author in ui as they come in from socket
TODO: notifications stream connection
This commit is contained in:
trisua 2025-05-01 16:43:58 -04:00
parent c549fdd274
commit 094dd5fdb5
8 changed files with 198 additions and 40 deletions

View file

@ -909,15 +909,40 @@ if state and state.data %}
</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 }}">
value[0].data.name }} {% endif %} {%- endmacro %} {% macro
message_actions(can_manage_message, user, message) -%} {% 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 %} {%- endmacro %} {% macro message(user, message,
can_manage_message=false, grouped=false) -%}
<div
class="card secondary message flex gap-2 {% if grouped %}grouped{% endif %}"
id="message-{{ message.id }}"
>
{% if not grouped %}
<a href="/@{{ user.username }}" target="_top">
{{ self::avatar(username=user.username, size="52px") }}
</a>
{% endif %}
<div class="flex flex-col gap-1 w-full">
<div class="flex gap-2 w-full justify-between">
{% if not grouped %}
<div class="flex gap-2 w-full justify-between flex-wrap">
<div class="flex gap-2">
{{ self::full_username(user=user) }} {% if message.edited !=
message.created %}
@ -930,30 +955,16 @@ message, can_manage_message=false) -%}
</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 %}
{{ self::message_actions(user=user, message=message,
can_manage_message=can_manage_message) }}
</div>
</div>
{% else %}
<div class="floating_message_actions hidden">
{{ self::message_actions(user=user, message=message,
can_manage_message=can_manage_message) }}
</div>
{% endif %}
<span class="no_p_margin">{{ message.content|markdown|safe }}</span>
</div>