generated from t/malachite
add: user profiles and junk
This commit is contained in:
parent
6b8c33d27f
commit
2bd23f8214
28 changed files with 1139 additions and 108 deletions
|
@ -1,6 +1,6 @@
|
|||
(text "{% extends \"root.lisp\" %} {% block head %}")
|
||||
(title
|
||||
(text "My chats - {{ name }}"))
|
||||
(text "My chats — {{ config.name }}"))
|
||||
(text "{% endblock %} {% block body %}")
|
||||
(div
|
||||
("class" "flex w_full gap_2 justify_between items_center")
|
||||
|
@ -9,9 +9,10 @@
|
|||
(a
|
||||
("class" "button tab")
|
||||
("href" "/chats")
|
||||
(text "chats")))
|
||||
(text "chats")
|
||||
(text "{% if user.missed_messages_count > 0 -%}") (b (text "({{ user.missed_messages_count }})")) (text "{%- endif %}")))
|
||||
(button
|
||||
("class" "button")
|
||||
("class" "button square")
|
||||
("title" "Create chat")
|
||||
("onclick" "document.getElementById('create_dialog').showModal()")
|
||||
(text "{{ icon \"plus\" }}")))
|
||||
|
@ -21,7 +22,7 @@
|
|||
(div
|
||||
("class" "card surface w_full flex justify_between items_center gap_2")
|
||||
(a
|
||||
("class" "flex gap_ch items_center")
|
||||
("class" "flush flex gap_ch items_center {% if not user.id in chat[0].last_message_read_by -%} yellow {%- endif %}")
|
||||
("href" "/chats/{{ chat[0].id }}")
|
||||
(text "{{ components::chat_name(chat=chat[0], members=chat[1], advanced=true) }}"))
|
||||
(div
|
||||
|
@ -29,7 +30,7 @@
|
|||
(button
|
||||
("onclick" "open_dropdown(event)")
|
||||
("exclude" "dropdown")
|
||||
("class" "button")
|
||||
("class" "button icon_only big_icon")
|
||||
(text "{{ icon \"ellipsis\" }}"))
|
||||
(div
|
||||
("class" "inner")
|
||||
|
@ -39,13 +40,10 @@
|
|||
("target" "_blank")
|
||||
(text "pop open"))
|
||||
|
||||
(text "{% if chat[0].style != \"Direct\" -%}")
|
||||
; group chat only
|
||||
(button
|
||||
(a
|
||||
("class" "button")
|
||||
("onclick" "rename_gc('{{ chat[0].id }}')")
|
||||
(text "rename"))
|
||||
(text "{%- endif %}")
|
||||
("href" "/chats/{{ chat[0].id }}/manage")
|
||||
(text "manage"))
|
||||
|
||||
(button
|
||||
("class" "button red")
|
||||
|
@ -165,53 +163,7 @@
|
|||
e.target.reset();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
let search_users_timeout;
|
||||
function search_users(e) {
|
||||
if (search_users_timeout) {
|
||||
clearTimeout(search_users_timeout);
|
||||
}
|
||||
|
||||
if (e.target.value.trim().length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
search_users_timeout = setTimeout(() => {
|
||||
fetch(\"/api/v1/auth/users/search\", {
|
||||
method: \"POST\",
|
||||
headers: {
|
||||
\"Content-Type\": \"application/json\",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
prefix: e.target.value.trim(),
|
||||
}),
|
||||
})
|
||||
.then((res) => res.json())
|
||||
.then((res) => {
|
||||
if (res.ok) {
|
||||
document.getElementById(\"users_search\").innerHTML = \"\";
|
||||
for (const username of res.payload) {
|
||||
document.getElementById(\"users_search\").innerHTML += `<option value=\"${username}\">${username}</option>`;
|
||||
}
|
||||
} else {
|
||||
show_message(res.message, res.ok);
|
||||
}
|
||||
});
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
function leave_chat(id) {
|
||||
if (!confirm(\"Are you sure you would like to do this?\")) {
|
||||
return;
|
||||
}
|
||||
|
||||
fetch(`/api/v1/chats/${id}/leave`, {
|
||||
method: \"POST\",
|
||||
})
|
||||
.then((res) => res.json())
|
||||
.then((res) => {
|
||||
show_message(res.message, res.ok);
|
||||
});
|
||||
}"))
|
||||
|
||||
(script ("src" "/public/messages.js"))
|
||||
(text "{% endblock %}")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue