Skip to content

Routing and Navigation

  1. src/app/page.tsx
  • Server checks session with getServerSession().
  • Redirects authenticated users to /app.
  • Redirects unauthenticated users to /logout.
  1. src/app/app/layout.tsx
  • Fetches user modules (getUserModules) server-side.
  • Passes initial modules into ClientShell.
  1. src/app/app/page.tsx
  • Renders MainView with initial module home.
  1. src/app/app/[module]/page.tsx
  • Delegates module rendering to Handle.

Handle (src/components/Handle.tsx) ensures requested module is accessible:

  • Reads allowed module buttons from useModuleAccess().
  • Allows system modules via sysModuleMap.
  • Calls notFound() when module is not accessible.
  • Updates current tab with setCurrentTab(module).

TabProvider owns:

  • currentTab: ModuleKey
  • setCurrentTab(key)
  • availableTabs

Tab state powers sidebar highlighting and module-local behavior.

  • NavSidebar and CommandBar consume module buttons from useModuleAccess().
  • Buttons are generated from filtered moduleRegistry data.
  • Parent modules can expose child add-ons (children).

Use routes for page entry and deep-linking. Use tab/context state for in-app module switching behavior.