From 26d92eff7c95a634941787c694ce5e5cc0f197c1 Mon Sep 17 00:00:00 2001 From: "Schimon Jehudah, Adv." Date: Mon, 14 Oct 2024 12:31:31 +0300 Subject: [PATCH] Improve interface and subject display (Thanks to the blabber.im group chat). --- css/stylesheet.css | 58 ++++++++++++++++++++++++----- fasi.py | 83 ++++++++++++++++++++++++++++++++---------- xhtml/conference.xhtml | 22 +++++------ xhtml/jid.xhtml | 20 +++++----- xhtml/node.xhtml | 23 ++++++------ 5 files changed, 145 insertions(+), 61 deletions(-) diff --git a/css/stylesheet.css b/css/stylesheet.css index 71b7593..88c7c9e 100644 --- a/css/stylesheet.css +++ b/css/stylesheet.css @@ -48,6 +48,14 @@ div:has(#bar) { } */ +#subject { + margin: auto; + max-height: 30vh; + overflow: auto; + padding: 1em; + width: 90vw; +} + #bar, #content > #entries > .entry, #profile-top, @@ -141,6 +149,7 @@ label, } #profile-top { + align-items: center; display: flex; justify-content: space-between; text-align: center; @@ -239,8 +248,8 @@ h1 { width: 40em; } -#photo, -#qrcode { +#profile #photo, +#profile #qrcode { /* border: 1px solid #c0c0c0; */ /* width: 40%; */ /* margin-bottom: 2.5em; */ @@ -256,15 +265,29 @@ h1 { */ } -#photo { +#profile #photo { /* object-fit: scale-down; */ } +#profile-top img { + height: 180px; + width: 180px; +} + +#profile-top #photo { + border-radius: 20px; +} + h3, h4, h5 { padding-left: 2em; padding-right: 2em; } +#titles { + padding-left: 0.5em; + padding-right: 0.5em; +} + #container-of-profile { /* margin: auto; */ padding-bottom: 0.5em; @@ -445,7 +468,7 @@ h3, h4, h5 { border: 1px solid #434a53; /* #6f7b8c */ } - #qrcode { + #profile #qrcode { filter: invert(0.9); } @@ -482,6 +505,21 @@ h3, h4, h5 { } */ +@media (max-width: 950px) { + + #action-bar > #vcard, + #profile-top img, + #number-of-pages #first, + #number-of-pages #last { + display: none; + } + + #profile-top { + justify-content: center; + } + +} + @media (max-width: 885px) { h1 { @@ -498,15 +536,15 @@ h3, h4, h5 { width: unset; } - #photo, - #qrcode { + #profile #photo, + #profile #qrcode { display: block; /* border-radius: 50px; */ margin: auto; margin-bottom: 2.5em; } - #qrcode { + #profile #qrcode { outline: solid; outline-color: #333; } @@ -578,8 +616,8 @@ h3, h4, h5 { text-shadow: unset; } - #photo, - #qrcode { + #profile #photo, + #profile #qrcode { /* height: unset; */ height: 360px; max-width: 70%; @@ -587,7 +625,7 @@ h3, h4, h5 { /* width: 360px; */ } - #photo { + #profile #photo { background: unset; } diff --git a/fasi.py b/fasi.py index e4136c5..ec3c5d4 100644 --- a/fasi.py +++ b/fasi.py @@ -109,7 +109,9 @@ class HttpInstance: message = '{}: {} (XEP-0030)'.format(jid_info['text'], jid_info['condition']) action = 'Connect with' link_href = 'xmpp:{}'.format(jid_bare) - links.append(['Connect', link_href]) + links.append({'name' : 'Connect', + 'href' : link_href, + 'iden' : 'connect'}) xmpp_uri = jid_bare elif jid_kind in ('conference', 'server'): action = 'Discover' @@ -118,7 +120,9 @@ class HttpInstance: elif jid_kind == 'server': instance = 'services' link_href = 'xmpp:{}?disco;type=get;request=items'.format(jid_bare) - links.append(['Discover', link_href]) + links.append({'name' : 'Discover', + 'href' : link_href, + 'iden' : 'discover'}) view_href = '/d/' + jid_bare xmpp_uri = jid_bare elif jid_kind in ('mix', 'muc'): @@ -127,7 +131,9 @@ class HttpInstance: action = 'Join to' instance = 'participants' link_href = 'xmpp:{}?join'.format(jid_bare) - links.append(['Join', link_href]) + links.append({'name' : 'Join', + 'href' : link_href, + 'iden' : 'join'}) view_href = '/v/' + jid_bare xmpp_uri = jid_bare # room_info = await XmppXep0045.get_room_data(xmpp_instance, jid_bare) @@ -144,21 +150,33 @@ class HttpInstance: action = 'Browse' instance = 'nodes' link_href = 'xmpp:{}?disco;type=get;request=items'.format(jid_bare) - links.append(['Browse', link_href]) + links.append({'name' : 'Browse', + 'href' : link_href, + 'iden' : 'browse'}) view_href = '/d/' + jid_bare xmpp_uri = jid_bare else: action = 'Message' instance = 'articles' link_href = 'xmpp:{}?message'.format(jid_bare) - links.append(['Add', 'xmpp:{}?roster'.format(jid_bare)]) - links.append(['Message', link_href]) + links.append({'name' : 'Add', + 'href' : 'xmpp:{}?roster'.format(jid_bare), + 'id' : 'add'}) + links.append({'name' : 'Message', + 'href' : link_href, + 'iden' : 'message'}) node_name = 'urn:xmpp:microblog:0' view_href = '/d/{}/{}'.format(jid_bare, node_name) xmpp_uri = jid_bare - links.append(['Subscribe', 'xmpp:{}?pubsub;node={};action=subscribe'.format(jid_bare, node_name)]) - links.append(['View', 'xmpp:{}?pubsub;node={}'.format(jid_bare, node_name)]) - links.append(['vCard', 'xmpp:{}?vcard'.format(jid_bare)]) + links.append({'name' : 'Subscribe', + 'href' : 'xmpp:{}?pubsub;node={};action=subscribe'.format(jid_bare, node_name), + 'iden' : 'subscribe'}) + links.append({'name' : 'View', + 'href' : 'xmpp:{}?pubsub;node={}'.format(jid_bare, node_name), + 'iden' : 'view'}) + links.append({'name' : 'vCard', + 'href' : 'xmpp:{}?vcard'.format(jid_bare), + 'iden' : 'vcard'}) # JID info # NOTE Group chat of Psi+ Project at jabber.ru has a note in its vCard. @@ -336,7 +354,9 @@ class HttpInstance: message = '{}: {} (XEP-0030)'.format(jid_info['text'], jid_info['condition']) action = 'Connect with' link_href = 'xmpp:{}'.format(jid_bare) - links.append(['Connect', link_href]) + links.append({'name' : 'Connect', + 'href' : link_href, + 'iden' : 'connect'}) xmpp_uri = jid_bare elif jid_kind in ('conference', 'server'): action = 'Discover' @@ -345,7 +365,9 @@ class HttpInstance: elif jid_kind == 'server': instance = 'services' link_href = 'xmpp:{}?disco;type=get;request=items'.format(jid_bare) - links.append(['Discover', link_href]) + links.append({'name' : 'Discover', + 'href' : link_href, + 'iden' : 'discover'}) view_href = '/d/' + jid_bare xmpp_uri = jid_bare elif jid_kind in ('mix', 'muc'): @@ -354,7 +376,9 @@ class HttpInstance: action = 'Join to' instance = 'participants' link_href = 'xmpp:{}?join'.format(jid_bare) - links.append(['Join', link_href]) + links.append({'name' : 'Join', + 'href' : link_href, + 'iden' : 'join'}) view_href = '/v/' + jid_bare xmpp_uri = jid_bare # room_info = await XmppXep0045.get_room_data(xmpp_instance, jid_bare) @@ -371,21 +395,41 @@ class HttpInstance: action = 'Browse' instance = 'nodes' link_href = 'xmpp:{}?disco;type=get;request=items'.format(jid_bare) - links.append(['Browse', link_href]) + links.append({'name' : 'Browse', + 'href' : link_href, + 'iden' : 'browse'}) view_href = '/d/' + jid_bare xmpp_uri = jid_bare else: action = 'Message' instance = 'articles' link_href = 'xmpp:{}?message'.format(jid_bare) - links.append(['Add', 'xmpp:{}?roster'.format(jid_bare)]) - links.append(['Message', link_href]) + links.append({'name' : 'Add', + 'href' : 'xmpp:{}?roster'.format(jid_bare), + 'iden' : 'add'}) + links.append({'name' : 'Add', + 'href' : link_href, + 'iden' : 'message'}) node_name = 'urn:xmpp:microblog:0' view_href = '/d/{}/{}'.format(jid_bare, node_name) xmpp_uri = jid_bare - links.append(['Subscribe', 'xmpp:{}?pubsub;node={};action=subscribe'.format(jid_bare, node_name)]) - links.append(['View', 'xmpp:{}?pubsub;node={}'.format(jid_bare, node_name)]) - links.append(['vCard', 'xmpp:{}?vcard'.format(jid_bare)]) + if item_id: + links.append({'name' : 'Subscribe', + 'href' : 'xmpp:{}?pubsub;node={};item={};action=subscribe'.format(jid_bare, node_name, item_id), + 'iden' : 'subscribe'}) + links.append({'name' : 'View', + 'href' : 'xmpp:{}?pubsub;node={};item={}'.format(jid_bare, node_name, item_id), + 'iden' : 'view'}) + else: + links.append({'name' : 'Subscribe', + 'href' : 'xmpp:{}?pubsub;node={};action=subscribe'.format(jid_bare, node_name), + 'iden' : 'subscribe'}) + links.append({'name' : 'View', + 'href' : 'xmpp:{}?pubsub;node={}'.format(jid_bare, node_name), + 'iden' : 'view'}) + links.append({'name' : 'vCard', + 'href' : 'xmpp:{}?vcard'.format(jid_bare), + 'iden' : 'vcard'}) # JID info # NOTE Group chat of Psi+ Project at jabber.ru has a note in its vCard. @@ -410,6 +454,7 @@ class HttpInstance: } # Title + # TODO /d/pubsub.nicoco.fr/blog/urn-uuid-53e43061-1962-3112-bb8a-1473dca61719 if '@' in jid_bare and node_name == 'urn:xmpp:microblog:0': node_title = 'Journal' else: @@ -1109,7 +1154,7 @@ class Syndication: instances = '' # TODO Check the Blasta database for instances. entry = {'content' : content_text, - 'link' : link_href, + 'href' : link_href, 'published' : published_text, 'summary' : summary_text, 'tags' : tags, diff --git a/xhtml/conference.xhtml b/xhtml/conference.xhtml index 739ae67..b87c361 100644 --- a/xhtml/conference.xhtml +++ b/xhtml/conference.xhtml @@ -6,7 +6,7 @@ - XMPP: {{action}} {{title}} + XMPP: {{action}} {% if title %}{{title}}{% else %}{{jid_bare}}{% endif %} @@ -36,8 +36,8 @@ {% if links %}
{% for link in links %} - - {{link[0]}} + + {{link['name']}} {% endfor %}
@@ -46,7 +46,7 @@ {% if filename %} {% endif %} - +

{% if jid_title %}{{jid_title}}{% else %}Group Chat{% endif %}

{% if jid_note %}{{jid_note}}{% else %}{{jid_bare}}{% endif %}

@@ -56,9 +56,7 @@
{% if subject %} -

- {{subject}} -

+
{{subject}}
{% endif %}
{% if messages %} @@ -89,21 +87,21 @@ {% endif %} {% if number_of_pages %}
- {% if number_of_pages > 5 %} + {% if number_of_pages > 3 %} {% if page_number < 2 %} - First + First Back {% else %} - First + First Back {% endif %} {{page_number}} {% if page_number == number_of_pages %} Proceed - Last + Last {% else %} Proceed - Last + Last {% endif %} {% else %} {% for number in range(number_of_pages) %} diff --git a/xhtml/jid.xhtml b/xhtml/jid.xhtml index c6e4c7d..9cfa8fd 100644 --- a/xhtml/jid.xhtml +++ b/xhtml/jid.xhtml @@ -92,15 +92,17 @@ Preview journal OR Preview group chat
- + {% if count or jid_kind in ('mix', 'muc') %} + + {% endif %} + Return {% endif %}