Skip to content

feat(layout): per-route page-meta registry + resolver#1147

Open
psdjungpulzze wants to merge 1 commit into
mainfrom
feat/page-meta-registry
Open

feat(layout): per-route page-meta registry + resolver#1147
psdjungpulzze wants to merge 1 commit into
mainfrom
feat/page-meta-registry

Conversation

@psdjungpulzze

Copy link
Copy Markdown
Contributor

Summary

Foundation/data layer for standardized page headers. Introduces a central registry that maps every app route to standardized header content, superseding the ad-hoc inferTitle / SEGMENT_LABELS logic that lived in page-bar.tsx. This is the architectural core that later content/UI tasks build on.

What landed

  • Types (src/components/layout/page-meta.ts):
    • PageMeta = { title: string; subtitle: string; guide: GuideContent }
    • GuideContent = { summary: string; actions?: string[]; tips?: string[] }
  • Registry PAGE_META, keyed by a normalized route key, seeded with representative routes across all three levels (project / org / top-level). Bulk content is intentionally deferred to a follow-up task.
  • Resolver:
    • toRouteKey(pathname) — normalizes a pathname to { key, segment, level }, replacing dynamic org/project slugs with [org]/[project] and collapsing deeper sub-paths onto the page segment.
    • resolvePageMeta(pathname) — always returns a PageMeta (never null); falls back to SEGMENT_LABELS title + empty subtitle/guide for unseeded routes.
    • resolvePageTitle(pathname) — title-only convenience wrapper.
  • SEGMENT_LABELS moved into page-meta as the canonical title fallback; re-exported from page-bar.tsx for backward compatibility. inferTitle now delegates to resolvePageTitle.

Route levels handled (parity with old inferTitle)

  • Project: /o/[org]/p/[project]/<page>/...
  • Org: /o/[org]/<page>
  • Top-level: dashboard, help, settings, organizations, notifications (last segment)

Behavior

No visible UI change — title sourcing continues to work exactly as before. Verified by the existing tests/unit/components/page-bar.test.tsx suite (unchanged, still green).

Tests

New src/components/layout/page-meta.test.ts covers route normalization at all three levels, registry hits, label fallback, raw-segment fallback, root handling, and registry integrity. npm run typecheck, eslint, and license-header check all pass.

Agent config

No PM Agent update needed — this is an internal header-content data layer with no agent-visible tools, entities, or workflows.

🤖 Generated with Claude Code

Introduce a central registry mapping app routes to standardized header
content, superseding the ad-hoc inferTitle/SEGMENT_LABELS logic in
page-bar.tsx.

- Add PageMeta { title, subtitle, guide } and GuideContent types
- Add PAGE_META registry seeded with representative routes across all
  three levels (project / org / top-level); bulk content lands later
- Add toRouteKey() normalizer + resolvePageMeta()/resolvePageTitle()
- Move SEGMENT_LABELS into page-meta as the canonical title fallback;
  re-export from page-bar; inferTitle now delegates to resolvePageTitle
- Unit coverage of route matching, registry hits, and fallbacks

No visible UI change: title sourcing continues to work unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant