import { qs } from "./dom.js"; export function showToast(message, type = "info") { const toast = document.createElement("div"); toast.className = `toast ${type}`; toast.textContent = message; qs("#toastRegion").appendChild(toast); setTimeout(() => toast.remove(), 3600); } export function setServiceStatus(online) { const statusChip = qs("#globalStatus"); statusChip.textContent = online ? "服务运行正常" : "服务连接异常"; statusChip.className = `status-chip ${online ? "status-online" : "status-offline"}`; qs("#sidebarStatus").textContent = online ? "服务在线" : "服务离线"; qs("#sidebarStatusDot").className = `status-dot ${online ? "is-online" : "is-offline"}`; const readyApi = qs("#readyApi"); readyApi.textContent = online ? "正常" : "异常"; readyApi.className = online ? "ready" : "not-ready"; } export function setChannelReady(element, enabled) { element.textContent = enabled ? "已启用" : "未配置"; element.className = enabled ? "ready" : "optional"; } export function updateClock() { qs("#currentClock").textContent = new Date().toLocaleString("zh-CN", { hour12: false, month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", }); }