Style hide bots as toggle
This commit is contained in:
+3
-4
@@ -322,8 +322,8 @@ $("#conversationFilter").addEventListener("change", () => {
|
||||
renderConversations();
|
||||
});
|
||||
|
||||
$("#hideBotsToggle").addEventListener("click", () => {
|
||||
state.hideBots = !state.hideBots;
|
||||
$("#hideBotsToggle").addEventListener("change", (event) => {
|
||||
state.hideBots = event.target.checked;
|
||||
localStorage.setItem("mf_admin_hide_bots", state.hideBots ? "1" : "0");
|
||||
renderVisitors();
|
||||
});
|
||||
@@ -1068,8 +1068,7 @@ function conversationVisitorName(item) {
|
||||
function renderVisitors() {
|
||||
const visitors = state.hideBots ? state.visitors.filter((visitor) => !visitor.isBot) : state.visitors;
|
||||
const botCount = state.visitors.filter((visitor) => visitor.isBot).length;
|
||||
$("#hideBotsToggle").classList.toggle("active", state.hideBots);
|
||||
$("#hideBotsToggle").textContent = state.hideBots ? "Skryt boty" : "Boty videt";
|
||||
$("#hideBotsToggle").checked = state.hideBots;
|
||||
$("#visitorCount").textContent = `${visitors.length} na webu${state.hideBots && botCount ? ` · ${botCount} bot` : ""}`;
|
||||
$("#visitorList").innerHTML = visitors.length ? visitors.map((visitor) => `
|
||||
<article class="visitor-card ${visitor.lastConversationId ? "clickable" : ""} ${visitor.lastConversationId === state.activeId ? "active" : ""} ${visitor.isBot ? "bot" : ""}" data-visitor-conversation="${escapeHtml(visitor.lastConversationId || "")}">
|
||||
|
||||
Reference in New Issue
Block a user