From e53ff6d20b639bef207e1a0354daaadd17c539e3 Mon Sep 17 00:00:00 2001 From: Juanfran Date: Fri, 20 Mar 2026 12:30:15 +0100 Subject: [PATCH] :sparkles: Open create org modal in Nitrate --- frontend/src/app/main/data/nitrate.cljs | 4 ++++ frontend/src/app/main/ui/dashboard/sidebar.cljs | 8 +++++--- frontend/src/app/main/ui/dashboard/subscription.cljs | 7 +++++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/frontend/src/app/main/data/nitrate.cljs b/frontend/src/app/main/data/nitrate.cljs index d9743c3543..8670833bdf 100644 --- a/frontend/src/app/main/data/nitrate.cljs +++ b/frontend/src/app/main/data/nitrate.cljs @@ -29,6 +29,10 @@ (u/percent-encode (str organization-id)))] (st/emit! (rt/nav-raw :href href))))) +(defn go-to-nitrate-cc-create-org + [] + (st/emit! (rt/nav-raw :href "/control-center/?action=create-org"))) + (defn go-to-nitrate-billing [] (st/emit! (rt/nav-raw :href "/control-center/licenses/billing"))) diff --git a/frontend/src/app/main/ui/dashboard/sidebar.cljs b/frontend/src/app/main/ui/dashboard/sidebar.cljs index b392d2abca..eaf52430e3 100644 --- a/frontend/src/app/main/ui/dashboard/sidebar.cljs +++ b/frontend/src/app/main/ui/dashboard/sidebar.cljs @@ -307,7 +307,7 @@ (mf/deps profile) (fn [] (if (dnt/is-valid-license? profile) - (dnt/go-to-nitrate-cc) + (dnt/go-to-nitrate-cc-create-org) (st/emit! (dnt/show-nitrate-popup :nitrate-form))))) on-go-to-cc-click @@ -595,7 +595,9 @@ (map team->org) (d/index-by :id))) - no-orgs? (= (count orgs) 0) + ;; There is always at least one default organization + ;; so no-orgs? is true when only that default one exists (count <= 1). + no-orgs? (<= (count orgs) 1) current-org (team->org team) @@ -630,7 +632,7 @@ (mf/deps profile) (fn [] (if (dnt/is-valid-license? profile) - (dnt/go-to-nitrate-cc) + (dnt/go-to-nitrate-cc-create-org) (st/emit! (dnt/show-nitrate-popup :nitrate-form)))))] (if no-orgs? [:div {:class (stl/css :nitrate-selected-org)} diff --git a/frontend/src/app/main/ui/dashboard/subscription.cljs b/frontend/src/app/main/ui/dashboard/subscription.cljs index 8749305c1d..043046f08d 100644 --- a/frontend/src/app/main/ui/dashboard/subscription.cljs +++ b/frontend/src/app/main/ui/dashboard/subscription.cljs @@ -135,7 +135,10 @@ handle-click (mf/use-fn (fn [] - (st/emit! (dnt/show-nitrate-popup :nitrate-form))))] + (st/emit! (dnt/show-nitrate-popup :nitrate-form)))) + + handle-go-to-cc + (mf/use-fn dnt/go-to-nitrate-cc-create-org)] ;; TODO add translations for this texts when we have the definitive ones (if (and nitrate? no-orgs-created?) @@ -148,7 +151,7 @@ [:> button* {:variant "primary" :type "button" :class (stl/css :nitrate-bottom-button) - :on-click dnt/go-to-nitrate-cc} "CREATE ORGANIZATION"]]] + :on-click handle-go-to-cc} "CREATE ORGANIZATION"]]] ;; Banner for users without nitrate license (when (not nitrate?)