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

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:
2026-03-05 08:17:09 +00:00
parent 877e776977
commit 51ebf347ba
23 changed files with 1841 additions and 1423 deletions

View File

@@ -82,3 +82,42 @@
(div :class "flex-1 min-w-0"
(div :class "font-medium truncate" name)
(div :class "text-xs text-stone-600 truncate" time-str))))
;; Day table from data — all row iteration in sx
(defcomp ~events-day-table-from-data (&key list-container pre-action add-url tr-cls pill-cls rows)
(~events-day-table
:list-container list-container
:rows (if (empty? (or rows (list)))
(~events-day-empty-row)
(<> (map (lambda (r)
(~events-day-row
:tr-cls tr-cls
:name (~events-day-row-name
:href (get r "href") :pill-cls pill-cls :name (get r "name"))
:slot (if (get r "slot-name")
(~events-day-row-slot
:href (get r "slot-href") :pill-cls pill-cls
:slot-name (get r "slot-name") :time-str (get r "slot-time"))
(~events-day-row-time :start (get r "start") :end (get r "end")))
:state (~events-day-row-state
:state-id (get r "state-id")
:badge (~entry-state-badge :state (get r "state")))
:cost (~events-day-row-cost :cost-str (get r "cost-str"))
:tickets (if (get r "has-tickets")
(~events-day-row-tickets
:price-str (get r "price-str") :count-str (get r "count-str"))
(~events-day-row-no-tickets))
:actions (~events-day-row-actions)))
(or rows (list)))))
:pre-action pre-action :add-url add-url))
;; Day entries nav OOB from data
(defcomp ~events-day-entries-nav-oob-from-data (&key nav-btn entries)
(if (empty? (or entries (list)))
(~events-day-entries-nav-oob-empty)
(~events-day-entries-nav-oob
:items (<> (map (lambda (e)
(~events-day-nav-entry
:href (get e "href") :nav-btn nav-btn
:name (get e "name") :time-str (get e "time-str")))
entries)))))