From 389a276542491b989289f8547ab5e51bd3412414 Mon Sep 17 00:00:00 2001 From: Bastard Operator Date: Mon, 28 Dec 2020 16:05:31 +0100 Subject: [PATCH] UI improvements on chat feature + don't send empty messages xD --- src/scss/themes/ozark.scss | 19 ++++++++++++------- static/fedilove-no-react.js | 6 +++++- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/scss/themes/ozark.scss b/src/scss/themes/ozark.scss index 743be740..c37b3976 100644 --- a/src/scss/themes/ozark.scss +++ b/src/scss/themes/ozark.scss @@ -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; } } } diff --git a/static/fedilove-no-react.js b/static/fedilove-no-react.js index 446016db..567ea7f8 100644 --- a/static/fedilove-no-react.js +++ b/static/fedilove-no-react.js @@ -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);