update admin light/dark mode

This commit is contained in:
naukyy
2026-06-13 00:31:36 +07:00
parent 2c123f5af2
commit 1c96173d55
28 changed files with 2703 additions and 775 deletions
@@ -5,6 +5,32 @@
<div class="toast-container" id="toastContainer"></div>
<script>
// ── Theme toggle ──
(function() {
const html = document.documentElement;
const saved = localStorage.getItem('portal-theme') || 'dark';
setAdminTheme(saved);
document.addEventListener('DOMContentLoaded', function() {
const btn = document.getElementById('adminThemeToggle');
const icon = document.getElementById('adminThemeIcon');
if (!btn) return;
btn.addEventListener('click', () => {
const next = html.getAttribute('data-theme') === 'dark' ? 'light' : 'dark';
setAdminTheme(next);
localStorage.setItem('portal-theme', next);
});
function updateIcon() {
if (icon) icon.className = html.getAttribute('data-theme') === 'dark' ? 'fas fa-sun' : 'fas fa-moon';
}
updateIcon();
});
function setAdminTheme(t) {
html.setAttribute('data-theme', t);
const icon = document.getElementById('adminThemeIcon');
if (icon) icon.className = t === 'dark' ? 'fas fa-sun' : 'fas fa-moon';
}
})();
// ── Clock ──
function updateClock() {
const now = new Date();