Analytics URL & Section Routing
Analytics uses the URL as the source of truth for which section is visible.
Routes
- Base route:
/analytics/:section? - Supported
:sectionvalues are implemented in the page orchestrator:overviewpricinginventoryfinance
If the segment is missing or unknown, the app falls back to
overview.
Where it lives
- Route declaration:
frontend/src/routes/AppRouter.tsx(/analytics/:section?) - Section parsing + rendering:
frontend/src/pages/analytics/Analytics.tsx - Tabs:
frontend/src/pages/analytics/components/AnalyticsNav.tsx
How section selection works
- The router provides the optional segment via
useParams(). Analytics.tsxnormalizes it to anAnalyticsSection.AnalyticsNavreceives the current section and renders MUI<Tabs>.- When a tab is clicked,
AnalyticsNavnavigates to/analytics/<section>.
Conceptual flow
flowchart LR
URL["/analytics/:section?"] --> Params[useParams().section]
Params --> Normalize[normalize → overview|pricing|inventory|finance]
Normalize --> Nav[AnalyticsNav (Tabs)]
Nav -->|onChange| Navigate[navigate("/analytics/")]
Normalize --> Blocks[Render blocks for section]
Design notes
- The sections are designed to be deep-linkable (bookmark/share URLs).
- Blocks are isolated by section so adding a new section is
mostly:
- extend the
AnalyticsSectionunion - add a
<Tab>inAnalyticsNav - add a conditional block group in
Analytics.tsx
- extend the