taste-redesign
This commit is contained in:
@@ -66,9 +66,9 @@
|
||||
])
|
||||
|
||||
(defn not-found [_]
|
||||
{:status 404
|
||||
{:status 404
|
||||
:headers {}
|
||||
:body ""})
|
||||
:body ""})
|
||||
|
||||
(defn home-handler [{:keys [identity]}]
|
||||
(if identity
|
||||
@@ -125,13 +125,13 @@
|
||||
|
||||
(defn wrap-logging [handler]
|
||||
(fn [request]
|
||||
(mu/with-context (cond-> {:uri (:uri request)
|
||||
:route (:handler (bidi.bidi/match-route all-routes
|
||||
(:uri request)
|
||||
:request-method (:request-method request)))
|
||||
(mu/with-context (cond-> {:uri (:uri request)
|
||||
:route (:handler (bidi.bidi/match-route all-routes
|
||||
(:uri request)
|
||||
:request-method (:request-method request)))
|
||||
|
||||
:client-selection (:client-selection request)
|
||||
:source "request"
|
||||
:source "request"
|
||||
:query (:uri request)
|
||||
:request-method (:request-method request)
|
||||
:user (dissoc (:identity request)
|
||||
@@ -157,15 +157,15 @@
|
||||
(defn wrap-idle-session-timeout
|
||||
[handler]
|
||||
(fn [request]
|
||||
(let [session (:session request {:version session-version/current-session-version})
|
||||
(let [session (:session request {:version session-version/current-session-version})
|
||||
end-time (coerce/to-date-time (::idle-timeout session))]
|
||||
(if (and end-time (time/before? end-time (time/now)))
|
||||
(if (get (:headers request) "hx-request")
|
||||
{:session nil
|
||||
:status 200
|
||||
:status 200
|
||||
:headers {"hx-redirect" "/login"}}
|
||||
{:session nil
|
||||
:status 302
|
||||
:status 302
|
||||
:headers {"Location" "/login"}})
|
||||
(when-let [response (handler request)]
|
||||
(let [session (:session response session)]
|
||||
@@ -231,7 +231,7 @@
|
||||
seq
|
||||
(pull-many (dc/db conn)
|
||||
'[:db/id :client/name :client/code :client/locations
|
||||
:client/matches :client/feature-flags
|
||||
:client/matches :client/feature-flags
|
||||
{:client/bank-accounts [:db/id
|
||||
{:bank-account/type [:db/ident]}
|
||||
:bank-account/number
|
||||
@@ -263,6 +263,13 @@
|
||||
(into new-session)
|
||||
(assoc :client-selection client-selection))))))))
|
||||
|
||||
(defn wrap-dev-bypass-auth
|
||||
[handler]
|
||||
(fn [request]
|
||||
(if (= "dev" (:dd-env env))
|
||||
(handler (assoc request :identity {:user/role "admin" :user/name "Dev User"}))
|
||||
(handler request))))
|
||||
|
||||
(defn wrap-gunzip-jwt
|
||||
[handler]
|
||||
(fn [{:keys [session] :as request}]
|
||||
@@ -298,7 +305,7 @@
|
||||
{:status 200
|
||||
:headers {"hx-trigger" (cheshire/generate-string
|
||||
{"notification" (str (hiccup/html [:div (.getMessage e)]))})
|
||||
"hx-reswap" "none"}} ;; TODO make a warning box so you don't have to reuse the notifaction box, or make it reuse the same box but theme differently
|
||||
"hx-reswap" "none"}} ;; TODO make a warning box so you don't have to reuse the notifaction box, or make it reuse the same box but theme differently
|
||||
:else
|
||||
{:status 500
|
||||
:body (pr-str e)})))))
|
||||
@@ -317,30 +324,29 @@
|
||||
:clients-trimmed? (not= (count trimmed-clients) (count valid-clients)))))))
|
||||
#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
|
||||
(defonce app
|
||||
(-> route-handler
|
||||
(wrap-hx-current-url-params)
|
||||
(wrap-guess-route)
|
||||
(wrap-logging)
|
||||
(wrap-trim-clients)
|
||||
(wrap-hydrate-clients)
|
||||
(wrap-store-client-in-session)
|
||||
(wrap-gunzip-jwt)
|
||||
(wrap-authorization auth-backend)
|
||||
(wrap-authentication auth-backend
|
||||
(session-backend {:authfn (fn [auth]
|
||||
(dissoc auth :exp))}))
|
||||
(-> route-handler
|
||||
(wrap-hx-current-url-params)
|
||||
(wrap-guess-route)
|
||||
(wrap-logging)
|
||||
(wrap-trim-clients)
|
||||
(wrap-hydrate-clients)
|
||||
(wrap-store-client-in-session)
|
||||
(wrap-gunzip-jwt)
|
||||
(wrap-authorization auth-backend)
|
||||
(wrap-dev-bypass-auth)
|
||||
(wrap-authentication auth-backend (session-backend {:authfn (fn [auth] (dissoc auth :exp))}))
|
||||
|
||||
#_(wrap-pprint-session)
|
||||
#_(wrap-pprint-session)
|
||||
|
||||
(session-version/wrap-session-version)
|
||||
(wrap-idle-session-timeout)
|
||||
(wrap-session {:store (cookie-store
|
||||
{:key
|
||||
(byte-array
|
||||
[42, 52, -31, 101, -126, -33, -118, -69, -82, -59, -15, -69, -38, 103, -102, -1])})})
|
||||
(session-version/wrap-session-version)
|
||||
(wrap-idle-session-timeout)
|
||||
(wrap-session {:store (cookie-store
|
||||
{:key
|
||||
(byte-array
|
||||
[42, 52, -31, 101, -126, -33, -118, -69, -82, -59, -15, -69, -38, 103, -102, -1])})})
|
||||
|
||||
#_(wrap-reload)
|
||||
(wrap-params)
|
||||
(mp/wrap-multipart-params)
|
||||
(wrap-edn-params)
|
||||
(wrap-error)))
|
||||
#_(wrap-reload)
|
||||
(wrap-params)
|
||||
(mp/wrap-multipart-params)
|
||||
(wrap-edn-params)
|
||||
(wrap-error)))
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
:session {}})
|
||||
|
||||
(defn impersonate [request]
|
||||
{:status 200
|
||||
{:status 200
|
||||
:session {:identity (dissoc (jwt/unsign (get-in request [:query-params "jwt"])
|
||||
(:jwt-secret env)
|
||||
{:alg :hs512})
|
||||
@@ -87,14 +87,27 @@
|
||||
[:p "Integreat staff have been notified and are looking into it. "]
|
||||
[:p "To see error details, " [:a.underline.cursor-pointer {"@click" "expandError=true"} "click here"] "."]
|
||||
[:pre#error-details.text-xs {:x-show "expandError" :x-text "errorDetails"}]]]]]]
|
||||
[:div.p-4.flex.flex-row.justify-center.items-center.h-screen
|
||||
(com/card {:class "animate-slideUp"}
|
||||
|
||||
[:div.p-4
|
||||
[:img {:src "/img/logo-big.png"}]
|
||||
[:div
|
||||
[:a.button.is-large.is-primary {:href (login-url (get (:query-params request) "redirect-to"))} "Login with Google"]]
|
||||
"HELLO"])]]]])
|
||||
[:div {:class "relative w-full h-screen overflow-hidden"}
|
||||
[:div {:class "absolute inset-0"
|
||||
:style "background: linear-gradient(135deg, #7ECDC0 0%, #A8D85C 50%, #7ECDC0 100%);"}]
|
||||
[:div {:class "absolute inset-0"
|
||||
:style "background: radial-gradient(circle at 20% 80%, rgba(255,255,255,0.35) 0%, transparent 50%), radial-gradient(circle at 80% 20%, rgba(255,255,255,0.25) 0%, transparent 40%);"}]
|
||||
[:div {:class "absolute inset-0 flex items-center justify-center"}
|
||||
[:div {:class "animate-slideUp"
|
||||
:style "background: rgba(255,255,255,0.92); backdrop-filter: blur(20px); border-radius: 20px; padding: 40px 36px; width: 340px; box-shadow: 0 25px 80px rgba(0,0,0,0.15); text-align: center;"}
|
||||
[:img {:src "/img/logo-big.png"
|
||||
:style "display: block; margin: 0 auto 24px;"}]
|
||||
[:a {:href (login-url (get (:query-params request) "redirect-to"))
|
||||
:style "display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-width: 224px; height: 44px; padding: 0 24px; border: 1px solid #747775; border-radius: 22px; background: #FFFFFF; text-decoration: none; transition: background-color 200ms ease, box-shadow 200ms ease, transform 150ms ease; cursor: pointer;"
|
||||
:onmouseover "this.style.background='#F5F5F5'; this.style.boxShadow='0 2px 8px rgba(0,0,0,0.08)'; this.style.transform='translateY(-1px)';"
|
||||
:onmouseout "this.style.background='#FFFFFF'; this.style.boxShadow='none'; this.style.transform='translateY(0)';"
|
||||
:onmousedown "this.style.transform='scale(0.98)';"
|
||||
:onmouseup "this.style.transform='translateY(-1px)';"}
|
||||
svg/google-g
|
||||
[:span {:style "font-family: 'Roboto', Arial, sans-serif; font-weight: 500; font-size: 14px; line-height: 20px; color: #1F1F1F; white-space: nowrap;"}
|
||||
"Sign in with Google"]]
|
||||
[:p {:style "margin-top: 16px; font-size: 11px; color: #aaa; margin-bottom: 0;"}
|
||||
"Secure & fast"]]]]]]])
|
||||
|
||||
(defn login [request]
|
||||
(base-page
|
||||
|
||||
@@ -83,11 +83,11 @@
|
||||
[:line {:stroke "currentColor", :fill "none", :stroke-linejoin "round", :y1 "16.22", :stroke-linecap "round", :stroke-width "1.5px", :x1 "16.221", :y2 "23.25", :x2 "23.25"}]])
|
||||
|
||||
(def moon
|
||||
[:svg {:id "theme-toggle-dark-icon", :fill "currentColor", :viewbox "0 0 20 20", :xmlns "http://www.w3.org/2000/svg"}
|
||||
[:svg {:id "theme-toggle-dark-icon", :fill "currentColor", :viewbox "0 0 20 20", :xmlns "http://www.w3.org/2000/svg"}
|
||||
[:path {:d "M17.293 13.293A8 8 0 016.707 2.707a8.001 8.001 0 1010.586 10.586z"}]])
|
||||
|
||||
(def sun
|
||||
[:svg {:id "theme-toggle-light-icon", :fill "currentColor", :viewbox "0 0 20 20", :xmlns "http://www.w3.org/2000/svg"}
|
||||
[:svg {:id "theme-toggle-light-icon", :fill "currentColor", :viewbox "0 0 20 20", :xmlns "http://www.w3.org/2000/svg"}
|
||||
[:path {:d "M10 2a1 1 0 011 1v1a1 1 0 11-2 0V3a1 1 0 011-1zm4 8a4 4 0 11-8 0 4 4 0 018 0zm-.464 4.95l.707.707a1 1 0 001.414-1.414l-.707-.707a1 1 0 00-1.414 1.414zm2.12-10.607a1 1 0 010 1.414l-.706.707a1 1 0 11-1.414-1.414l.707-.707a1 1 0 011.414 0zM17 11a1 1 0 100-2h-1a1 1 0 100 2h1zm-7 4a1 1 0 011 1v1a1 1 0 11-2 0v-1a1 1 0 011-1zM5.05 6.464A1 1 0 106.465 5.05l-.708-.707a1 1 0 00-1.414 1.414l.707.707zm1.414 8.486l-.707.707a1 1 0 01-1.414-1.414l.707-.707a1 1 0 011.414 1.414zM4 11a1 1 0 100-2H3a1 1 0 000 2h1z", :fill-rule "evenodd", :clip-rule "evenodd"}]])
|
||||
|
||||
(def home
|
||||
@@ -157,23 +157,23 @@
|
||||
[:defs]
|
||||
[:title "navigation-next"]
|
||||
[:path
|
||||
{:d "M23,9.5H12.387a4,4,0,0,0-4,4v2",
|
||||
:fill "none",
|
||||
:stroke "currentColor",
|
||||
:stroke-linecap "round",
|
||||
{:d "M23,9.5H12.387a4,4,0,0,0-4,4v2",
|
||||
:fill "none",
|
||||
:stroke "currentColor",
|
||||
:stroke-linecap "round",
|
||||
:stroke-linejoin "round"}]
|
||||
[:polyline
|
||||
{:points "19 13.498 23 9.498 19 5.498",
|
||||
:fill "none",
|
||||
:stroke "currentColor",
|
||||
:stroke-linecap "round",
|
||||
{:points "19 13.498 23 9.498 19 5.498",
|
||||
:fill "none",
|
||||
:stroke "currentColor",
|
||||
:stroke-linecap "round",
|
||||
:stroke-linejoin "round"}]
|
||||
[:path
|
||||
{:d
|
||||
"M14.387,13v5.5a1,1,0,0,1-1,1h-12a1,1,0,0,1-1-1V6.5a1,1,0,0,1,1-1h12a1,1,0,0,1,1,1V7",
|
||||
:fill "none",
|
||||
:stroke "currentColor",
|
||||
:stroke-linecap "round",
|
||||
:fill "none",
|
||||
:stroke "currentColor",
|
||||
:stroke-linecap "round",
|
||||
:stroke-linejoin "round"}]])
|
||||
(def play
|
||||
[:svg {:xmlns "http://www.w3.org/2000/svg", :viewbox "-0.5 -0.5 24 24"}
|
||||
@@ -187,26 +187,26 @@
|
||||
[:defs]
|
||||
[:title "pencil"]
|
||||
[:rect
|
||||
{:y "1.09",
|
||||
:stroke "currentColor",
|
||||
:transform "translate(11.889 -5.238) rotate(45)",
|
||||
:fill "none",
|
||||
{:y "1.09",
|
||||
:stroke "currentColor",
|
||||
:transform "translate(11.889 -5.238) rotate(45)",
|
||||
:fill "none",
|
||||
:stroke-linejoin "round",
|
||||
:width "6",
|
||||
:stroke-linecap "round",
|
||||
:x "9.268",
|
||||
:height "21.284"}]
|
||||
:width "6",
|
||||
:stroke-linecap "round",
|
||||
:x "9.268",
|
||||
:height "21.284"}]
|
||||
[:polygon
|
||||
{:points "2.621 17.136 0.5 23.5 6.864 21.379 2.621 17.136",
|
||||
:fill "none",
|
||||
:stroke "currentColor",
|
||||
:stroke-linecap "round",
|
||||
{:points "2.621 17.136 0.5 23.5 6.864 21.379 2.621 17.136",
|
||||
:fill "none",
|
||||
:stroke "currentColor",
|
||||
:stroke-linecap "round",
|
||||
:stroke-linejoin "round"}]
|
||||
[:path
|
||||
{:d "M21.914,6.328,17.672,2.086l.707-.707a3,3,0,0,1,4.242,4.242Z",
|
||||
:fill "none",
|
||||
:stroke "currentColor",
|
||||
:stroke-linecap "round",
|
||||
{:d "M21.914,6.328,17.672,2.086l.707-.707a3,3,0,0,1,4.242,4.242Z",
|
||||
:fill "none",
|
||||
:stroke "currentColor",
|
||||
:stroke-linecap "round",
|
||||
:stroke-linejoin "round"}]])
|
||||
|
||||
(def dollar-tag
|
||||
@@ -231,15 +231,15 @@
|
||||
[:path
|
||||
{:d
|
||||
"M5.5,11.5c-.275,0-.341.159-.146.354l6.292,6.293a.5.5,0,0,0,.709,0l6.311-6.275c.2-.193.13-.353-.145-.355L15.5,11.5V1.5a1,1,0,0,0-1-1h-5a1,1,0,0,0-1,1V11a.5.5,0,0,1-.5.5Z",
|
||||
:fill "none",
|
||||
:stroke "currentColor",
|
||||
:stroke-linecap "round",
|
||||
:fill "none",
|
||||
:stroke "currentColor",
|
||||
:stroke-linecap "round",
|
||||
:stroke-linejoin "round"}]
|
||||
[:path
|
||||
{:d "M23.5,18.5v4a1,1,0,0,1-1,1H1.5a1,1,0,0,1-1-1v-4",
|
||||
:fill "none",
|
||||
:stroke "currentColor",
|
||||
:stroke-linecap "round",
|
||||
{:d "M23.5,18.5v4a1,1,0,0,1-1,1H1.5a1,1,0,0,1-1-1v-4",
|
||||
:fill "none",
|
||||
:stroke "currentColor",
|
||||
:stroke-linecap "round",
|
||||
:stroke-linejoin "round"}]])
|
||||
|
||||
(def trash
|
||||
@@ -522,3 +522,11 @@
|
||||
[:path {:d "m12 16 0 3", :fill "none", :stroke "currentColor", :stroke-linecap "round", :stroke-linejoin "round", :stroke-width "1"}]
|
||||
[:path {:d "M4.5 9.5h15s1 0 1 1v12s0 1 -1 1h-15s-1 0 -1 -1v-12s0 -1 1 -1", :fill "none", :stroke "currentColor", :stroke-linecap "round", :stroke-linejoin "round", :stroke-width "1"}]
|
||||
[:path {:d "M6.5 6a5.5 5.5 0 0 1 11 0v3.5h-11Z", :fill "none", :stroke "currentColor", :stroke-linecap "round", :stroke-linejoin "round", :stroke-width "1"}]])
|
||||
|
||||
(def google-g
|
||||
[:svg {:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 24 24", :width "20", :height "20"}
|
||||
[:path {:d "M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z", :fill "#4285F4"}]
|
||||
[:path {:d "M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z", :fill "#34A853"}]
|
||||
[:path {:d "M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z", :fill "#FBBC05"}]
|
||||
[:path {:d "M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z", :fill "#EA4335"}]
|
||||
[:path {:d "M1.5 12h10.5v3H1.5z", :fill "none"}]])
|
||||
|
||||
Reference in New Issue
Block a user