# HG changeset patch # User Goffi # Date 1700662931 -3600 # Node ID 941e4006ab6ecbc9f6907945cd240c3cd3e253fb # Parent 4e050f67c0794f378ca544d8104d1a23414cd3e5 bulma (message): reactions + fixes: - add "reaction" button - fix attachments display - add reaction templates - add reactions to messages - fix "info" messages display diff -r 4e050f67c079 -r 941e4006ab6e sat_templates/templates/bulma/chat/chat.html --- a/sat_templates/templates/bulma/chat/chat.html Wed Nov 22 15:22:10 2023 +0100 +++ b/sat_templates/templates/bulma/chat/chat.html Wed Nov 22 15:22:11 2023 +0100 @@ -3,7 +3,7 @@ {% block body %} {{ icon_defs( "lock-open", "lock-filled", "ok", "pencil", "dot-3", "share", "attach", - "paper-plane-empty", "doc", "download", "wrench", "eye" + "paper-plane-empty", "doc", "download", "wrench", "eye", "smile", "plus-circled" ) }} {# TODO: this should be done in a more generic way in dialog module #} diff -r 4e050f67c079 -r 941e4006ab6e sat_templates/templates/bulma/chat/message.html --- a/sat_templates/templates/bulma/chat/message.html Wed Nov 22 15:22:10 2023 +0100 +++ b/sat_templates/templates/bulma/chat/message.html Wed Nov 22 15:22:11 2023 +0100 @@ -1,7 +1,7 @@ {% import 'components/avatar.html' as avatar with context %}
- {%- if msg.type != C.MESS_TYPE_INFO %} + {%- if msg.type != "info" %} {%- set author = identities[msg.from_].nicknames[0] | default(msg.from_) -%}
{{ avatar.avatar(msg.from_, "is-32x32") }} @@ -9,7 +9,7 @@ {% endif -%}
- {%- if msg.type != C.MESS_TYPE_INFO %} + {%- if msg.type != "info" %} {% endif -%} -

+

{{- msg.html or (msg.text|e|urlize|safe) -}}

