Made error page look pretty good

This commit is contained in:
2023-10-30 20:47:55 -07:00
parent a5672d8954
commit 3d5c307760
6 changed files with 24 additions and 16 deletions

File diff suppressed because one or more lines are too long

View File

@@ -210,10 +210,7 @@
(com/modal ;; TODO we need a cleaner way to have forms that wrap the whole. In this cas
{}
[:form {:hx-post (bidi/path-for ssr-routes/only-routes :admin-job-start)
:class "h-full w-full"
"x-on:htmx:response-error" "unexpectedError=true"
"x-on:htmx:before-request" "unexpectedError=false"
:x-data (hx/json {:unexpectedError false})}
:class "h-full w-full"}
[:fieldset {:class "hx-disable h-full w-full"}
(com/modal-card {}
[:div.m-2 "New job"]
@@ -243,8 +240,7 @@
[:div#sub-form (subform* {:name (fc/with-field :name (fc/field-value))}) ]]
[:div
[:div#5xx-error.bg-red-100.mb-2.p-1 {:x-show "unexpectedError"}
"An unexpected error has occured."]
(com/form-errors {:errors (:errors fc/*form-errors*)})
(com/validated-save-button {:errors form-errors} "Run job")])]]))))

View File

@@ -53,7 +53,8 @@
[clojure.set :as set]
[clojure.string :as str]
[datomic.api :as dc]
[malli.core :as mc]))
[malli.core :as mc]
[auto-ap.logging :as alog]))
(defn filters [request]
[:form {"hx-trigger" "change delay:500ms, keyup changed from:.hot-filter delay:1000ms"
@@ -777,9 +778,9 @@
(-> t :transaction/client :client/locations))))])
transactions)
identity)
(doseq [n transactions]
(solr/touch-with-ledger (:db/id n)))
(html-response [:div]
:headers {"hx-trigger" (hx/json {:modalclose ""
:notification (format "Successfully coded %d of %d transactions!"

View File

@@ -6,7 +6,9 @@
(defn modal- [params & children]
[:div (-> params
(assoc "@click.outside" "open=false"
:x-data (hx/json {:index 0 :hidingIndex -1})
:x-data (hx/json {:index 0 :hidingIndex -1 :unexpectedError false})
"x-on:htmx:response-error" "unexpectedError=true"
"x-on:htmx:before-request" "unexpectedError=false"
:x-ref "modalStack"
"@modalnext"
"$refs.modalStack.children[index].setAttribute('x-transition:leave-end', '-translate-x-full scale-0 opacity-0' );
@@ -43,7 +45,12 @@
#_[:div.bg-green-300.w-full.h-64
"hello"]
content]
(when footer [:div {:class "p-4 shrink-0"} footer])]])
(when footer [:div {:class "p-4"}
[:span.items-center.bg-red-100.text-red-800.text-xs.font-medium.mb-2.p-1.rounded-full.inline-flex (hx/alpine-appear {:x-show "unexpectedError" :class "dark:bg-red-900 dark:text-red-300"})
[:span {:class "w-2 h-2 mr-1 bg-red-500 rounded-full"}]
[:span.px-2.py-0.5 "An unexpected error has occured. Integreat staff have been notified."]]
[:div {:class "shrink-0"}
footer]])]])
(defn stacked-modal-card- [index params header content footer]
@@ -60,4 +67,8 @@
[:div {:class "px-6 space-y-6 overflow-y-scroll w-full shrink"}
content]
(when footer [:div {:class "p-4 shrink-0"} footer])])
(when footer [:div {:class "p-4"}
[:span.items-center.bg-red-100.text-red-800.text-xs.font-medium.mb-2.p-1.rounded-full.inline-flex (hx/alpine-appear {:x-show "unexpectedError" :class "dark:bg-red-900 dark:text-red-300"})
[:span {:class "w-2 h-2 bg-red-500 rounded-full"}]
[:span.px-2.py-0.5 "An unexpected error has occured. Integreat staff have been notified."]]
[:div {:class "shrink-0"}]footer])])

View File

@@ -10,8 +10,8 @@
"/account/typeahead" ::account-typeahead
"/test" ::test
"/new" {:get ::new-dialog}
[[#"\d+" :db/id] "/edit"] ::edit-dialog
[[#"\d+" :db/id] "/run"] {:get ::execute-dialog
["/" [#"\d+" :db/id] "/edit"] ::edit-dialog
["/" [#"\d+" :db/id] "/run"] {:get ::execute-dialog
:post ::execute}
"/check-badges" ::check-badges
})

View File

@@ -20,13 +20,13 @@
"/client/new" :user-client-new
"/table" :user-table
"/impersonate" :user-impersonate
[[#"\d+" :db/id] "/edit"] {:get :user-edit-dialog}}
["/" [#"\d+" :db/id] "/edit"] {:get :user-edit-dialog}}
"/account" {"" {:get :admin-accounts
:put :admin-account-save
:post :admin-account-save}
"/table" :admin-account-table
"/new" {:get :admin-account-new-dialog}
[[#"\d+" :db/id] "/edit"] :admin-account-edit-dialog
["/" [#"\d+" :db/id] "/edit"] :admin-account-edit-dialog
"/override/new" :admin-account-client-override-new}
"/background-job" {"" {:get :admin-jobs
:post :admin-job-start}