Skip to content
SprecherEast
Issue 135

tech-debt: Site module and shared platform: pages, header, footer, blocks; break import cycles

Back to our plan
Done
frontendcmstech-debtpriority: medium

Type

tech-debt

Summary

Group the parts that make up general site pages (the page builder, header, footer, page blocks and banners) in one place, and move the shared building blocks (buttons, inputs, images, links, dates) into a common toolkit every area uses.

Problem

  • Page-builder code is spread over blocks/, heros/, collections/Pages, Header/, Footer/, components/.
  • Generic UI (Media, Link, RichText, components/ui/*) sits beside event and news parts in components/.
  • 3 import cycles: components/RichText ↔ blocks/Banner, blocks/CallToAction, blocks/MediaBlock.
  • utilities/ mixes dates, SEO, URLs, data access, security and React hooks (28 files).

Proposed fix

  • src/modules/site/: Pages collection, header and footer globals and components, layout blocks, heroes, redirects.
  • src/platform/ui/: shadcn primitives, Media, Link, RichText (with block renderers injected, which breaks the cycles), JsonLd.
  • src/platform/lib/: dates and timezone, URLs, SEO helpers, cn.
  • Regenerate Payload's admin import map after moving admin components (https://payloadcms.com/docs/custom-components/overview, opens in a new tab).

Acceptance criteria

  • Not done: madge --circular reports no cycles.
  • Not done: src/components/, src/blocks/, src/heros/ and src/utilities/ are gone or contain only re-exports scheduled for removal.
  • Not done: Admin panel loads and edits pages; every public page renders as before (both themes, mobile and desktop).

Depends on

#132 (news), since the archive and related-posts blocks move there first. Step 10 of #127.

Area

frontend, cms

Priority

medium


Generated by Claude Code, opens in a new tab

See it on GitHub, opens in a new tab