Move events/market/blog composition from Python to .sx defcomps (Phase 9)
Some checks failed
Build and Deploy / build-and-deploy (push) Failing after 2m33s
Some checks failed
Build and Deploy / build-and-deploy (push) Failing after 2m33s
Continues the pattern of eliminating Python sx_call tree-building in favour of data-driven .sx defcomps. POST/PUT/DELETE routes now pass plain data (dicts, lists, scalars) and let .sx handle iteration, conditionals, and layout via map/let/when/if. Single response components wrap OOB swaps. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -43,3 +43,17 @@
|
||||
(defcomp ~market-cart-add-oob (&key id content inner)
|
||||
(div :id id :sx-swap-oob "outerHTML"
|
||||
(if content content (when inner inner))))
|
||||
|
||||
;; Cart added response — composes cart mini + add/remove OOB in sx
|
||||
(defcomp ~market-cart-added-response (&key has-count cart-href blog-href logo
|
||||
slug action csrf quantity minus-val plus-val)
|
||||
(<>
|
||||
(if has-count
|
||||
(~market-cart-mini-count :href cart-href :count (str has-count))
|
||||
(~market-cart-mini-empty :href blog-href :logo logo))
|
||||
(~market-cart-add-oob :id (str "cart-add-" slug)
|
||||
:inner (if (= (or quantity "0") "0")
|
||||
(~market-cart-add-empty :cart-id (str "cart-" slug) :action action :csrf csrf)
|
||||
(~market-cart-add-quantity :cart-id (str "cart-" slug) :action action :csrf csrf
|
||||
:minus-val minus-val :plus-val plus-val
|
||||
:quantity quantity :cart-href cart-href)))))
|
||||
|
||||
Reference in New Issue
Block a user