Replace all 676 inline sexp() string calls across 7 services with render(component_name, **kwargs) calls backed by 46 external .sexpr component definition files (587 defcomps total). - Add render() function to shared/sexp/jinja_bridge.py - Add load_service_components() helper and update load_sexp_dir() for *.sexpr - Update parser keyword regex to support HTMX hx-on::event syntax - Convert remaining inline HTML in route files to render() calls - Add shared/sexp/templates/misc.sexp for cross-service utility components Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
85 lines
3.9 KiB
Plaintext
85 lines
3.9 KiB
Plaintext
;; Events day components
|
|
|
|
(defcomp ~events-day-entry-link (&key href name time-str)
|
|
(a :href href :class "flex items-center gap-2 px-3 py-2 hover:bg-stone-100 rounded transition text-sm border sm:whitespace-nowrap sm:flex-shrink-0"
|
|
(div :class "flex-1 min-w-0"
|
|
(div :class "font-medium truncate" name)
|
|
(div :class "text-xs text-stone-600 truncate" time-str))))
|
|
|
|
(defcomp ~events-day-entries-nav (&key inner-html)
|
|
(div :class "flex flex-col sm:flex-row sm:items-center gap-2 border-r border-stone-200 mr-2 sm:max-w-2xl"
|
|
:id "day-entries-nav-wrapper"
|
|
(div :class "flex overflow-x-auto gap-1 scrollbar-thin"
|
|
(raw! inner-html))))
|
|
|
|
(defcomp ~events-day-table (&key list-container rows-html pre-action add-url)
|
|
(section :id "day-entries" :class list-container
|
|
(table :class "w-full text-sm border table-fixed"
|
|
(thead :class "bg-stone-100"
|
|
(tr
|
|
(th :class "p-2 text-left w-2/6" "Name")
|
|
(th :class "text-left p-2 w-1/6" "Slot/Time")
|
|
(th :class "text-left p-2 w-1/6" "State")
|
|
(th :class "text-left p-2 w-1/6" "Cost")
|
|
(th :class "text-left p-2 w-1/6" "Tickets")
|
|
(th :class "text-left p-2 w-1/6" "Actions")))
|
|
(tbody (raw! rows-html)))
|
|
(div :id "entry-add-container" :class "mt-4"
|
|
(button :type "button" :class pre-action
|
|
:hx-get add-url :hx-target "#entry-add-container" :hx-swap "innerHTML"
|
|
"+ Add entry"))))
|
|
|
|
(defcomp ~events-day-empty-row ()
|
|
(tr (td :colspan "6" :class "p-3 text-stone-500" "No entries yet.")))
|
|
|
|
(defcomp ~events-day-row-name (&key href pill-cls name)
|
|
(td :class "p-2 align-top w-2/6" (div :class "font-medium"
|
|
(a :href href :class pill-cls :hx-get href :hx-target "#main-panel" :hx-select "#main-panel"
|
|
:hx-swap "outerHTML" :hx-push-url "true" name))))
|
|
|
|
(defcomp ~events-day-row-slot (&key href pill-cls slot-name time-str)
|
|
(td :class "p-2 align-top w-1/6" (div :class "text-xs font-medium"
|
|
(a :href href :class pill-cls :hx-get href :hx-target "#main-panel" :hx-select "#main-panel"
|
|
:hx-swap "outerHTML" :hx-push-url "true" slot-name)
|
|
(span :class "text-stone-600 font-normal" (raw! time-str)))))
|
|
|
|
(defcomp ~events-day-row-time (&key start end)
|
|
(td :class "p-2 align-top w-1/6" (div :class "text-xs text-stone-600" (str start end))))
|
|
|
|
(defcomp ~events-day-row-state (&key state-id badge-html)
|
|
(td :class "p-2 align-top w-1/6" (div :id state-id (raw! badge-html))))
|
|
|
|
(defcomp ~events-day-row-cost (&key cost-str)
|
|
(td :class "p-2 align-top w-1/6" (span :class "font-medium text-green-600" cost-str)))
|
|
|
|
(defcomp ~events-day-row-tickets (&key price-str count-str)
|
|
(td :class "p-2 align-top w-1/6" (div :class "text-xs space-y-1"
|
|
(div :class "font-medium text-green-600" price-str)
|
|
(div :class "text-stone-600" count-str))))
|
|
|
|
(defcomp ~events-day-row-no-tickets ()
|
|
(td :class "p-2 align-top w-1/6" (span :class "text-xs text-stone-400" "No tickets")))
|
|
|
|
(defcomp ~events-day-row-actions ()
|
|
(td :class "p-2 align-top w-1/6"))
|
|
|
|
(defcomp ~events-day-row (&key tr-cls name-html slot-html state-html cost-html tickets-html actions-html)
|
|
(tr :class tr-cls (raw! name-html) (raw! slot-html) (raw! state-html) (raw! cost-html) (raw! tickets-html) (raw! actions-html)))
|
|
|
|
(defcomp ~events-day-admin-panel ()
|
|
(div :class "p-4 text-sm text-stone-500" "Admin options"))
|
|
|
|
(defcomp ~events-day-entries-nav-oob-empty ()
|
|
(div :id "day-entries-nav-wrapper" :hx-swap-oob "true"))
|
|
|
|
(defcomp ~events-day-entries-nav-oob (&key items-html)
|
|
(div :class "flex flex-col sm:flex-row sm:items-center gap-2 border-r border-stone-200 mr-2 sm:max-w-2xl"
|
|
:id "day-entries-nav-wrapper" :hx-swap-oob "true"
|
|
(div :class "flex overflow-x-auto gap-1 scrollbar-thin" (raw! items-html))))
|
|
|
|
(defcomp ~events-day-nav-entry (&key href nav-btn name time-str)
|
|
(a :href href :class nav-btn
|
|
(div :class "flex-1 min-w-0"
|
|
(div :class "font-medium truncate" name)
|
|
(div :class "text-xs text-stone-600 truncate" time-str))))
|