Show operator presence near reply box
This commit is contained in:
@@ -1194,6 +1194,25 @@ label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
|
||||
box-shadow: inset 0 0 0 2px var(--brand);
|
||||
background: #edf8f3;
|
||||
}
|
||||
.reply-operator-presence {
|
||||
width: fit-content;
|
||||
max-width: 100%;
|
||||
border: 1px solid #dfe9e4;
|
||||
border-radius: 999px;
|
||||
padding: 4px 9px;
|
||||
background: #f8fbf9;
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.reply-operator-presence.hidden { display: none; }
|
||||
.reply-operator-presence.typing {
|
||||
border-color: #f7d8a8;
|
||||
background: #fff8ed;
|
||||
color: #8a5a00;
|
||||
}
|
||||
.reply-composer {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) 44px 88px;
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
<div id="messages" class="messages"></div>
|
||||
<div id="typingNotice" class="typing hidden">Zakaznik pise...</div>
|
||||
<form id="replyForm" class="reply hidden">
|
||||
<div id="replyOperatorPresence" class="reply-operator-presence hidden"></div>
|
||||
<div class="reply-composer">
|
||||
<textarea name="message" rows="3" placeholder="Napsat odpoved..."></textarea>
|
||||
<label class="reply-icon-button attach-button" title="Pridat fotku" aria-label="Pridat fotku">
|
||||
|
||||
+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