// U-008: hash-based client-side router (no History API / server catch-all // needed). U-022 adds the first real page, #/setup (v_project_setup, 02-V // §2.1); U-023 adds #/goals/new and #/bugs/new -- everything else is still // a PH3 placeholder. // 02-V's console has no multi-project switcher UI (decision 2), but // c_task_create/c_bug_report_create both require project_id (03-C §3.1; // §3.1.1 doesn't list it, but needs it too -- see bug_record.py's // create_bug_report docstring). Until v_dashboard (U-025) exists to carry // "current project" state, the id picked/created in v_project_setup is // stashed here and read back by the pages that need it. const CURRENT_PROJECT_KEY = "graphlemon_project_id"; function getCurrentProjectId() { return localStorage.getItem(CURRENT_PROJECT_KEY); } function setCurrentProjectId(projectId) { localStorage.setItem(CURRENT_PROJECT_KEY, projectId); } const routes = { "#/": { render: () => "
placeholder -- real content is PH3 (v_dashboard, U-025)
" }, "#/tasks": { render: () => "placeholder -- real content is PH3 (v_task_board, U-025)
" }, "#/settings": { render: () => "placeholder -- real content is PH3 (U-030)
" }, "#/setup": { render: renderProjectSetup, mount: mountProjectSetup }, "#/goals/new": { render: renderGoalComposer, mount: mountGoalComposer }, "#/bugs/new": { render: renderBugFeedback, mount: mountBugFeedback }, }; function render() { const hash = window.location.hash || "#/"; const route = routes[hash] || { render: () => "" + hash + "
" }; document.getElementById("app").innerHTML = route.render(); if (route.mount) route.mount(); for (const a of document.querySelectorAll("#nav a")) { a.classList.toggle("active", a.getAttribute("href") === hash); } } window.addEventListener("hashchange", render); window.addEventListener("DOMContentLoaded", render); // ---- v_project_setup (02-V §2.1): create/switch project ---- function renderProjectSetup() { return `" + body.task_id + "(" + body.status + ")。"
+ '返回仪表盘';
successBox.style.display = "block";
});
}
// ---- v_bug_feedback (02-V §2.4): report a bug ----
function renderBugFeedback() {
if (!getCurrentProjectId()) return renderNoProjectSelected();
return `
" + body.bug_id + ")。"
+ '返回仪表盘';
successBox.style.display = "block";
});
}