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) {
width: 0;
padding: 1em;
padding: .6em;
}
}
@ -85,30 +85,35 @@ div#chat-compose-global {
button#send {
padding: .5em 1em;
border-radius: 100%;
width: 3.8em;
height: 3.8em;
width: 3.4em;
height: 3.4em;
svg {
fill: #fff;
position: relative;
left: .15em;
left: .10em;
}
}
textarea {
background: #fff;
border: 10px solid #f2f2f2;
font-size: 1.2em;
border: 1px solid #cecece;
border-radius: 1em;
font-size: 1.1em;
color: #5b5b5b;
width: 100%;
min-width: 15em;
max-height: 6em;
min-height: 4.5em;
padding: 1em;
padding: .6em;
resize: none;
}
textarea:focus {
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
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
$('button[id*=reply-]').each(function(i) {
@ -65,7 +69,7 @@ function api_send_message(dom) {
if ($(this).attr('id').includes('//'+status_id))
{
// 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
$('textarea#the-compose-box-input-'+status_id).val(text);