From be0cfede07b58c681765dcebee2948688f5f5cc3 Mon Sep 17 00:00:00 2001 From: Hitakshi Arora Date: Sat, 11 Jul 2026 09:34:01 +0530 Subject: [PATCH] feat(console): real-mode nav/route gating to backend-backed screens MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Real mode (VITE_DEMO_MODE unset) now exposes only the screens wired to the eERC backend — Payroll and Treasury — and lands on /treasury. The no-backend screens (Overview, Contractors, Invoices, one-off Pay, Approvals, Auditor grants, Audit log, Settings) stay demo-only: hidden from the sidebar + command bar and their routes redirect to the treasury landing; in a real build they tree-shake out entirely. Demo mode (VITE_DEMO_MODE=1) still shows the full product. A shared nav model (app/nav.ts) is the single source of truth for both the sidebar and the command palette. Epic #58 step B (final). Closes #68. --- apps/console/src/app/CommandBar.tsx | 25 ++++---- apps/console/src/app/Shell.tsx | 93 ++++++++++++++++------------- apps/console/src/app/nav.test.ts | 40 +++++++++++++ apps/console/src/app/nav.ts | 55 +++++++++++++++++ 4 files changed, 159 insertions(+), 54 deletions(-) create mode 100644 apps/console/src/app/nav.test.ts create mode 100644 apps/console/src/app/nav.ts diff --git a/apps/console/src/app/CommandBar.tsx b/apps/console/src/app/CommandBar.tsx index 73dd86c..4d1e83e 100644 --- a/apps/console/src/app/CommandBar.tsx +++ b/apps/console/src/app/CommandBar.tsx @@ -7,19 +7,22 @@ import { useEffect, useMemo, useState } from "react"; import { useNavigate } from "react-router-dom"; import { Search } from "lucide-react"; import { AnimatePresence, motion } from "framer-motion"; +import { DEMO_MODE } from "../demo/flag"; +// Jump-to targets mirror the sidebar: in real mode only the backend-backed +// screens are reachable, so the palette hides the demo-only destinations too. const DESTINATIONS = [ - { label: "Dashboard", to: "/" }, - { label: "Contractors", to: "/contractors" }, - { label: "Payroll", to: "/payroll" }, - { label: "Invoices to pay", to: "/invoices" }, - { label: "Send & vendor pay", to: "/pay" }, - { label: "Approvals", to: "/approvals" }, - { label: "Treasury", to: "/treasury" }, - { label: "Auditor grants", to: "/grants" }, - { label: "Audit log", to: "/audit" }, - { label: "Settings & team", to: "/settings" }, -]; + { label: "Dashboard", to: "/", real: false }, + { label: "Contractors", to: "/contractors", real: false }, + { label: "Payroll", to: "/payroll", real: true }, + { label: "Invoices to pay", to: "/invoices", real: false }, + { label: "Send & vendor pay", to: "/pay", real: false }, + { label: "Approvals", to: "/approvals", real: false }, + { label: "Treasury", to: "/treasury", real: true }, + { label: "Auditor grants", to: "/grants", real: false }, + { label: "Audit log", to: "/audit", real: false }, + { label: "Settings & team", to: "/settings", real: false }, +].filter((d) => DEMO_MODE || d.real); export function CommandBar() { const nav = useNavigate(); diff --git a/apps/console/src/app/Shell.tsx b/apps/console/src/app/Shell.tsx index 73bfdaa..d17806e 100644 --- a/apps/console/src/app/Shell.tsx +++ b/apps/console/src/app/Shell.tsx @@ -3,29 +3,17 @@ * (workspace switcher, ⌘K search, live network badge, mask-eye, bell, avatar), * and the routed content area with the cursor-interactive canvas behind the cards. */ -import { - ArrowUpRight, - Bell, - ChevronDown, - Eye, - EyeOff, - FileText, - LayoutDashboard, - ScrollText, - Settings, - ShieldCheck, - Users, - Wallet, - CheckCheck, -} from "lucide-react"; -import { useEffect, useRef, useState } from "react"; +import { Bell, CheckCheck, ChevronDown, Eye, EyeOff, Settings, Users } from "lucide-react"; +import { Fragment, useEffect, useRef, useState } from "react"; import { AnimatePresence, motion } from "framer-motion"; -import { NavLink, Route, Routes, useLocation, useNavigate } from "react-router-dom"; +import { NavLink, Navigate, Route, Routes, useLocation, useNavigate } from "react-router-dom"; import { StageVideo } from "../ui/StageVideo"; import { CommandBar } from "./CommandBar"; import { AvalancheMark, Logo } from "../ui/Logo"; import { NetworkMenu } from "./NetworkMenu"; import { useConsole } from "../lib/store"; +import { DEMO_MODE } from "../demo/flag"; +import { REAL_HOME, visibleNavGroups, visibleNavItems } from "./nav"; import { formatAddress } from "../lib/format"; import { Dashboard } from "../screens/Dashboard"; import { Approvals } from "../screens/Approvals"; @@ -213,21 +201,28 @@ export function Shell() { {/* body: sidebar nav + routed content */}