Initial commit: полный проект my_speaker

This commit is contained in:
2025-12-25 12:16:19 +03:00
commit 8279fbb35f
85 changed files with 6027 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
import { logout as apiLogout } from "../api.js";
export function renderHeader(pollingIntervalMs) {
// Установка имени пользователя (заглушка)
const userNameElement = document.getElementById("user-name");
if (userNameElement) {
userNameElement.textContent = "User: admin"; // Заглушка, заменить на данные из /auth/me
}
// Отображение частоты опроса
const pollingIntervalElement = document.getElementById("polling-interval");
if (pollingIntervalElement) {
pollingIntervalElement.textContent = `Polling Interval: ${
pollingIntervalMs || 1000
} ms`; // Значение по умолчанию 1000 мс
}
// Отображение текущего времени
const currentTimeElement = document.getElementById("current-time");
if (currentTimeElement) {
function updateTime() {
const now = new Date().toLocaleTimeString("ru-RU", {
timeZone: "Europe/Moscow",
hour12: false,
});
currentTimeElement.textContent = `Current Time: ${now}`;
}
updateTime(); // Инициализация
setInterval(updateTime, 1000); // Обновление каждую секунду
}
// Обработчик кнопки выхода
const logoutBtn = document.getElementById("logout-btn");
if (logoutBtn) {
logoutBtn.addEventListener("click", apiLogout);
}
}