Move cart composition from Python to .sx defcomps (Phase 5)

- render_orders_rows: Python loop building row-pairs → ~cart-orders-rows-content
  defcomp that maps over order data and handles pagination sentinel
- render_checkout_error_page: conditional order badge composition →
  ~cart-checkout-error-from-data defcomp
- Remove unused SxExpr import

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-05 01:27:54 +00:00
parent c71ca6754d
commit 0144220427
2 changed files with 25 additions and 19 deletions

View File

@@ -116,3 +116,21 @@
(defcomp ~cart-orders-rows (&key rows next-scroll)
(<> rows next-scroll))
;; Composition defcomp — replaces Python loop in render_orders_rows
(defcomp ~cart-orders-rows-content (&key orders detail-url-prefix page total-pages next-url)
(~cart-orders-rows
:rows (map (lambda (od)
(~order-row-pair :order od :detail-url-prefix detail-url-prefix))
(or orders (list)))
:next-scroll (if (< page total-pages)
(~infinite-scroll :url next-url :page page
:total-pages total-pages :id-prefix "orders" :colspan 5)
(~order-end-row))))
;; Composition defcomp — replaces conditional composition in render_checkout_error_page
(defcomp ~cart-checkout-error-from-data (&key msg order-id back-url)
(~checkout-error-content
:msg msg
:order (when order-id (~checkout-error-order-id :oid (str "#" order-id)))
:back-url back-url))