@@ -45,26 +45,41 @@
-
- {#{{ icon('share', cls='icon is-small action-button', id='msg_share_{{msg.id}}') }} #} - {{ icon('dot-3', cls='icon is-small action-button', id='msg_actions_{{msg.id}}') }} -
+ {#{{ icon('share', cls='icon is-small action-button', id='msg_share_{{msg.id}}') }} #} + {{ icon('smile', cls='icon is-small action-button reaction-button', id='msg_actions_{{msg.id}}') }} + {{ icon('dot-3', cls='icon is-small action-button extra-button', id='msg_actions_{{msg.id}}') }}
- + {% if msg.extra.reactions is defined %} + {% set reactions = msg.extra.get("reactions") %} + {% include 'chat/reactions.html' %} + {% endif %}
{% if msg.attachments %}
{%- for attachment in msg.attachments %}
- {%- if attachment.media_type|media_type_main == 'image' %} - {{attachment.name}} - {%- else %} - {{ icon('doc', cls='icon') }} - {%- endif %} -
- {{attachment.name}} -
+ {%- if not attachment.url -%} +
+
+ {% trans name=attachment.name %}Attachment: {{name}}{% endtrans %} +
+ +
+ {% trans %}Cannot be opened as there are no sources available.{% endtrans %} +
+ +
+ {%- else -%} + {%- if attachment.media_type|media_type_main == 'image' %} + {{attachment.name}} + {%- else %} + {{ icon('doc', cls='icon') }} + {%- endif %} +
+ {{attachment.name}} +
+ {%- endif -%}
{%- endfor %}
diff -r 4e050f67c079 -r 941e4006ab6e sat_templates/templates/bulma/chat/reactions.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sat_templates/templates/bulma/chat/reactions.html Wed Nov 22 15:22:11 2023 +0100 @@ -0,0 +1,11 @@ +
+ {% for emoji, jids in reactions.items() %} +
+ {{ emoji }} + {{ jids|length }} +
+ {% endfor %} +
diff -r 4e050f67c079 -r 941e4006ab6e sat_templates/templates/bulma/chat/reactions_details.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sat_templates/templates/bulma/chat/reactions_details.html Wed Nov 22 15:22:11 2023 +0100 @@ -0,0 +1,12 @@ +{% import 'components/avatar.html' as avatar with context %} + +
+ {% for jid in reacting_jids %} +
+ {{ avatar.avatar(jid, "is-24x24") }} + + {{ identities[jid].nicknames[0] if identities[jid].nicknames else jid }} + +
+ {% endfor %} +
diff -r 4e050f67c079 -r 941e4006ab6e sat_templates/templates/bulma/components/search_item.html --- a/sat_templates/templates/bulma/components/search_item.html Wed Nov 22 15:22:10 2023 +0100 +++ b/sat_templates/templates/bulma/components/search_item.html Wed Nov 22 15:22:11 2023 +0100 @@ -23,4 +23,3 @@ {% block call %}{% endblock %}
-p diff -r 4e050f67c079 -r 941e4006ab6e sat_templates/templates/bulma/components/url_preview.html --- a/sat_templates/templates/bulma/components/url_preview.html Wed Nov 22 15:22:10 2023 +0100 +++ b/sat_templates/templates/bulma/components/url_preview.html Wed Nov 22 15:22:11 2023 +0100 @@ -1,7 +1,7 @@ {% if url_preview %} -
+
{% trans %}Preview{% endtrans %} diff -r 4e050f67c079 -r 941e4006ab6e sat_templates/templates/bulma/components/url_preview_control.html --- a/sat_templates/templates/bulma/components/url_preview_control.html Wed Nov 22 15:22:10 2023 +0100 +++ b/sat_templates/templates/bulma/components/url_preview_control.html Wed Nov 22 15:22:11 2023 +0100 @@ -1,5 +1,5 @@ {% block url_preview %} -
+

{% trans %}URL Preview{% endtrans %}

{% trans %}To protect your privacy, we don't automatically fetch URL previews. If you want to preview this URL, just hit the "Fetch Preview" button. You can customize this preference in your settings.{% endtrans %}

diff -r 4e050f67c079 -r 941e4006ab6e sat_templates/templates/bulma/static/chat.css --- a/sat_templates/templates/bulma/static/chat.css Wed Nov 22 15:22:10 2023 +0100 +++ b/sat_templates/templates/bulma/static/chat.css Wed Nov 22 15:22:11 2023 +0100 @@ -22,7 +22,7 @@ padding-left: 1.5em; } -.is-chat-message:hover { +.is-chat-message:hover, .chat-message-highlight { background-color: #f5f5f5; box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2); } @@ -42,13 +42,15 @@ opacity: 0; } -.is-chat-message:hover .actions { +.is-chat-message:hover .actions, .chat-message-highlight .actions { opacity: 1; } .action-button { box-sizing: border-box; margin: 0 0.2rem; + user-select: none; + z-index: 10; } .action-button:hover { diff -r 4e050f67c079 -r 941e4006ab6e sat_templates/templates/bulma/static/styles.css --- a/sat_templates/templates/bulma/static/styles.css Wed Nov 22 15:22:10 2023 +0100 +++ b/sat_templates/templates/bulma/static/styles.css Wed Nov 22 15:22:11 2023 +0100 @@ -628,6 +628,19 @@ } } +/******************* + * common features * + ******************/ + +.reaction { + border-radius: 12px; /* Rounded background */ + cursor: pointer; /* Pointer cursor for the entire reaction */ + border: 1px solid #dbdbdb; /* Discreet but visible border */ +} + +.reaction .emoji { + margin-right: .5rem; /* Space between emoji and counter using rem unit */ +} /************** * animations * @@ -772,3 +785,12 @@ .animation-reverse { animation-direction: reverse; } + +/*************** + * third party * + **************/ + +emoji-picker { + width: 100%; + /* height: 30rem; */ +}