Show operator presence near reply box
This commit is contained in:
+9
-5
@@ -1106,8 +1106,8 @@ function renderActive() {
|
||||
}
|
||||
|
||||
function renderOperatorPresence() {
|
||||
const box = $("#operatorPresence");
|
||||
if (!box || !state.activeId) return;
|
||||
const boxes = [$("#operatorPresence"), $("#replyOperatorPresence")].filter(Boolean);
|
||||
if (!boxes.length || !state.activeId) return;
|
||||
const operators = (state.operatorPresence[state.activeId] || [])
|
||||
.filter((operator) => operator.username !== state.me?.username);
|
||||
const typing = state.operatorTyping[state.activeId];
|
||||
@@ -1118,9 +1118,13 @@ function renderOperatorPresence() {
|
||||
if (typing && typing.username !== state.me?.username) {
|
||||
parts.push(`${typing.name} pise...`);
|
||||
}
|
||||
box.textContent = parts.join(" · ");
|
||||
box.classList.toggle("hidden", !parts.length);
|
||||
box.classList.toggle("typing", Boolean(typing && typing.username !== state.me?.username));
|
||||
const text = parts.join(" · ");
|
||||
const isTyping = Boolean(typing && typing.username !== state.me?.username);
|
||||
for (const box of boxes) {
|
||||
box.textContent = text;
|
||||
box.classList.toggle("hidden", !parts.length);
|
||||
box.classList.toggle("typing", isTyping);
|
||||
}
|
||||
}
|
||||
|
||||
function flashOperatorTyping(data) {
|
||||
|
||||
Reference in New Issue
Block a user