remember tab added
This commit is contained in:
parent
2c4ba19b71
commit
688712e6da
@ -20,6 +20,7 @@ import {
|
|||||||
// --- STATE MANAGEMENT ---
|
// --- STATE MANAGEMENT ---
|
||||||
let user = null;
|
let user = null;
|
||||||
let authToken = null;
|
let authToken = null;
|
||||||
|
let lastAdminTab = 'overview';
|
||||||
|
|
||||||
// --- EVENT HANDLERS (The "Logic") ---
|
// --- EVENT HANDLERS (The "Logic") ---
|
||||||
async function handleAuthSubmit(e) {
|
async function handleAuthSubmit(e) {
|
||||||
@ -304,6 +305,25 @@ function setupTabbedInterface() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setupTabbedInterface() {
|
||||||
|
const tabsContainer = document.getElementById('admin-tabs-nav');
|
||||||
|
const contentContainer = document.getElementById('admin-tabs-content');
|
||||||
|
|
||||||
|
if (!tabsContainer || !contentContainer) return;
|
||||||
|
|
||||||
|
tabsContainer.addEventListener('click', (e) => {
|
||||||
|
const clickedTab = e.target.closest('.tab-btn');
|
||||||
|
if (!clickedTab) return;
|
||||||
|
|
||||||
|
const tabTarget = clickedTab.dataset.tab;
|
||||||
|
|
||||||
|
// --- 2. ADD THIS LINE to update our variable ---
|
||||||
|
lastAdminTab = tabTarget;
|
||||||
|
|
||||||
|
// ... (the rest of the function stays the same) ...
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// --- START THE APP ---
|
// --- START THE APP ---
|
||||||
// Register the service worker for PWA functionality
|
// Register the service worker for PWA functionality
|
||||||
if ('serviceWorker' in navigator) {
|
if ('serviceWorker' in navigator) {
|
||||||
|
|||||||
@ -211,6 +211,16 @@ export async function renderAdminDashboard() {
|
|||||||
adminTimerIntervals.push(intervalId);
|
adminTimerIntervals.push(intervalId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (lastAdminTab && lastAdminTab !== 'overview') {
|
||||||
|
// Remove active state from the default tab and panel
|
||||||
|
document.querySelector('.tab-btn[data-tab="overview"]').classList.remove('active-tab');
|
||||||
|
document.getElementById('tab-content-overview').classList.add('hidden');
|
||||||
|
|
||||||
|
// Add active state to the last viewed tab and panel
|
||||||
|
document.querySelector(`.tab-btn[data-tab="${lastAdminTab}"]`).classList.add('active-tab');
|
||||||
|
document.getElementById(`tab-content-${lastAdminTab}`).classList.remove('hidden');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function renderArchiveView() {
|
export function renderArchiveView() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user