feat(PORT-004A): add workspace bootstrap and scoped settings

This commit is contained in:
Bu5hm4nn
2026-03-24 20:18:12 +01:00
parent 9d1a2f3fe8
commit 75f8e0a282
9 changed files with 335 additions and 17 deletions

View File

@@ -18,6 +18,15 @@ NAV_ITEMS: list[tuple[str, str, str]] = [
]
def nav_items(workspace_id: str | None = None) -> list[tuple[str, str, str]]:
if not workspace_id:
return NAV_ITEMS
return [
("overview", f"/{workspace_id}", "Overview"),
("settings", f"/{workspace_id}/settings", "Settings"),
]
def demo_spot_price() -> float:
return 215.0
@@ -166,7 +175,7 @@ def strategy_metrics(strategy_name: str, scenario_pct: int) -> dict[str, Any]:
@contextmanager
def dashboard_page(title: str, subtitle: str, current: str) -> Iterator[ui.column]:
def dashboard_page(title: str, subtitle: str, current: str, workspace_id: str | None = None) -> Iterator[ui.column]:
ui.colors(primary="#0f172a", secondary="#1e293b", accent="#0ea5e9")
# Header must be at page level, not inside container
@@ -179,7 +188,7 @@ def dashboard_page(title: str, subtitle: str, current: str) -> Iterator[ui.colum
ui.label("Vault Dashboard").classes("text-lg font-bold text-slate-900 dark:text-slate-50")
ui.label("NiceGUI hedging cockpit").classes("text-xs text-slate-500 dark:text-slate-400")
with ui.row().classes("items-center gap-2 max-sm:flex-wrap"):
for key, href, label in NAV_ITEMS:
for key, href, label in nav_items(workspace_id):
active = key == current
link_classes = "rounded-lg px-4 py-2 text-sm font-medium no-underline transition " + (
"bg-slate-900 text-white dark:bg-slate-100 dark:text-slate-900"