Routing and Navigation
Routing and Navigation
Section titled “Routing and Navigation”Route Flow
Section titled “Route Flow”src/app/page.tsx
- Server checks session with
getServerSession(). - Redirects authenticated users to
/app. - Redirects unauthenticated users to
/logout.
src/app/app/layout.tsx
- Fetches user modules (
getUserModules) server-side. - Passes initial modules into
ClientShell.
src/app/app/page.tsx
- Renders
MainViewwith initial modulehome.
src/app/app/[module]/page.tsx
- Delegates module rendering to
Handle.
Module Access Guard
Section titled “Module Access Guard”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).
Tab State
Section titled “Tab State”TabProvider owns:
currentTab: ModuleKeysetCurrentTab(key)availableTabs
Tab state powers sidebar highlighting and module-local behavior.
Sidebar + Command Bar Navigation
Section titled “Sidebar + Command Bar Navigation”NavSidebarandCommandBarconsume module buttons fromuseModuleAccess().- Buttons are generated from filtered
moduleRegistrydata. - Parent modules can expose child add-ons (
children).
Practical Rule
Section titled “Practical Rule”Use routes for page entry and deep-linking. Use tab/context state for in-app module switching behavior.