Component boundaries, interfaces, services and dependencies for the shell: footer, back-to-top, skip link, status pages, page intro, shared RouterLink, content folder and navigation module. Includes the answered design questions and the revised site content requirement. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2.6 KiB
2.6 KiB
Services — frontend-shell
There is no back-end or service layer in this SPA. The cross-cutting "services" the shell relies on are configuration-level and listed here with how they are orchestrated.
Routing service (TanStack Router)
- Configured in:
main.tsx(createRouter) androutes/__root.tsx(createRootRoute) - Responsibilities:
- File-based route tree, including the four new placeholder routes.
- Scroll restoration (
scrollRestoration: true): a new navigation starts at the top, and back/forward restores the previous position (FR-08). - Not found: the root route's
notFoundComponent: NotFound. For an unknown URL, the root component (AppShell) keeps rendering andNotFoundappears in its<Outlet>, so the shell stays visible. Verified in@tanstack/react-routerMatch.js: a global not-found renders through the root match'sOutlet. - Errors:
defaultErrorComponent: ErrorPageon the router, pluserrorComponent: ErrorPageon the root.- An error in a page route is caught at that page's match, inside the shell.
- An error in the shell itself falls back to the root's boundary and renders
ErrorPagewithout the shell. This is a deliberate fail-safe (SECURITY-15).
Head management service
- Configured in:
seo.tsand each route'shead; rendered byHeadContentin the root layout - Responsibilities:
- Per-page title and description via
pageHead; site-wide Open Graph tags viasiteHead. - The 404 page sets its own title plus
robots: noindex. A global not-found has no route of its own whoseheadcould do this, so the mechanism is settled in Functional Design.
- Per-page title and description via
Content provisioning
- Today: static modules in
content/(siteContent,heroContent) - Orchestration (application design Q3 = A):
AppShellimportssiteContentand passes it toFooter.- The home route passes
heroContentandsiteContent.socialstoHero. - Components never import content themselves.
- Later: the import points (
AppShell, the home route) are replaced by route loaders or API calls. The components and types stay the same.
Scroll state
useScrolledPastis the one scroll-listening primitive (passive listener). It is used byNavigationBar(150px threshold) andBackToTop(60% of the viewport).
Theme service (Chakra system)
theme.tswithcreateSystem(defaultConfig, config)- New and overridden recipes are merged into Chakra's default config. Components consume them through
Link variant="subtle",SkipNavLink,useRecipe({ key: 'iconControl' })andLinkButton.