Replace env free-variable threading with IO-primitive auto-fetch macros
Layout components now self-resolve context (cart-mini, auth-menu, nav-tree, rights, URLs) via new IO primitives (root-header-ctx, select-colours, account-nav-ctx, app-rights) and defmacro wrappers (~root-header-auto, ~auth-header-row-auto, ~root-mobile-auto). This eliminates _ctx_to_env(), HELPER_CSS_CLASSES, and verbose :key threading across all 10 services. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,44 +1,30 @@
|
||||
;; Orders layout defcomps — read ctx values from env free variables.
|
||||
;; Orders layout defcomps — fully self-contained via IO primitives.
|
||||
;; Registered via register_sx_layout("orders", ...) in __init__.py.
|
||||
|
||||
;; --- orders layout: root + auth + orders rows ---
|
||||
|
||||
(defcomp ~orders-layout-full (&key list-url)
|
||||
(<> (~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)
|
||||
(<> (~root-header-auto)
|
||||
(~header-child-sx
|
||||
:inner (<> (~auth-header-row :account-url account-url
|
||||
:select-colours select-colours
|
||||
:account-nav account-nav)
|
||||
:inner (<> (~auth-header-row-auto)
|
||||
(~orders-header-row :list-url (or list-url "/"))))))
|
||||
|
||||
(defcomp ~orders-layout-oob (&key list-url)
|
||||
(<> (~auth-header-row :account-url account-url
|
||||
:select-colours select-colours
|
||||
:account-nav account-nav
|
||||
:oob true)
|
||||
(<> (~auth-header-row-auto true)
|
||||
(~oob-header-sx
|
||||
:parent-id "auth-header-child"
|
||||
:row (~orders-header-row :list-url (or list-url "/")))
|
||||
(~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)))
|
||||
(~root-header-auto true)))
|
||||
|
||||
(defcomp ~orders-layout-mobile ()
|
||||
(~root-mobile :nav-tree nav-tree :auth-menu auth-menu))
|
||||
(~root-mobile-auto))
|
||||
|
||||
;; --- order-detail layout: root + auth + orders + order rows ---
|
||||
|
||||
(defcomp ~order-detail-layout-full (&key list-url detail-url)
|
||||
(<> (~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)
|
||||
(<> (~root-header-auto)
|
||||
(~order-detail-header-stack
|
||||
:auth (~auth-header-row :account-url account-url
|
||||
:select-colours select-colours
|
||||
:account-nav account-nav)
|
||||
:auth (~auth-header-row-auto)
|
||||
:orders (~orders-header-row :list-url (or list-url "/"))
|
||||
:order (~menu-row-sx :id "order-row" :level 3 :colour "sky"
|
||||
:link-href (or detail-url "/") :link-label "Order"
|
||||
@@ -50,10 +36,7 @@
|
||||
: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 :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)))
|
||||
(~root-header-auto true)))
|
||||
|
||||
(defcomp ~order-detail-layout-mobile ()
|
||||
(~root-mobile :nav-tree nav-tree :auth-menu auth-menu))
|
||||
(~root-mobile-auto))
|
||||
|
||||
Reference in New Issue
Block a user