diff --git a/web/storyforge-web-v4/assets/app.js b/web/storyforge-web-v4/assets/app.js
index e183b8c..e590a72 100644
--- a/web/storyforge-web-v4/assets/app.js
+++ b/web/storyforge-web-v4/assets/app.js
@@ -722,14 +722,35 @@ function getScreenFromHash() {
return screenMap[next] ? next : "dashboard";
}
+function getMobileTabGroup(screenId = appState.screen) {
+ const groups = {
+ dashboard: "dashboard",
+ credits: "dashboard",
+ settings: "dashboard",
+ intake: "intake",
+ owned: "intake",
+ discovery: "discovery",
+ tracking: "discovery",
+ production: "production",
+ review: "production",
+ automation: "production",
+ playbook: "playbook",
+ strategy: "playbook",
+ "admin-workbench": "playbook"
+ };
+ return groups[screenId] || screenId || "dashboard";
+}
+
function setScreen(id, options = {}) {
const { updateHash = true } = options;
const resolvedId = screenMap[id] ? id : "dashboard";
+ const mobileGroup = getMobileTabGroup(resolvedId);
setMobileSidebarOpen(false);
appState.screen = resolvedId;
navButtons.forEach((button) => {
const active = button.dataset.screenTarget === resolvedId;
- button.classList.toggle("is-active", active);
+ const mobileGroupActive = button.classList.contains("mobile-tabbar-item") && button.dataset.screenTarget === mobileGroup;
+ button.classList.toggle("is-active", active || mobileGroupActive);
});
screens.forEach((screen) => {
screen.classList.toggle("is-active", screen.dataset.screen === resolvedId);
@@ -4359,18 +4380,36 @@ async function saveCandidateAsBenchmark(candidateIndex, relationType = "benchmar
}
function screenShell(title, subtitle, actionsHtml, bodyHtml) {
+ const actionLayout = splitPrimaryAction(actionsHtml);
return `
${escapeHtml(title)}
${escapeHtml(subtitle)}
-
${actionsHtml || ""}
+
+ ${actionLayout.primary ? `
${actionLayout.primary}
` : ""}
+ ${actionLayout.secondary ? `
${actionLayout.secondary}
` : ""}
+
${bodyHtml}
`;
}
+function splitPrimaryAction(actionsHtml) {
+ const source = String(actionsHtml || "").trim();
+ if (!source) return { primary: "", secondary: "" };
+ const actions = source
+ .split(/(?=