Update frontend for presets, tabs, and help

Align frontend with new preset ID usage and shortened driver fields, improve tab/preset interactions, and refine help and editor UI.
This commit is contained in:
2026-01-28 23:27:50 +13:00
parent 5fdeb57b74
commit fd37183400
4 changed files with 183 additions and 77 deletions

View File

@@ -20,7 +20,20 @@ async function loadTabs() {
const data = await response.json();
// Get current tab from cookie first, then from server response
currentTabId = getCurrentTabFromCookie() || data.current_tab_id;
const cookieTabId = getCurrentTabFromCookie();
const serverCurrent = data.current_tab_id;
const tabs = data.tabs || {};
const tabIds = Object.keys(tabs);
let candidateId = cookieTabId || serverCurrent || null;
// If the candidate doesn't exist anymore (e.g. after DB reset), fall back to first tab.
if (candidateId && !tabIds.includes(String(candidateId))) {
candidateId = tabIds.length > 0 ? tabIds[0] : null;
// Clear stale cookie
document.cookie = 'current_tab=; path=/; max-age=0';
}
currentTabId = candidateId;
renderTabsList(data.tabs, data.tab_order, currentTabId);
// Load current tab content if available