CSS : Improve the design of the graphics container;

CSS    : Improve the design of actions bar;
Python : Add multiple actions (URI Query Types).
This commit is contained in:
Schimon Jehudah, Adv. 2024-10-09 23:07:16 +03:00
parent 9668ade606
commit 43f285e008
7 changed files with 99 additions and 37 deletions

View file

@ -56,7 +56,7 @@ FASI is written in Python and utilizes Jinja2, FastAPI and Slixmpp.
FASI require an XMPP account to work, it only needs an XMPP server. FASI require an XMPP account to work, it only needs an XMPP server.
## Features ## Supported features
- MUC - MUC
- Photo - Photo
@ -65,7 +65,7 @@ FASI require an XMPP account to work, it only needs an XMPP server.
- Service Discovery - Service Discovery
- vCard - vCard
## XEP ## Supported XEP specifications
- XEP-0030: Service Discovery - XEP-0030: Service Discovery
- XEP-0045: Multi-User Chat - XEP-0045: Multi-User Chat

View file

@ -84,7 +84,7 @@ input:not(
} }
label, label,
#action, #action > a,
#exception, #exception,
#xmpp-uri, #xmpp-uri,
#preview { #preview {
@ -101,7 +101,14 @@ label,
/* padding-bottom: 1em; */ /* padding-bottom: 1em; */
} }
#action, #action > a {
display: inline-block;
font-size: 1.2em;
min-width: 90px;
padding: 0.5em;
width: 15%;
}
#download, #download,
#input { #input {
border-radius: 26px; border-radius: 26px;
@ -109,17 +116,21 @@ label,
padding: 0.5em; padding: 0.5em;
} }
#action {
margin-bottom: 1em;
}
#action, #action,
#input { #input {
background: #13b5ea; /* #002b5c */ background: #13b5ea; /* #002b5c */
} }
#action:hover, #action > a:hover,
#input:hover { #input:hover {
background: #1b3967; background: #1b3967;
} }
#action, #action > a,
#download, #download,
#download-narrow, #download-narrow,
#input { #input {
@ -181,12 +192,16 @@ h1 {
} }
*/ */
#graphics,
#photo {
border-radius: 50px;
}
#graphics { #graphics {
background: #f2f2f2; background: #f2f2f2;
border: 1px solid #c0c0c0; border: 1px solid #c0c0c0;
border-radius: 50px;
margin: auto; margin: auto;
max-width: 80%; max-width: 560px; /* 80% */
padding: 15px; padding: 15px;
width: 40em; width: 40em;
} }
@ -217,6 +232,11 @@ h3, h4, h5 {
padding-right: 2em; padding-right: 2em;
} }
#container-of-profile {
/* margin: auto; */
padding-bottom: 0.5em;
}
#profile { #profile {
background: #f5f5f5; background: #f5f5f5;
border-radius: 30px; border-radius: 30px;
@ -346,11 +366,6 @@ h3, h4, h5 {
filter: drop-shadow(2px 4px 6px grey); /* TODO Reverse color */ filter: drop-shadow(2px 4px 6px grey); /* TODO Reverse color */
} }
#message {
background: #fbfbfe;
}
#message,
#note { #note {
color: #2b2a33; color: #2b2a33;
} }
@ -386,7 +401,7 @@ h3, h4, h5 {
} }
*/ */
@media (max-width: 870px) { @media (max-width: 885px) {
h1 { h1 {
margin-bottom: 1em; margin-bottom: 1em;
@ -405,11 +420,16 @@ h3, h4, h5 {
#photo, #photo,
#qrcode { #qrcode {
display: block; display: block;
border-radius: 50px; /* border-radius: 50px; */
margin: auto; margin: auto;
margin-bottom: 2.5em; margin-bottom: 2.5em;
} }
#qrcode {
outline: solid;
outline-color: #333;
}
} }
@media (max-width: 725px) { @media (max-width: 725px) {
@ -437,6 +457,10 @@ h3, h4, h5 {
display: unset; display: unset;
} }
#container-of-profile {
padding-bottom: unset;
}
#profile { #profile {
border-radius: unset; border-radius: unset;
filter: unset; filter: unset;
@ -448,6 +472,24 @@ h3, h4, h5 {
width: unset; width: unset;
} }
#action {
background: unset;
}
#action > a {
background: #13b5ea; /* #002b5c */
}
#action > a:first-child {
border-bottom-left-radius: 2em;
border-top-left-radius: 2em;
}
#action > a:last-child {
border-bottom-right-radius: 2em;
border-top-right-radius: 2em;
}
#note { #note {
display: block; display: block;
font-weight: unset; font-weight: unset;
@ -477,3 +519,16 @@ h3, h4, h5 {
} }
} }
@media (max-width: 572px) {
#action > a:nth-child(2) {
border-bottom-right-radius: 2em;
border-top-right-radius: 2em;
}
#action > a:nth-child(3) {
display: none;
}
}

