Merge branch 'worktree-macros-essays' into macros
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 3m22s

This commit is contained in:
2026-03-04 14:50:20 +00:00
4 changed files with 55 additions and 18 deletions

View File

@@ -1,9 +1,12 @@
;; Account layout defcomps — read ctx values from env free variables.
;; Registered via register_sx_layout("account", ...) in __init__.py.
;; Free variables come from _ctx_to_env() in shared/sx/helpers.py.
;; Full page: root header + auth header row in header-child
(defcomp ~account-layout-full ()
(<> (~root-header)
(<> (~root-header :cart-mini cart-mini :blog-url blog-url :site-title site-title
:app-label app-label :nav-tree nav-tree :auth-menu auth-menu
:nav-panel nav-panel :settings-url settings-url :is-admin is-admin)
(~header-child-sx
:inner (~auth-header-row :account-url account-url
:select-colours select-colours
@@ -15,7 +18,10 @@
:select-colours select-colours
:account-nav account-nav
:oob true)
(~root-header :oob true)))
(~root-header :cart-mini cart-mini :blog-url blog-url :site-title site-title
:app-label app-label :nav-tree nav-tree :auth-menu auth-menu
:nav-panel nav-panel :settings-url settings-url :is-admin is-admin
:oob true)))
;; Mobile menu: auth section + root nav
(defcomp ~account-layout-mobile ()
@@ -24,4 +30,4 @@
:items (~auth-nav-items :account-url account-url
:select-colours select-colours
:account-nav account-nav))
(~root-mobile)))
(~root-mobile :nav-tree nav-tree :auth-menu auth-menu)))

View File

@@ -3,7 +3,9 @@
;; Full page: root header + social header in header-child
(defcomp ~social-layout-full ()
(<> (~root-header)
(<> (~root-header :cart-mini cart-mini :blog-url blog-url :site-title site-title
:app-label app-label :nav-tree nav-tree :auth-menu auth-menu
:nav-panel nav-panel :settings-url settings-url :is-admin is-admin)
(~header-child-sx
:inner (~federation-social-header
:nav (~federation-social-nav :actor actor)))))
@@ -14,4 +16,7 @@
:parent-id "root-header-child"
:row (~federation-social-header
:nav (~federation-social-nav :actor actor)))
(~root-header :oob true)))
(~root-header :cart-mini cart-mini :blog-url blog-url :site-title site-title
:app-label app-label :nav-tree nav-tree :auth-menu auth-menu
:nav-panel nav-panel :settings-url settings-url :is-admin is-admin
:oob true)))

View File

@@ -4,7 +4,9 @@
;; --- orders layout: root + auth + orders rows ---
(defcomp ~orders-layout-full (&key list-url)
(<> (~root-header)
(<> (~root-header :cart-mini cart-mini :blog-url blog-url :site-title site-title
:app-label app-label :nav-tree nav-tree :auth-menu auth-menu
:nav-panel nav-panel :settings-url settings-url :is-admin is-admin)
(~header-child-sx
:inner (<> (~auth-header-row :account-url account-url
:select-colours select-colours
@@ -19,15 +21,20 @@
(~oob-header-sx
:parent-id "auth-header-child"
:row (~orders-header-row :list-url (or list-url "/")))
(~root-header :oob true)))
(~root-header :cart-mini cart-mini :blog-url blog-url :site-title site-title
:app-label app-label :nav-tree nav-tree :auth-menu auth-menu
:nav-panel nav-panel :settings-url settings-url :is-admin is-admin
:oob true)))
(defcomp ~orders-layout-mobile ()
(~root-mobile))
(~root-mobile :nav-tree nav-tree :auth-menu auth-menu))
;; --- order-detail layout: root + auth + orders + order rows ---
(defcomp ~order-detail-layout-full (&key list-url detail-url)
(<> (~root-header)
(<> (~root-header :cart-mini cart-mini :blog-url blog-url :site-title site-title
:app-label app-label :nav-tree nav-tree :auth-menu auth-menu
:nav-panel nav-panel :settings-url settings-url :is-admin is-admin)
(~order-detail-header-stack
:auth (~auth-header-row :account-url account-url
:select-colours select-colours
@@ -43,7 +50,10 @@
:row (~menu-row-sx :id "order-row" :level 3 :colour "sky"
:link-href (or detail-url "/") :link-label "Order"
:icon "fa fa-gbp" :oob true))
(~root-header :oob true)))
(~root-header :cart-mini cart-mini :blog-url blog-url :site-title site-title
:app-label app-label :nav-tree nav-tree :auth-menu auth-menu
:nav-panel nav-panel :settings-url settings-url :is-admin is-admin
:oob true)))
(defcomp ~order-detail-layout-mobile ()
(~root-mobile))
(~root-mobile :nav-tree nav-tree :auth-menu auth-menu))

View File

@@ -146,24 +146,40 @@
(when auth-menu
(div :class "p-3 border-t border-stone-200" auth-menu))))
;; ---------------------------------------------------------------------------
;; Root header/mobile shorthand — pass-through to shared defcomps.
;; All values must be supplied as &key args (not free variables) because
;; nested component calls in _aser are serialized without expansion.
;; ---------------------------------------------------------------------------
(defcomp ~root-header (&key cart-mini blog-url site-title app-label
nav-tree auth-menu nav-panel settings-url is-admin oob)
(~header-row-sx :cart-mini cart-mini :blog-url blog-url :site-title site-title
:app-label app-label :nav-tree nav-tree :auth-menu auth-menu
:nav-panel nav-panel :settings-url settings-url :is-admin is-admin
:oob oob))
(defcomp ~root-mobile (&key nav-tree auth-menu)
(~mobile-root-nav :nav-tree nav-tree :auth-menu auth-menu))
;; ---------------------------------------------------------------------------
;; Built-in layout defcomps — used by register_sx_layout("root", ...)
;; Free variables (cart-mini, blog-url, etc.) come from _ctx_to_env().
;; ---------------------------------------------------------------------------
(defcomp ~layout-root-full ()
(~header-row-sx :cart-mini cart-mini :blog-url blog-url :site-title site-title
:app-label app-label :nav-tree nav-tree :auth-menu auth-menu
:nav-panel nav-panel :settings-url settings-url :is-admin is-admin))
(~root-header :cart-mini cart-mini :blog-url blog-url :site-title site-title
:app-label app-label :nav-tree nav-tree :auth-menu auth-menu
:nav-panel nav-panel :settings-url settings-url :is-admin is-admin))
(defcomp ~layout-root-oob ()
(~oob-header-sx :parent-id "root-header-child"
:row (~header-row-sx :cart-mini cart-mini :blog-url blog-url :site-title site-title
:app-label app-label :nav-tree nav-tree :auth-menu auth-menu
:nav-panel nav-panel :settings-url settings-url :is-admin is-admin)))
:row (~root-header :cart-mini cart-mini :blog-url blog-url :site-title site-title
:app-label app-label :nav-tree nav-tree :auth-menu auth-menu
:nav-panel nav-panel :settings-url settings-url :is-admin is-admin)))
(defcomp ~layout-root-mobile ()
(~mobile-root-nav :nav-tree nav-tree :auth-menu auth-menu))
(~root-mobile :nav-tree nav-tree :auth-menu auth-menu))
(defcomp ~error-content (&key errnum message image)
(div :class "text-center p-8 max-w-lg mx-auto"