Skip to content

Commit

Permalink
fix: misc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rohan-chaturvedi committed Dec 3, 2024
1 parent ff01d2b commit 342552a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion frontend/components/settings/organisation/UpsellDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const UpsellDialog = ({
) : (
ProUpgradeDialog && (
<ProUpgradeDialog
userCount={data.organisationPlan.seatsUsed.total}
userCount={data.organisationPlan?.seatsUsed?.total}
onSuccess={closeModal}
/>
)
Expand Down
22 changes: 17 additions & 5 deletions frontend/ee/billing/StripeBillingInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -356,11 +356,23 @@ export const StripeBillingInfo = () => {
: subscriptionData?.paymentMethods!.find((paymentMethod) => paymentMethod?.isDefault)

const topBorderColor = () => {
if (activeOrganisation?.plan === ApiOrganisationPlanChoices.Fr) return 'border-t-neutral-500'
else if (activeOrganisation?.plan === ApiOrganisationPlanChoices.Pr) {
if (subscriptionData?.cancelAtPeriodEnd) return 'border-t-amber-500'
else return 'border-t-emerald-500'
const classMap: Record<string, string> = {
free: 'border-t-neutral-500', // For free plan
pro_active: 'border-t-emerald-500', // For active pro plan
pro_cancelled: 'border-t-amber-500', // For cancelled pro plan
}

if (activeOrganisation?.plan === ApiOrganisationPlanChoices.Fr) {
return classMap.free
} else if (activeOrganisation?.plan === ApiOrganisationPlanChoices.Pr) {
if (subscriptionData?.cancelAtPeriodEnd) {
return classMap.pro_cancelled
} else {
return classMap.pro_active
}
}

return '' // Default case if no condition matches
}

if (loading || !subscriptionData)
Expand All @@ -377,7 +389,7 @@ export const StripeBillingInfo = () => {
<div className="font-semibold text-xl">Current Subscription</div>
<div
className={clsx(
'p-4 rounded-lg border border-neutral-500/40 border-t-8 bg-zinc-100 dark:bg-zinc-800 flex items-center justify-between gap-4',
'p-4 rounded-lg border-b border-x border-t-8 border-neutral-500/40 bg-zinc-100 dark:bg-zinc-800 flex items-center justify-between gap-4',
topBorderColor()
)}
>
Expand Down
1 change: 1 addition & 0 deletions frontend/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module.exports = {
'./pages/**/*.{js,ts,jsx,tsx}',
'./components/**/*.{js,ts,jsx,tsx}',
],
safelist: ['border-t-neutral-500', 'border-t-amber-500', 'border-t-emerald-500', 'border-t-8'],
darkMode: 'class',
theme: {
fontSize: {
Expand Down

0 comments on commit 342552a

Please sign in to comment.