mirror of
https://github.com/penpot/penpot.git
synced 2026-08-06 04:48:39 +00:00
🐛 Fix visibility of go to nitrate cc option
This commit is contained in:
parent
f068842a6c
commit
9c3fbc59b9
@ -97,7 +97,8 @@
|
|||||||
[:id ::sm/uuid]
|
[:id ::sm/uuid]
|
||||||
[:name ::sm/text]
|
[:name ::sm/text]
|
||||||
[:slug ::sm/text]
|
[:slug ::sm/text]
|
||||||
[:is-your-penpot :boolean]])
|
[:is-your-penpot :boolean]
|
||||||
|
[:owner-id ::sm/uuid]])
|
||||||
|
|
||||||
(def ^:private schema:team
|
(def ^:private schema:team
|
||||||
[:map
|
[:map
|
||||||
@ -248,7 +249,7 @@
|
|||||||
|
|
||||||
(defn add-org-info-to-team
|
(defn add-org-info-to-team
|
||||||
"Enriches a team map with organization information from Nitrate.
|
"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."
|
Returns the original team unchanged if the request fails or org data is nil."
|
||||||
[cfg team params]
|
[cfg team params]
|
||||||
(try
|
(try
|
||||||
@ -259,6 +260,7 @@
|
|||||||
:organization-id (:id org)
|
:organization-id (:id org)
|
||||||
:organization-name (:name org)
|
:organization-name (:name org)
|
||||||
:organization-slug (:slug org)
|
:organization-slug (:slug org)
|
||||||
|
:organization-owner-id (:owner-id org)
|
||||||
:is-default (or (:is-default team) (true? (:is-your-penpot org))))
|
:is-default (or (:is-default team) (true? (:is-your-penpot org))))
|
||||||
team))
|
team))
|
||||||
(catch Throwable cause
|
(catch Throwable cause
|
||||||
|
|||||||
@ -312,9 +312,11 @@
|
|||||||
|
|
||||||
on-go-to-cc-click
|
on-go-to-cc-click
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps organization)
|
(mf/deps organization profile)
|
||||||
(fn []
|
(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 organization)
|
||||||
(dnt/go-to-nitrate-cc))))
|
(dnt/go-to-nitrate-cc))))
|
||||||
|
|
||||||
@ -324,7 +326,9 @@
|
|||||||
first
|
first
|
||||||
:id)
|
:id)
|
||||||
(:default-team-id profile))
|
(: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
|
[:> dropdown-menu* props
|
||||||
|
|
||||||
@ -356,10 +360,11 @@
|
|||||||
:class (stl/css :org-dropdown-item :action)}
|
:class (stl/css :org-dropdown-item :action)}
|
||||||
[:span {:class (stl/css :icon-wrapper)} add-org-icon]
|
[:span {:class (stl/css :icon-wrapper)} add-org-icon]
|
||||||
[:span {:class (stl/css :team-text)} (tr "dashboard.create-new-org")]]
|
[:span {:class (stl/css :team-text)} (tr "dashboard.create-new-org")]]
|
||||||
[:> dropdown-menu-item* {:on-click on-go-to-cc-click
|
(when is-valid-license?
|
||||||
:class (stl/css :org-dropdown-item :action)}
|
[:> dropdown-menu-item* {:on-click on-go-to-cc-click
|
||||||
[:span {:class (stl/css :icon-wrapper)} arrow-up-right-icon]
|
:class (stl/css :org-dropdown-item :action)}
|
||||||
[:span {:class (stl/css :team-text)} (tr "dashboard.go-to-control-center")]]]))
|
[: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/defc teams-selector-dropdown*
|
||||||
{::mf/private true}
|
{::mf/private true}
|
||||||
@ -575,7 +580,7 @@
|
|||||||
|
|
||||||
|
|
||||||
(defn- team->org [team]
|
(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)))
|
:name (:organization-name team)))
|
||||||
|
|
||||||
(mf/defc sidebar-org-switch*
|
(mf/defc sidebar-org-switch*
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user