Files
rose-ash/market/sx/layouts.sx
giles b0920a1121 Rename all 1,169 components to path-based names with namespace support
Component names now reflect filesystem location using / as path separator
and : as namespace separator for shared components:
  ~sx-header → ~layouts/header
  ~layout-app-body → ~shared:layout/app-body
  ~blog-admin-dashboard → ~admin/dashboard

209 files, 4,941 replacements across all services.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 22:00:12 +00:00

139 lines
5.9 KiB
Plaintext

;; Market layout defcomps — fully self-contained via IO primitives.
;; Registered via register_sx_layout in layouts.py.
;; ---------------------------------------------------------------------------
;; Auto-fetching market header macro
;; ---------------------------------------------------------------------------
(defmacro ~market-header-auto (oob)
"Market header row using (market-header-ctx)."
(quasiquote
(let ((__mctx (market-header-ctx)))
(~shared:layout/menu-row-sx :id "market-row" :level 2
:link-href (get __mctx "link-href")
:link-label-content (~headers/shop-label
:title (get __mctx "market-title")
:top-slug (get __mctx "top-slug")
:sub-div (get __mctx "sub-slug"))
:nav (~headers/desktop-nav-from-data
:categories (get __mctx "categories")
:hx-select (get __mctx "hx-select")
:select-colours (get __mctx "select-colours")
:all-href (get __mctx "all-href")
:all-active (get __mctx "all-active")
:admin-href (get __mctx "admin-href"))
:child-id "market-header-child"
:oob (unquote oob)))))
;; ---------------------------------------------------------------------------
;; OOB clear helpers
;; ---------------------------------------------------------------------------
(defcomp ~layouts/clear-oob ()
"Clear OOB divs for browse level."
(<>
(~shared:layout/clear-oob-div :id "product-admin-row")
(~shared:layout/clear-oob-div :id "product-admin-header-child")
(~shared:layout/clear-oob-div :id "product-row")
(~shared:layout/clear-oob-div :id "product-header-child")
(~shared:layout/clear-oob-div :id "market-admin-row")
(~shared:layout/clear-oob-div :id "market-admin-header-child")
(~shared:layout/clear-oob-div :id "post-admin-row")
(~shared:layout/clear-oob-div :id "post-admin-header-child")))
(defcomp ~layouts/clear-oob-admin ()
"Clear OOB divs for admin level."
(<>
(~shared:layout/clear-oob-div :id "product-admin-row")
(~shared:layout/clear-oob-div :id "product-admin-header-child")
(~shared:layout/clear-oob-div :id "product-row")
(~shared:layout/clear-oob-div :id "product-header-child")))
;; ---------------------------------------------------------------------------
;; Browse layout: root + post + market (self-contained)
;; ---------------------------------------------------------------------------
(defcomp ~layouts/browse-layout-full ()
(<> (~root-header-auto)
(~shared:layout/header-child-sx
:inner (<> (~post-header-auto nil)
(~market-header-auto nil)))))
(defcomp ~layouts/browse-layout-oob ()
(<> (~post-header-auto true)
(~shared:layout/oob-header-sx :parent-id "post-header-child"
:row (~market-header-auto nil))
(~layouts/clear-oob)
(~root-header-auto true)))
(defcomp ~layouts/browse-layout-mobile ()
(let ((__mctx (market-header-ctx)))
(get __mctx "mobile-nav")))
;; ---------------------------------------------------------------------------
;; Market admin layout: root + post + market + post-admin (self-contained)
;; ---------------------------------------------------------------------------
(defcomp ~layouts/admin-layout-full (&key selected)
(<> (~root-header-auto)
(~shared:layout/header-child-sx
:inner (<> (~post-header-auto nil)
(~market-header-auto nil)
(~post-admin-header-auto nil selected)))))
(defcomp ~layouts/admin-layout-oob (&key selected)
(<> (~market-header-auto true)
(~shared:layout/oob-header-sx :parent-id "market-header-child"
:row (~post-admin-header-auto nil selected))
(~layouts/clear-oob-admin)
(~root-header-auto true)))
;; ---------------------------------------------------------------------------
;; Parameterized defcomps — used by renders.py (non-defpage routes)
;; ---------------------------------------------------------------------------
;; Product layout: root + post + market + product
(defcomp ~layouts/product-layout-full (&key post-header market-header product-header)
(<> (~root-header-auto)
(~shared:layout/header-child-sx :inner (<> post-header market-header product-header))))
;; Product admin layout: root + post + market + product + admin
(defcomp ~layouts/product-admin-layout-full (&key post-header market-header product-header admin-header)
(<> (~root-header-auto)
(~shared:layout/header-child-sx :inner (<> post-header market-header product-header admin-header))))
;; OOB wrappers — compose headers + clear divs in sx (no Python concatenation)
(defcomp ~layouts/oob-wrap (&key parts)
(<> parts))
(defcomp ~layouts/clear-product-oob ()
"Clear admin-level OOB divs when rendering product detail."
(<>
(~shared:layout/clear-oob-div :id "product-admin-row")
(~shared:layout/clear-oob-div :id "product-admin-header-child")
(~shared:layout/clear-oob-div :id "market-admin-row")
(~shared:layout/clear-oob-div :id "market-admin-header-child")
(~shared:layout/clear-oob-div :id "post-admin-row")
(~shared:layout/clear-oob-div :id "post-admin-header-child")))
(defcomp ~layouts/clear-product-admin-oob ()
"Clear deeper OOB divs when rendering product admin."
(<>
(~shared:layout/clear-oob-div :id "market-admin-row")
(~shared:layout/clear-oob-div :id "market-admin-header-child")
(~shared:layout/clear-oob-div :id "post-admin-row")
(~shared:layout/clear-oob-div :id "post-admin-header-child")))
(defcomp ~layouts/product-oob (&key market-header oob-header)
"Product detail OOB: market header + product header + clear deeper."
(<> market-header oob-header (~layouts/clear-product-oob)))
(defcomp ~layouts/product-admin-oob (&key product-header oob-header)
"Product admin OOB: product header + admin header + clear deeper."
(<> product-header oob-header (~layouts/clear-product-admin-oob)))
;; Content wrappers
(defcomp ~layouts/content-padded (&key content)
(<> content (div :class "pb-8")))