mirror of
https://github.com/penpot/penpot.git
synced 2026-03-22 10:23:43 +00:00
🐛 Fix visibility of go to nitrate cc option
This commit is contained in:
@@ -97,7 +97,8 @@
|
||||
[:id ::sm/uuid]
|
||||
[:name ::sm/text]
|
||||
[:slug ::sm/text]
|
||||
[:is-your-penpot :boolean]])
|
||||
[:is-your-penpot :boolean]
|
||||
[:owner-id ::sm/uuid]])
|
||||
|
||||
(def ^:private schema:team
|
||||
[:map
|
||||
@@ -248,7 +249,7 @@
|
||||
|
||||
(defn add-org-info-to-team
|
||||
"Enriches a team map with organization information from Nitrate.
|
||||
Adds organization-id, organization-name, organization-slug, and your-penpot fields.
|
||||
Adds organization-id, organization-name, organization-slug, organization-owner-id, and your-penpot fields.
|
||||
Returns the original team unchanged if the request fails or org data is nil."
|
||||
[cfg team params]
|
||||
(try
|
||||
@@ -259,6 +260,7 @@
|
||||
:organization-id (:id org)
|
||||
:organization-name (:name org)
|
||||
:organization-slug (:slug org)
|
||||
:organization-owner-id (:owner-id org)
|
||||
:is-default (or (:is-default team) (true? (:is-your-penpot org))))
|
||||
team))
|
||||
(catch Throwable cause
|
||||
|
||||
@@ -312,9 +312,11 @@
|
||||
|
||||
on-go-to-cc-click
|
||||
(mf/use-fn
|
||||
(mf/deps organization)
|
||||
(mf/deps organization profile)
|
||||
(fn []
|
||||
(if (:organization-id organization)
|
||||
;; Navigate to active org if user owns it, otherwise to last visited org
|
||||
(if (and (:organization-id organization)
|
||||
(= (:id profile) (:organization-owner-id organization)))
|
||||
(dnt/go-to-nitrate-cc organization)
|
||||
(dnt/go-to-nitrate-cc))))
|
||||
|
||||
@@ -324,7 +326,9 @@
|
||||
first
|
||||
:id)
|
||||
(:default-team-id profile))
|
||||
organizations (dissoc organizations default-team-id)]
|
||||
organizations (dissoc organizations default-team-id)
|
||||
|
||||
is-valid-license? (dnt/is-valid-license? profile)]
|
||||
|
||||
[:> dropdown-menu* props
|
||||
|
||||
@@ -356,10 +360,11 @@
|
||||
:class (stl/css :org-dropdown-item :action)}
|
||||
[:span {:class (stl/css :icon-wrapper)} add-org-icon]
|
||||
[:span {:class (stl/css :team-text)} (tr "dashboard.create-new-org")]]
|
||||
[:> dropdown-menu-item* {:on-click on-go-to-cc-click
|
||||
:class (stl/css :org-dropdown-item :action)}
|
||||
[:span {:class (stl/css :icon-wrapper)} arrow-up-right-icon]
|
||||
[:span {:class (stl/css :team-text)} (tr "dashboard.go-to-control-center")]]]))
|
||||
(when is-valid-license?
|
||||
[:> dropdown-menu-item* {:on-click on-go-to-cc-click
|
||||
:class (stl/css :org-dropdown-item :action)}
|
||||
[:span {:class (stl/css :icon-wrapper)} arrow-up-right-icon]
|
||||
[:span {:class (stl/css :team-text)} (tr "dashboard.go-to-control-center")]])]))
|
||||
|
||||
(mf/defc teams-selector-dropdown*
|
||||
{::mf/private true}
|
||||
@@ -575,7 +580,7 @@
|
||||
|
||||
|
||||
(defn- team->org [team]
|
||||
(assoc (dm/select-keys team [:id :organization-id :organization-slug])
|
||||
(assoc (dm/select-keys team [:id :organization-id :organization-slug :organization-owner-id])
|
||||
:name (:organization-name team)))
|
||||
|
||||
(mf/defc sidebar-org-switch*
|
||||
|
||||
Reference in New Issue
Block a user