Improve chat UX
This commit is contained in:
parent
b6f998a235
commit
9d1f71513e
2 changed files with 12 additions and 3 deletions
|
@ -24,6 +24,8 @@ let message_template = `
|
|||
window.other_user_id = "{{other_user.id if other_user else ''}}";
|
||||
window.num_pages = {{paginator.num_pages}};
|
||||
window.lock = false;
|
||||
window.lock_click_space = false;
|
||||
let isMobile = window.matchMedia("only screen and (max-width: 799px)").matches;
|
||||
|
||||
function load_page(page, refresh_html=false) {
|
||||
var param = {
|
||||
|
@ -296,6 +298,8 @@ let message_template = `
|
|||
}
|
||||
|
||||
function load_room(encrypted_user) {
|
||||
if (window.lock_click_space) return;
|
||||
|
||||
function callback() {
|
||||
history.replaceState(null, '', "{{url('chat', '')}}" + window.room_id);
|
||||
load_page(window.currentPage, true, refresh_status);
|
||||
|
@ -303,6 +307,7 @@ let message_template = `
|
|||
refresh_status();
|
||||
$('#chat-input').focus();
|
||||
}
|
||||
window.lock_click_space = true;
|
||||
if (encrypted_user) {
|
||||
$.get("{{url('get_or_create_room')}}" + `?other=${encrypted_user}`)
|
||||
.done(function(data) {
|
||||
|
@ -321,6 +326,7 @@ let message_template = `
|
|||
window.other_user_id = '';
|
||||
callback();
|
||||
}
|
||||
window.lock_click_space = false;
|
||||
}
|
||||
|
||||
function register_click_space() {
|
||||
|
@ -336,6 +342,9 @@ let message_template = `
|
|||
load_room(null);
|
||||
}
|
||||
});
|
||||
if (isMobile) {
|
||||
$('#chat-tab a').click();
|
||||
}
|
||||
}
|
||||
|
||||
function update_last_seen() {
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
</div>
|
||||
<ul class="status-list toggled">
|
||||
{% for user in section.user_list %}
|
||||
<li class="status-row">
|
||||
<li class="click_space status-row" id="click_space_{{user.user.id}}" value="{{user.url}}">
|
||||
<div class="status-container">
|
||||
<img src="{{ gravatar(user.user, 135) }}" class="status-pic">
|
||||
<svg style="position:absolute;" height="32" width="32">
|
||||
|
@ -28,9 +28,9 @@
|
|||
</svg>
|
||||
</div>
|
||||
<span style="padding-left:0.3em" class="username {{ user.user.css_class }}">
|
||||
{{ link_user(user.user) }}
|
||||
{{ user.user.username }}
|
||||
</span>
|
||||
<span class="click_space spacer" value="{{user.url}}" id="click_space_{{user.user.id}}">
|
||||
<span class="spacer">
|
||||
<span class="unread-count" id="unread-count-{{user.user.id}}">{{user.unread_count if user.unread_count}}</span>
|
||||
</span>
|
||||
</li>
|
||||
|
|
Loading…
Reference in a new issue