Looks good

This commit is contained in:
2024-10-15 21:43:03 -07:00
parent 4e215c98ae
commit 70e76347e3
3 changed files with 42 additions and 44 deletions

View File

@@ -2,8 +2,7 @@
(:require [clj-time.core :as time] (:require [clj-time.core :as time]
[clj-time.coerce :as coerce] [clj-time.coerce :as coerce]
[clj-time.format :as f] [clj-time.format :as f]
[datomic.api :as dc] [datomic.api :as dc]))
[auto-ap.time :as atime]))
;; TODO WILL NOT WORK IN DATOMIC CLOUD ;; TODO WILL NOT WORK IN DATOMIC CLOUD
(defn entid [db i] (defn entid [db i]

View File

@@ -14,5 +14,5 @@
[:section (merge params {:class (hh/add-class " py-3 sm:py-5" (:class params))}) [:section (merge params {:class (hh/add-class " py-3 sm:py-5" (:class params))})
[:div {:class (:max-w params "max-w-screen-2xl")} [:div {:class (:max-w params "max-w-screen-2xl")}
(into (into
[:div {:class "relative overflow-hidden shadow-md dark:bg-gray-800 sm:rounded-lg border-2 border-gray-200 dark:border-gray-900 bg-white"}] [:div {:class "relative overflow-scroll shadow-md dark:bg-gray-800 sm:rounded-lg border-2 border-gray-200 dark:border-gray-900 bg-white"}]
children)]]) children)]])

View File

@@ -150,48 +150,47 @@
(defn table [{:keys [table widths investigate-url warning]}] (defn table [{:keys [table widths investigate-url warning]}]
(let [cell-count (cell-count table)] (let [cell-count (cell-count table)]
(com/content-card {:class "inline-block overflow-hidden"} (com/content-card {:class "inline-block overflow-scroll"}
[:div { :class "overflow-y-auto h-[70vh] m-4 inline-block"} [:div {:class "overflow-scroll h-[70vh] m-4 inline-block"}
(when warning [:div.rounded.bg-red-50.text-red-800.p-4.m-2 (when warning [:div.rounded.bg-red-50.text-red-800.p-4.m-2
warning]) warning])
(-> [:table {:class "text-sm text-left text-gray-500 dark:text-gray-400"} (-> [:table {:class "text-sm text-left text-gray-500 dark:text-gray-400"}
[:thead {:class "text-xs text-gray-800 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400 font-bold"} [:thead {:class "text-xs text-gray-800 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400 font-bold"}
(map
(fn [header-row header]
(into
[:tr {:class " dark:border-gray-600 hover:bg-gray-100 dark:hover:bg-gray-700"}]
(map (map
(fn [w header i] (fn [header-row header]
(cell {:width w (into
:investigate-url investigate-url [:tr {:class " dark:border-gray-600 hover:bg-gray-100 dark:hover:bg-gray-700"}]
:other-style {:position "sticky" (map
:top (* header-row (+ 22 18))}} header)) (fn [w header i]
widths (cell {:width w
header :investigate-url investigate-url
(range)))) :other-style {:position "sticky"
(range) :top (* header-row (+ 22 18))}} header))
(:header table))]] widths
header
(conj (range))))
(-> [:tbody {:style {}}] (range)
(into (:header table))]]
(for [[i row] (map vector (range) (:rows table))]
(conj
[:tr {:class " dark:border-gray-600 hover:bg-gray-100 dark:hover:bg-gray-700"} (-> [:tbody {:style {}}]
(for [[i c] (map vector (range) (take cell-count (into
(reduce (for [[i row] (map vector (range) (:rows table))]
(fn [[acc cnt] cur]
(if (>= (+ cnt (:colspan cur 1)) cell-count) [:tr {:class " dark:border-gray-600 hover:bg-gray-100 dark:hover:bg-gray-700"}
(reduced (conj acc cur)) (for [[i c] (map vector (range) (take cell-count
[(conj acc cur) (+ cnt (:colspan cur 1))])) (reduce
[[] 0] (fn [[acc cnt] cur]
(concat row (repeat nil)))))] (if (>= (+ cnt (:colspan cur 1)) cell-count)
(reduced (conj acc cur))
(cell {:investigate-url investigate-url} c))])) [(conj acc cur) (+ cnt (:colspan cur 1))]))
(conj [:tr (for [i (range cell-count)] [[] 0]
(concat row (repeat nil)))))]
( cell {:investigate-url investigate-url} {:value " "}))])))
)]))) (cell {:investigate-url investigate-url} c))]))
(conj [:tr (for [i (range cell-count)]
(cell {:investigate-url investigate-url} {:value " "}))]))))])))
(defn concat-tables [tables] (defn concat-tables [tables]
(let [[first & rest] tables] (let [[first & rest] tables]