26
fasi.py
View file

@ -324,19 +324,21 @@ class HttpInstance:
jid_info = await XmppXep0030.get_jid_info(xmpp_instance, jid_bare) jid_info = await XmppXep0030.get_jid_info(xmpp_instance, jid_bare)
jid_info_iq = jid_info['iq'] jid_info_iq = jid_info['iq']
jid_kind = jid_info['kind'] jid_kind = jid_info['kind']
links = []
if jid_info['error']: if jid_info['error']:
message = '{}: {} (XEP-0030)'.format(jid_info['text'], jid_info['condition']) message = '{}: {} (XEP-0030)'.format(jid_info['text'], jid_info['condition'])
action = 'Connect with' action = 'Connect with'
link_text = 'Connect'
link_href = 'xmpp:{}'.format(jid_bare) link_href = 'xmpp:{}'.format(jid_bare)
links.append(['Connect', link_href])
xmpp_uri = jid_bare xmpp_uri = jid_bare
elif jid_kind in ('conference', 'server'): elif jid_kind in ('conference', 'server'):
action = link_text = 'Discover' action = 'Discover'
if jid_kind == 'conference': if jid_kind == 'conference':
instance = 'conferences' instance = 'conferences'
elif jid_kind == 'server': elif jid_kind == 'server':
instance = 'services' instance = 'services'
link_href = 'xmpp:{}?disco;type=get;request=items'.format(jid_bare) link_href = 'xmpp:{}?disco;type=get;request=items'.format(jid_bare)
links.append(['Discover', link_href])
view_href = '/d/' + jid_bare view_href = '/d/' + jid_bare
xmpp_uri = jid_bare xmpp_uri = jid_bare
elif jid_kind in ('mix', 'muc'): elif jid_kind in ('mix', 'muc'):
@ -344,8 +346,8 @@ class HttpInstance:
# TODO Set group chat subject as description. # TODO Set group chat subject as description.
action = 'Join to' action = 'Join to'
instance = 'participants' instance = 'participants'
link_text = 'Join'
link_href = 'xmpp:{}?join'.format(jid_bare) link_href = 'xmpp:{}?join'.format(jid_bare)
links.append(['Join', link_href])
view_href = '/v/' + jid_bare view_href = '/v/' + jid_bare
xmpp_uri = jid_bare xmpp_uri = jid_bare
# room_info = await XmppXep0045.get_room_data(xmpp_instance, jid_bare) # room_info = await XmppXep0045.get_room_data(xmpp_instance, jid_bare)
@ -355,23 +357,28 @@ class HttpInstance:
if node_name: if node_name:
action = 'Subscribe to' action = 'Subscribe to'
instance = 'articles' instance = 'articles'
link_text = 'Subscribe'
link_href = 'xmpp:{}?pubsub;node={};action=subscribe'.format(jid_bare, node_name) link_href = 'xmpp:{}?pubsub;node={};action=subscribe'.format(jid_bare, node_name)
links.append(['Subscribe', link_href])
links.append(['View', 'xmpp:{}?pubsub;node={}'.format(jid_bare, node_name)])
view_href = '/d/{}/{}'.format(jid_bare, node_name) view_href = '/d/{}/{}'.format(jid_bare, node_name)
xmpp_uri = '{}?;node={}'.format(jid_bare, node_name) xmpp_uri = '{}?;node={}'.format(jid_bare, node_name)
else: else:
action = link_text = 'Browse' action = 'Browse'
instance = 'nodes' instance = 'nodes'
link_href = 'xmpp:{}?disco;type=get;request=items'.format(jid_bare) link_href = 'xmpp:{}?disco;type=get;request=items'.format(jid_bare)
links.append(['Browse', link_href])
view_href = '/d/' + jid_bare view_href = '/d/' + jid_bare
xmpp_uri = jid_bare xmpp_uri = jid_bare
else: else:
action = link_text = 'Message' action = 'Message'
instance = 'articles' instance = 'articles'
link_href = 'xmpp:{}?message'.format(jid_bare) link_href = 'xmpp:{}?message'.format(jid_bare)
links.append(['Add', 'xmpp:{}?roster'.format(jid_bare)])
links.append(['Message', link_href])
node_name = 'urn:xmpp:microblog:0' node_name = 'urn:xmpp:microblog:0'
view_href = '/d/{}/{}'.format(jid_bare, node_name) view_href = '/d/{}/{}'.format(jid_bare, node_name)
xmpp_uri = jid_bare xmpp_uri = jid_bare
links.append(['vCard', 'xmpp:{}?vcard'.format(jid_bare)])
# JID item count # JID item count
count = None count = None
@ -479,7 +486,7 @@ class HttpInstance:
action = 'Error' action = 'Error'
title = 'Slixmpp error' title = 'Slixmpp error'
xmpp_uri = jid xmpp_uri = jid
count = filename = jid_bare = jid_kind = link_href = link_text = message = selection = url = None count = filename = jid_bare = jid_kind = links = message = selection = url = None
template_file = 'jid.xhtml' template_file = 'jid.xhtml'
template_dict = { template_dict = {
@ -490,8 +497,7 @@ class HttpInstance:
'filename' : filename, 'filename' : filename,
'jid_bare' : jid_bare, 'jid_bare' : jid_bare,
'jid_kind' : jid_kind, 'jid_kind' : jid_kind,
'link_href' : link_href, 'links' : links,
'link_text' : link_text,
'message' : message, 'message' : message,
'note' : note, 'note' : note,
'request' : request, 'request' : request,
@ -672,7 +678,7 @@ class Graphics:
#qrcode_graphics = qrcode.make(text) #qrcode_graphics = qrcode.make(text)
qr = qrcode.QRCode(border=2, box_size=10) qr = qrcode.QRCode(border=2, box_size=10)
qr.add_data(text) qr.add_data(text)
qrcode_graphics = qr.make_image(fill_color='#000', back_color='#f2f2f2') qrcode_graphics = qr.make_image(fill_color='#333', back_color='#f2f2f2')
qrcode_graphics.save('qr/{}.png'.format(jid_bare)) qrcode_graphics.save('qr/{}.png'.format(jid_bare))
class Syndication: class Syndication:

View file

@ -111,8 +111,8 @@
{% endif %} {% endif %}
<!-- % if mix or muc % --> <!-- % if mix or muc % -->
{% if link_href %} {% if link_href %}
<div> <div id="action">
<a id="action" href="{{link_href}}"> <a href="{{link_href}}">
{{link_text}} {{link_text}}
</a> </a>
</div> </div>

View file

@ -84,12 +84,13 @@
<code>{{exception}}</code> <code>{{exception}}</code>
</div> </div>
{% endif %} {% endif %}
<!-- % if mix or muc % --> {% if links %}
{% if link_href %} <div id="action">
<div> {% for link in links %}
<a id="action" href="{{link_href}}"> <a href="{{link[1]}}">
{{link_text}} {{link[0]}}
</a> </a>
{% endfor %}
</div> </div>
{% endif %} {% endif %}
<!-- div> <!-- div>

View file

@ -80,8 +80,8 @@
{% endif %} {% endif %}
<!-- % if mix or muc % --> <!-- % if mix or muc % -->
{% if link_href %} {% if link_href %}
<div> <div id="action">
<a id="action" href="{{link_href}}"> <a href="{{link_href}}">
{{link_text}} {{link_text}}
</a> </a>
</div> </div>

View file

@ -49,8 +49,8 @@
<code>{{exception}}</code> <code>{{exception}}</code>
</div> </div>
{% endif %} {% endif %}
<div> <div id="action">
<a id="action" href="/">Main</a> <a href="/">Main</a>
</div> </div>
<div> <div>
<a href="https://xmpp.org"> <a href="https://xmpp.org">