Adopt Step 7 language features across SX codebase
112 conversions across 19 .sx files using match, let-match, and pipe operators: match (17): type/value dispatch replacing cond/if chains - lib/vm.sx: HO form dispatch (for-each/map/filter/reduce/some/every?) - lib/tree-tools.sx: node-display, node-matches?, rename, count, replace, free-symbols - lib/types.sx: narrow-type, substitute-in-type, infer-type, resolve-type - web/engine.sx: default-trigger, resolve-target, classify-trigger - web/deps.sx: scan-refs-walk, scan-io-refs-walk let-match (89): dict destructuring replacing (get d "key") patterns - shared/page-functions.sx (20), blog/admin.sx (17), pub-api.sx (13) - events/ layouts/page/tickets/entries/forms (27 total) - specs-explorer.sx (7), federation/social.sx (3), lib/ small files (3) -> pipes (6): replacing triple-chained gets in lib/vm.sx - frame-closure → closure-code → code-bytecode chains Also: lib/vm.sx accessor upgrades (get vm "sp" → vm-sp vm throughout) 2650/2650 tests pass, zero regressions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -211,18 +211,28 @@
|
||||
;; ---------------------------------------------------------------------------
|
||||
|
||||
;; My tickets panel from data
|
||||
(defcomp ~tickets/panel-from-data (&key (list-container :as string) (tickets :as list?))
|
||||
(defcomp
|
||||
~tickets/panel-from-data
|
||||
(&key (list-container :as string) (tickets :as list?))
|
||||
(~tickets/panel
|
||||
:list-container list-container
|
||||
:has-tickets (not (empty? (or tickets (list))))
|
||||
:cards (<> (map (lambda (t)
|
||||
(~tickets/card
|
||||
:href (get t "href") :entry-name (get t "entry-name")
|
||||
:type-name (get t "type-name") :time-str (get t "time-str")
|
||||
:cal-name (get t "cal-name")
|
||||
:badge (~entries/ticket-state-badge :state (get t "state"))
|
||||
:code-prefix (get t "code-prefix")))
|
||||
(or tickets (list))))))
|
||||
:cards (<>
|
||||
(map
|
||||
(lambda
|
||||
(t)
|
||||
(let-match
|
||||
{:time-str time-str :href href :type-name type-name :code-prefix code-prefix :entry-name entry-name :cal-name cal-name :state state}
|
||||
t
|
||||
(~tickets/card
|
||||
:href href
|
||||
:entry-name entry-name
|
||||
:type-name type-name
|
||||
:time-str time-str
|
||||
:cal-name cal-name
|
||||
:badge (~entries/ticket-state-badge :state state)
|
||||
:code-prefix code-prefix)))
|
||||
(or tickets (list))))))
|
||||
|
||||
;; Ticket detail from data — uses lg badge variant
|
||||
(defcomp ~tickets/detail-from-data (&key (list-container :as string) (back-href :as string) (header-bg :as string) (entry-name :as string)
|
||||
@@ -256,54 +266,106 @@
|
||||
(true nil))))
|
||||
|
||||
;; Ticket admin panel from data
|
||||
(defcomp ~tickets/admin-panel-from-data (&key (list-container :as string) (lookup-url :as string) (tickets :as list?)
|
||||
(total :as number?) (confirmed :as number?) (checked-in :as number?) (reserved :as number?))
|
||||
(defcomp
|
||||
~tickets/admin-panel-from-data
|
||||
(&key
|
||||
(list-container :as string)
|
||||
(lookup-url :as string)
|
||||
(tickets :as list?)
|
||||
(total :as number?)
|
||||
(confirmed :as number?)
|
||||
(checked-in :as number?)
|
||||
(reserved :as number?))
|
||||
(~tickets/admin-panel
|
||||
:list-container list-container
|
||||
:stats (<>
|
||||
(~tickets/admin-stat :border "border-stone-200" :bg ""
|
||||
:text-cls "text-stone-900" :label-cls "text-stone-500"
|
||||
:value (str (or total 0)) :label "Total")
|
||||
(~tickets/admin-stat :border "border-emerald-200" :bg "bg-emerald-50"
|
||||
:text-cls "text-emerald-700" :label-cls "text-emerald-600"
|
||||
:value (str (or confirmed 0)) :label "Confirmed")
|
||||
(~tickets/admin-stat :border "border-blue-200" :bg "bg-blue-50"
|
||||
:text-cls "text-blue-700" :label-cls "text-blue-600"
|
||||
:value (str (or checked-in 0)) :label "Checked In")
|
||||
(~tickets/admin-stat :border "border-amber-200" :bg "bg-amber-50"
|
||||
:text-cls "text-amber-700" :label-cls "text-amber-600"
|
||||
:value (str (or reserved 0)) :label "Reserved"))
|
||||
(~tickets/admin-stat
|
||||
:border "border-stone-200"
|
||||
:bg ""
|
||||
:text-cls "text-stone-900"
|
||||
:label-cls "text-stone-500"
|
||||
:value (str (or total 0))
|
||||
:label "Total")
|
||||
(~tickets/admin-stat
|
||||
:border "border-emerald-200"
|
||||
:bg "bg-emerald-50"
|
||||
:text-cls "text-emerald-700"
|
||||
:label-cls "text-emerald-600"
|
||||
:value (str (or confirmed 0))
|
||||
:label "Confirmed")
|
||||
(~tickets/admin-stat
|
||||
:border "border-blue-200"
|
||||
:bg "bg-blue-50"
|
||||
:text-cls "text-blue-700"
|
||||
:label-cls "text-blue-600"
|
||||
:value (str (or checked-in 0))
|
||||
:label "Checked In")
|
||||
(~tickets/admin-stat
|
||||
:border "border-amber-200"
|
||||
:bg "bg-amber-50"
|
||||
:text-cls "text-amber-700"
|
||||
:label-cls "text-amber-600"
|
||||
:value (str (or reserved 0))
|
||||
:label "Reserved"))
|
||||
:lookup-url lookup-url
|
||||
:has-tickets (not (empty? (or tickets (list))))
|
||||
:rows (<> (map (lambda (t)
|
||||
(~tickets/admin-row-from-data
|
||||
:code (get t "code") :code-short (get t "code-short")
|
||||
:entry-name (get t "entry-name") :date-str (get t "date-str")
|
||||
:type-name (get t "type-name") :state (get t "state")
|
||||
:checkin-url (get t "checkin-url") :csrf (get t "csrf")
|
||||
:checked-in-time (get t "checked-in-time")))
|
||||
(or tickets (list))))))
|
||||
:rows (<>
|
||||
(map
|
||||
(lambda
|
||||
(t)
|
||||
(let-match
|
||||
{:date-str date-str :csrf csrf :type-name type-name :code-short code-short :entry-name entry-name :code code :checkin-url checkin-url :checked-in-time checked-in-time :state state}
|
||||
t
|
||||
(~tickets/admin-row-from-data
|
||||
:code code
|
||||
:code-short code-short
|
||||
:entry-name entry-name
|
||||
:date-str date-str
|
||||
:type-name type-name
|
||||
:state state
|
||||
:checkin-url checkin-url
|
||||
:csrf csrf
|
||||
:checked-in-time checked-in-time)))
|
||||
(or tickets (list))))))
|
||||
|
||||
;; Entry tickets admin from data
|
||||
(defcomp ~tickets/entry-tickets-admin-from-data (&key (entry-name :as string) (count-label :as string) (tickets :as list?) (csrf :as string))
|
||||
(defcomp
|
||||
~tickets/entry-tickets-admin-from-data
|
||||
(&key
|
||||
(entry-name :as string)
|
||||
(count-label :as string)
|
||||
(tickets :as list?)
|
||||
(csrf :as string))
|
||||
(~tickets/entry-tickets-admin-panel
|
||||
:entry-name entry-name :count-label count-label
|
||||
:body (if (empty? (or tickets (list)))
|
||||
:entry-name entry-name
|
||||
:count-label count-label
|
||||
:body (if
|
||||
(empty? (or tickets (list)))
|
||||
(~tickets/entry-tickets-admin-empty)
|
||||
(~tickets/entry-tickets-admin-table
|
||||
:rows (<> (map (lambda (t)
|
||||
(~tickets/entry-tickets-admin-row
|
||||
:code (get t "code") :code-short (get t "code-short")
|
||||
:type-name (get t "type-name")
|
||||
:badge (~entries/ticket-state-badge :state (get t "state"))
|
||||
:action (cond
|
||||
((or (= (get t "state") "confirmed") (= (get t "state") "reserved"))
|
||||
(~tickets/entry-tickets-admin-checkin
|
||||
:checkin-url (get t "checkin-url") :code (get t "code") :csrf csrf))
|
||||
((= (get t "state") "checked_in")
|
||||
(~tickets/admin-checked-in :time-str (or (get t "checked-in-time") "")))
|
||||
(true nil))))
|
||||
(or tickets (list))))))))
|
||||
:rows (<>
|
||||
(map
|
||||
(lambda
|
||||
(t)
|
||||
(let-match
|
||||
{:type-name type-name :code-short code-short :code code :checkin-url checkin-url :checked-in-time checked-in-time :state state}
|
||||
t
|
||||
(~tickets/entry-tickets-admin-row
|
||||
:code code
|
||||
:code-short code-short
|
||||
:type-name type-name
|
||||
:badge (~entries/ticket-state-badge :state state)
|
||||
:action (cond
|
||||
((or (= state "confirmed") (= state "paid"))
|
||||
(~tickets/entry-tickets-admin-checkin
|
||||
:checkin-url checkin-url
|
||||
:code code
|
||||
:csrf csrf))
|
||||
((= state "checked-in")
|
||||
(~tickets/admin-checked-in
|
||||
:time-str (or checked-in-time "")))
|
||||
(true nil)))))
|
||||
(or tickets (list))))))))
|
||||
|
||||
;; Checkin success row from data
|
||||
(defcomp ~tickets/checkin-success-row-from-data (&key (code :as string) (code-short :as string) (entry-name :as string) (date-str :as string?) (type-name :as string) (time-str :as string))
|
||||
@@ -316,21 +378,43 @@
|
||||
:time-str time-str))
|
||||
|
||||
;; Ticket types table from data
|
||||
(defcomp ~tickets/types-table-from-data (&key (list-container :as string) (ticket-types :as list?) (action-btn :as string) (add-url :as string)
|
||||
(tr-cls :as string) (pill-cls :as string) (hx-select :as string) (csrf-hdr :as string))
|
||||
(defcomp
|
||||
~tickets/types-table-from-data
|
||||
(&key
|
||||
(list-container :as string)
|
||||
(ticket-types :as list?)
|
||||
(action-btn :as string)
|
||||
(add-url :as string)
|
||||
(tr-cls :as string)
|
||||
(pill-cls :as string)
|
||||
(hx-select :as string)
|
||||
(csrf-hdr :as string))
|
||||
(~page/ticket-types-table
|
||||
:list-container list-container
|
||||
:rows (if (empty? (or ticket-types (list)))
|
||||
:rows (if
|
||||
(empty? (or ticket-types (list)))
|
||||
(~page/ticket-types-empty-row)
|
||||
(<> (map (lambda (tt)
|
||||
(~page/ticket-types-row
|
||||
:tr-cls tr-cls :tt-href (get tt "tt-href")
|
||||
:pill-cls pill-cls :hx-select hx-select
|
||||
:tt-name (get tt "tt-name") :cost-str (get tt "cost-str")
|
||||
:count (get tt "count") :action-btn action-btn
|
||||
:del-url (get tt "del-url") :csrf-hdr csrf-hdr))
|
||||
(or ticket-types (list)))))
|
||||
:action-btn action-btn :add-url add-url))
|
||||
(<>
|
||||
(map
|
||||
(lambda
|
||||
(tt)
|
||||
(let-match
|
||||
{:tt-href tt-href :count count :cost-str cost-str :tt-name tt-name :del-url del-url}
|
||||
tt
|
||||
(~page/ticket-types-row
|
||||
:tr-cls tr-cls
|
||||
:tt-href tt-href
|
||||
:pill-cls pill-cls
|
||||
:hx-select hx-select
|
||||
:tt-name tt-name
|
||||
:cost-str cost-str
|
||||
:count count
|
||||
:action-btn action-btn
|
||||
:del-url del-url
|
||||
:csrf-hdr csrf-hdr)))
|
||||
(or ticket-types (list)))))
|
||||
:action-btn action-btn
|
||||
:add-url add-url))
|
||||
|
||||
;; Lookup result from data
|
||||
(defcomp ~tickets/lookup-result-from-data (&key (entry-name :as string) (type-name :as string?) (date-str :as string?) (cal-name :as string?)
|
||||
|
||||
Reference in New Issue
Block a user