Update Chat Mobile

This commit is contained in:
anhkha2003 2023-09-25 01:57:07 -05:00
parent bd8d7848b9
commit c02538bc57
8 changed files with 54 additions and 63 deletions

View file

@ -182,6 +182,9 @@ header {
cursor: pointer; cursor: pointer;
padding: 3.5px; padding: 3.5px;
} }
img {
border-radius: 50%;
}
} }
#nav-shadow { #nav-shadow {
@ -539,7 +542,11 @@ math {
@media (max-width: 799px) { @media (max-width: 799px) {
#navigation { #navigation {
height: 36px; height: $navbar_height_mobile;
}
#content {
margin-top: $navbar_height_mobile;
} }
#navicon { #navicon {
@ -637,11 +644,11 @@ math {
} }
#chat-icon { #chat-icon {
color: $theme_color; color: darkgreen;
} }
#chat-icon:hover { #chat-icon:hover {
color: green; color: $theme_color;
} }
#nav-lang-icon { #nav-lang-icon {

View file

@ -115,21 +115,6 @@
position: relative; position: relative;
z-index: 100; z-index: 100;
} }
#refresh-button {
padding: 0;
margin-left: auto;
margin-right: 0.3em;
background: transparent;
border: none;
height: 1.5em;
width: 1.5em;
}
#refresh-button:hover {
background: lightgreen;
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
transition: 1.5s ease-in-out;
}
.status-pic { .status-pic {
height: 32px; height: 32px;
width: 32px; width: 32px;
@ -186,10 +171,11 @@
color: white; color: white;
} }
.chat-input-icon { .chat-input-icon {
color: $theme_color; color: white;
background-color: #3c8262;
} }
.chat-input-icon:hover { .chat-input-icon:hover {
background: lightgray; background: #57b28b;
} }
.chat { .chat {
.active-span { .active-span {
@ -233,6 +219,6 @@
@media (max-width: 799px) { @media (max-width: 799px) {
#chat-area { #chat-area {
height: calc(100vh - 120px); height: calc(100vh - $navbar_height_mobile);
} }
} }

View file

@ -1,7 +1,7 @@
@import "vars"; @import "vars";
.list-contest { .list-contest {
box-shadow: 0px 4px 8px rgba(4, 83, 67, 0.2), 0px 6px 20px rgba(4, 83, 67, 0.19); box-shadow: 0px 1px 2px lightgrey, 0px 1px 5px lightgrey;
border-radius: 15px; border-radius: 15px;
padding: 20px; padding: 20px;
margin-bottom: 20px; margin-bottom: 20px;

View file

@ -12,3 +12,4 @@ $table_header_rounding: 6px;
$monospace-fonts: Consolas, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", Monaco, "Courier New", Courier, monospace; $monospace-fonts: Consolas, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", Monaco, "Courier New", Courier, monospace;
$navbar_height: 50px; $navbar_height: 50px;
$navbar_height_mobile: 36px;

View file

@ -59,17 +59,8 @@
{% block body %} {% block body %}
<div class="chat"> <div class="chat">
<div id="mobile" class="tabs">
<ul>
<li id="chat-tab" class="tab active"><a href="#">
<i class="tab-icon fa fa-comments"></i> {{ _('Chat') }}
</a></li>
<li id="online-tab" class="tab"><a href="#"><i class="tab-icon fa fa-wifi"></i> {{ _('Online Users') }}</a></li>
</ul>
</div>
<div id="chat-container"> <div id="chat-container">
<div id="chat-online" class="chat-right-panel sidebox"> <div id="chat-online" class="chat-left-panel sidebox">
<div id="chat-online-content"> <div id="chat-online-content">
<div id="search-container"> <div id="search-container">
<form id="chat-search-form" name="form" action="{{ url('get_or_create_room') }}" method="post"> <form id="chat-search-form" name="form" action="{{ url('get_or_create_room') }}" method="post">
@ -83,7 +74,7 @@
</div> </div>
</div> </div>
</div> </div>
<div id="chat-area" class="chat-left-panel"> <div id="chat-area" class="chat-right-panel">
<div id="chat-info"> <div id="chat-info">
{% include 'chat/user_online_status.html' %} {% include 'chat/user_online_status.html' %}
</div> </div>

View file

@ -6,6 +6,7 @@
#content { #content {
padding-top: 0; padding-top: 0;
margin-bottom: 0;
} }
::-webkit-scrollbar { ::-webkit-scrollbar {
@ -197,21 +198,25 @@
#chat-area { #chat-area {
padding-bottom: 1.5em; padding-bottom: 1.5em;
} }
.back-button {
display: none;
}
} }
@media (max-width: 799px) { @media (max-width: 799px) {
html, body { html, body {
max-width: 100%; max-width: 100%;
overflow-x: hidden; overflow-x: hidden;
} }
#mobile ul {
width: 100%;
}
.info-pic {
margin-left: 0.5em;
}
.active-span { .active-span {
display: none; display: none;
} }
#chat-area {
display: none;
}
.back-button {
margin-right: 1em;
font-size: 1.5em;
}
} }
</style> </style>
{% endcompress %} {% endcompress %}

