UI improvements on chat feature + don't send empty messages xD

This commit is contained in:
Bofh 2020-12-28 16:05:31 +01:00
parent efe1ace42a
commit 389a276542
2 changed files with 17 additions and 8 deletions

View File

@ -68,7 +68,7 @@ div#chat-compose-global {
} }
td:nth-child(3) { td:nth-child(3) {
width: 0; width: 0;
padding: 1em; padding: .6em;
} }
} }
@ -85,30 +85,35 @@ div#chat-compose-global {
button#send { button#send {
padding: .5em 1em; padding: .5em 1em;
border-radius: 100%; border-radius: 100%;
width: 3.8em; width: 3.4em;
height: 3.8em; height: 3.4em;
svg { svg {
fill: #fff; fill: #fff;
position: relative; position: relative;
left: .15em; left: .10em;
} }
} }
textarea { textarea {
background: #fff; background: #fff;
border: 10px solid #f2f2f2; border: 1px solid #cecece;
font-size: 1.2em; border-radius: 1em;
font-size: 1.1em;
color: #5b5b5b;
width: 100%; width: 100%;
min-width: 15em; min-width: 15em;
max-height: 6em; max-height: 6em;
min-height: 4.5em; min-height: 4.5em;
padding: 1em; padding: .6em;
resize: none; resize: none;
} }
textarea:focus { textarea:focus {
outline: none !important; outline: none !important;
border: 1px solid #2222224a;
color: black;
box-shadow: 1px 1px 10px #ff0154;
} }
} }
} }

View File

@ -46,6 +46,10 @@ function api_send_message(dom) {
// the status_id is the last part of our current URL // the status_id is the last part of our current URL
const status_id = fediloveApi.getChatStatusId(); const status_id = fediloveApi.getChatStatusId();
const msgText = $('div#chat-compose-global textarea').val();
if (msgText.trim() === '') {
return false;
}
// search for the reply on status_id, dictated by URL // search for the reply on status_id, dictated by URL
$('button[id*=reply-]').each(function(i) { $('button[id*=reply-]').each(function(i) {
@ -65,7 +69,7 @@ function api_send_message(dom) {
if ($(this).attr('id').includes('//'+status_id)) if ($(this).attr('id').includes('//'+status_id))
{ {
// title contains the user ID on this server // title contains the user ID on this server
var text = $(this).attr('title')+' '+$('div#chat-compose-global textarea').val(); var text = $(this).attr('title')+' '+msgText;
// set the text on thie invisible compose box of the status_id // set the text on thie invisible compose box of the status_id
$('textarea#the-compose-box-input-'+status_id).val(text); $('textarea#the-compose-box-input-'+status_id).val(text);