fixes a couple of dropdown-related bugs.

This commit is contained in:
2024-04-17 23:29:04 -07:00
parent 705cab9435
commit 61338dd4fc
3 changed files with 17 additions and 17 deletions

View File

@@ -98,7 +98,7 @@
(= (:user/role id) "admin")
nil
(#{"manager" "user" "power-user"} (:user/role id))
(#{"manager" "user" "power-user" "read-only"} (:user/role id))
(:user/clients id [])))

View File

@@ -1,12 +1,11 @@
(ns auto-ap.ssr.components.navbar
(:require
[auto-ap.graphql.utils :refer [is-admin?]]
[auto-ap.ssr-routes :as ssr-routes]
[auto-ap.ssr.company-dropdown :as cd]
[auto-ap.ssr.components.buttons :refer [icon-button-]]
[auto-ap.ssr.components.user-dropdown :as user-dropdown]
[auto-ap.ssr.svg :as svg]
[bidi.bidi :as bidi]))
(:require [auto-ap.graphql.utils :refer [is-admin? limited-clients]]
[auto-ap.ssr-routes :as ssr-routes]
[auto-ap.ssr.company-dropdown :as cd]
[auto-ap.ssr.components.buttons :refer [icon-button-]]
[auto-ap.ssr.components.user-dropdown :as user-dropdown]
[auto-ap.ssr.svg :as svg]
[bidi.bidi :as bidi]))
(defn navbar- [{:keys [client-selection client identity clients dd-env]}]
[:nav {:class "fixed z-30 w-full bg-white border-b border-gray-200 dark:bg-gray-800 dark:border-gray-700"}
@@ -39,7 +38,10 @@
:hx-target "#modal-holder"
:hx-swap "outerHTML"}
svg/search)
(cd/dropdown {:client-selection client-selection :client client :identity identity
:clients clients})
(let [limited-clients (limited-clients identity)]
(when (or (nil? limited-clients)
(> (count limited-clients) 1))
(cd/dropdown {:client-selection client-selection :client client :identity identity
:clients clients})))
(user-dropdown/dropdown {:identity identity})]]]])