feat(layout): per-route page-meta registry + resolver#1147
Open
psdjungpulzze wants to merge 1 commit into
Open
feat(layout): per-route page-meta registry + resolver#1147psdjungpulzze wants to merge 1 commit into
psdjungpulzze wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_LABELSlogic that lived inpage-bar.tsx. This is the architectural core that later content/UI tasks build on.What landed
src/components/layout/page-meta.ts):PageMeta = { title: string; subtitle: string; guide: GuideContent }GuideContent = { summary: string; actions?: string[]; tips?: string[] }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.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 aPageMeta(never null); falls back toSEGMENT_LABELStitle + empty subtitle/guide for unseeded routes.resolvePageTitle(pathname)— title-only convenience wrapper.SEGMENT_LABELSmoved intopage-metaas the canonical title fallback; re-exported frompage-bar.tsxfor backward compatibility.inferTitlenow delegates toresolvePageTitle.Route levels handled (parity with old
inferTitle)/o/[org]/p/[project]/<page>/.../o/[org]/<page>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.tsxsuite (unchanged, still green).Tests
New
src/components/layout/page-meta.test.tscovers 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