🐛 Fix visibility of go to nitrate cc option

This commit is contained in:
María Valderrama
2026-03-20 13:42:45 +01:00
committed by GitHub
parent f068842a6c
commit 9c3fbc59b9
2 changed files with 17 additions and 10 deletions

View File

@@ -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

View File

@@ -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*