View file

@ -279,6 +279,21 @@
$("#click_space_" + window.other_user_id).addClass("selected-status-row"); $("#click_space_" + window.other_user_id).addClass("selected-status-row");
} }
function show_right_panel() {
if (isMobile) {
$('.chat-left-panel').hide();
$('#chat-area').css('display', 'flex');
$('#chat-box').scrollTop($('#chat-box')[0].scrollHeight);
}
}
function hide_right_panel() {
if (isMobile) {
$('.chat-left-panel').show();
$('#chat-area').hide();
}
}
function load_room(encrypted_user) { function load_room(encrypted_user) {
if (window.lock_click_space) return; if (window.lock_click_space) return;
@ -288,6 +303,7 @@
update_last_seen(); update_last_seen();
refresh_status(); refresh_status();
$('#chat-input').focus(); $('#chat-input').focus();
show_right_panel();
} }
window.lock_click_space = true; window.lock_click_space = true;
if (encrypted_user) { if (encrypted_user) {
@ -314,6 +330,7 @@
function register_click_space() { function register_click_space() {
$('.click_space').on('click', function(e) { $('.click_space').on('click', function(e) {
if ($(this).attr('id') == 'click_space_' + window.other_user_id) { if ($(this).attr('id') == 'click_space_' + window.other_user_id) {
show_right_panel();
return; return;
} }
var other_user = $(this).attr('value'); var other_user = $(this).attr('value');
@ -323,10 +340,10 @@
if (window.room_id) { if (window.room_id) {
load_room(null); load_room(null);
} }
else {
show_right_panel();
}
}); });
if (isMobile) {
$('#chat-tab a').click();
}
} }
function update_last_seen() { function update_last_seen() {
@ -439,26 +456,6 @@
return true return true
}); });
$('#chat-tab').find('a').click(function (e) {
e.preventDefault();
$('#chat-tab').addClass('active');
$('#online-tab').removeClass('active');
$('.chat-left-panel').show();
$('.chat-right-panel').hide();
});
$('#online-tab').find('a').click(function (e) {
e.preventDefault();
$('#online-tab').addClass('active');
$('#chat-tab').removeClass('active');
$('.chat-left-panel').hide();
$('.chat-right-panel').show();
});
$('#refresh-button').on('click', function(e) {
e.preventDefault();
refresh_status();
});
setInterval(refresh_status, 2 * 60 * 1000); setInterval(refresh_status, 2 * 60 * 1000);
$('#chat-box').scrollTop($('#chat-box')[0].scrollHeight); $('#chat-box').scrollTop($('#chat-box')[0].scrollHeight);
@ -466,7 +463,7 @@
const button = document.querySelector('#emoji-button'); const button = document.querySelector('#emoji-button');
const tooltip = document.querySelector('.tooltip'); const tooltip = document.querySelector('.tooltip');
Popper.createPopper(button, tooltip, { Popper.createPopper(button, tooltip, {
placement: 'left-end', placement: isMobile ? 'auto-end' : 'left-end',
}); });
function toggleEmoji() { function toggleEmoji() {
@ -567,6 +564,7 @@
$(this).css('height', '80%'); $(this).css('height', '80%');
} }
}); });
$('#submit-button').on('click', submit_chat); $('#submit-button').on('click', submit_chat);
}); });
</script> </script>

View file

@ -1,3 +1,6 @@
<div onclick="hide_right_panel()" class="back-button">
<i class="fa fa-arrow-left"></i>
</div>
{% if other_user %} {% if other_user %}
<div class="status-container" style="height: 3em; width: 3em;"> <div class="status-container" style="height: 3em; width: 3em;">
<img src="{{ gravatar(other_user, 135) }}" class="info-pic"> <img src="{{ gravatar(other_user, 135) }}" class="info-pic">