Show current plan in Nitrate

*  Show current plan in Nitrate

* 📎 Code Review
This commit is contained in:
María Valderrama 2026-05-04 09:29:14 +02:00 committed by GitHub
parent 8f03b5ed9c
commit f24ad6bee4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 91 additions and 3 deletions

View File

@ -32,6 +32,7 @@
[app.main.ui.dashboard.subscription :refer [dashboard-cta*
get-subscription-type
menu-team-icon*
nitrate-current-plan*
nitrate-sidebar*
show-subscription-dashboard-banner?
subscription-sidebar*]]
@ -1323,12 +1324,15 @@
[:*
(if (contains? cf/flags :nitrate)
[:> nitrate-sidebar* {:profile profile :teams teams}]
[:*
[:> nitrate-sidebar* {:profile profile :teams teams}]
[:> nitrate-current-plan* {:profile profile}]]
(when (contains? cf/flags :subscriptions)
(if (show-subscription-dashboard-banner? profile)
[:> dashboard-cta* {:profile profile}]
[:> subscription-sidebar* {:profile profile}])))
;; TODO remove this block when subscriptions is full implemented
(when (contains? cf/flags :subscriptions-old)
[:button {:class (stl/css :upgrade-plan-section)

View File

@ -171,6 +171,27 @@
"UPGRADE TO NITRATE"
"Try 14 days for free")]]]))))
(mf/defc nitrate-current-plan*
[{:keys [profile]}]
(let [nitrate? (dnt/is-valid-license? profile)
nitrate-license (:subscription profile)
subscription (-> profile :props :subscription)
subscription-type (if nitrate? (:type nitrate-license) (get-subscription-type subscription))
subscription-is-trial (= "trialing" (:status (if nitrate? nitrate-license subscription)))]
[:div {:class (stl/css :nitrate-current-plan)}
[:div {:class (stl/css :nitrate-current-plan-label)}
(tr "subscription.current-plan.title")]
[:div {:class (stl/css :nitrate-current-plan-text)}
(case subscription-type
"professional" (tr "subscription.current-plan.professional")
"unlimited" (if subscription-is-trial
(tr "subscription.current-plan.unlimited-trial")
(tr "subscription.current-plan.unlimited"))
"nitrate" (if subscription-is-trial
(tr "subscription.current-plan.nitrate-trial")
(tr "subscription.current-plan.nitrate"))
"enterprise" (tr "subscription.current-plan.enterprise"))]]))
(mf/defc team*
[{:keys [is-owner team]}]
(let [subscription (:subscription team)

View File

@ -251,3 +251,24 @@
.nitrate-bottom-button {
width: fit-content;
}
.nitrate-current-plan {
border-radius: var(--sp-s);
margin: 0 var(--sp-m) var(--sp-m) var(--sp-m);
background: var(--color-background-tertiary);
border: $b-1 solid var(--color-background-quaternary);
padding: var(--sp-m) var(--sp-l);
}
.nitrate-current-plan-label {
@include t.use-typography("body-small");
padding-block-end: var(--sp-xs);
color: var(--color-foreground-secondary);
}
.nitrate-current-plan-text {
@include t.use-typography("body-medium");
color: var(--color-foreground-primary);
}

View File

@ -9368,4 +9368,25 @@ msgid "nitrate.subscription.active-until"
msgstr "Active until %s"
msgid "subscription.settings.activate-by-code"
msgstr "Enter activation code"
msgstr "Enter activation code"
msgid "subscription.current-plan.title"
msgstr "Your subscription"
msgid "subscription.current-plan.professional"
msgstr "Professional"
msgid "subscription.current-plan.unlimited"
msgstr "Unlimited"
msgid "subscription.current-plan.unlimited-trial"
msgstr "Unlimited Trial"
msgid "subscription.current-plan.nitrate"
msgstr "Nitrate"
msgid "subscription.current-plan.nitrate-trial"
msgstr "Nitrate Trial"
msgid "subscription.current-plan.enterprise"
msgstr "Enterprise"

View File

@ -9076,4 +9076,25 @@ msgid "subscription.settings.more-information"
msgstr "Más información"
msgid "subscription.settings.activate-by-code"
msgstr "Introducir código de activación"
msgstr "Introducir código de activación"
msgid "subscription.current-plan.title"
msgstr "Tu suscripción"
msgid "subscription.current-plan.professional"
msgstr "Professional"
msgid "subscription.current-plan.unlimited"
msgstr "Unlimited"
msgid "subscription.current-plan.unlimited-trial"
msgstr "Unlimited (Prueba)"
msgid "subscription.current-plan.nitrate"
msgstr "Nitrate"
msgid "subscription.current-plan.nitrate-trial"
msgstr "Nitrate (Prueba)"
msgid "subscription.current-plan.enterprise"
msgstr "Enterprise"