cleans stuff up.

This commit is contained in:
2024-11-23 21:13:15 -08:00
parent 39d8e6e71f
commit 98dcdb5a55
12 changed files with 79 additions and 92 deletions

View File

@@ -15,7 +15,8 @@
[clj-time.coerce :as coerce]
[datomic.api :as dc]
[hiccup2.core :as hiccup]
[iol-ion.tx :refer [random-tempid]]))
[iol-ion.tx :refer [random-tempid]]
[auto-ap.ssr.hx :as hx]))
(def pull-expr [:transaction/description-original
:db/id
@@ -122,10 +123,10 @@
:score score}))
(defn transaction-row [r & {:keys [hide-actions? class last?] hs "_"}]
(defn transaction-row [r & {:keys [hide-actions? class last? other-params]}]
(com/data-grid-row
(cond-> {:class class}
hs (assoc "_" hs)
other-params (merge other-params)
last? (assoc :hx-get (bidi/path-for ssr-routes/only-routes
:transaction-insight-rows
@@ -223,7 +224,7 @@
(Long/parseLong transaction-id)))
:hide-actions? true
:class "live-added"
"_" (hiccup/raw "init transition opacity to 0 then remove me")))))
:other-params (hx/alpine-mount-then-disappear {})))))
(defn disapprove [{:keys [identity session] {:keys [transaction-id]} :route-params}]
(let [transaction-id (cond-> transaction-id string? (Long/parseLong))
@@ -231,8 +232,10 @@
@(dc/transact conn [[:upsert-transaction {:db/id transaction-id :transaction/outcome-recommendation nil}]])
(html-response (transaction-row
(parse-outcome (dc/pull db-before pull-expr transaction-id))
:class "live-removed"
:hide-actions? true
"_" (hiccup/raw "init transition opacity to 0 over 500ms then remove me")))))
:other-params (hx/alpine-mount-then-disappear {})))))
(defn explain [{:keys [identity session] {:keys [transaction-id]} :route-params}]
(let [r (dc/pull (dc/db conn)
pull-expr