diff --git a/packages/ui/src/components/SubscriptionDetails/index.tsx b/packages/ui/src/components/SubscriptionDetails/index.tsx index 3ba49bf0a0b..f909c3070fd 100644 --- a/packages/ui/src/components/SubscriptionDetails/index.tsx +++ b/packages/ui/src/components/SubscriptionDetails/index.tsx @@ -8,6 +8,7 @@ import type { import * as React from 'react'; import { useCallback, useContext, useState } from 'react'; +import { Users } from '@/icons'; import { useProtect } from '@/ui/common/Gate'; import { SubscriptionDetailsContext, @@ -36,12 +37,14 @@ import { Flex, Flow, Heading, + Icon, localizationKeys, Spinner, Text, useLocalizations, } from '../../customizables'; import { SubscriptionBadge } from '../Subscriptions/badge'; +import { common } from '@/styledSystem'; const isFreePlan = (plan: BillingPlanResource) => !plan.hasBaseFee; @@ -518,6 +521,7 @@ const SubscriptionCard = ({ subscription }: { subscription: BillingSubscriptionI sx={t => ({ borderRadius: t.radii.$md, boxShadow: t.shadows.$tableBodyShadow, + overflow: 'hidden', })} > ({ padding: t.space.$3, + background: common.mutedBackground(t), })} > {/* Header with name and badge */} {subscription.plan.avatarUrl ? ( @@ -543,44 +549,86 @@ const SubscriptionCard = ({ subscription }: { subscription: BillingSubscriptionI /> ) : null} - ({ - fontSize: t.fontSizes.$lg, - fontWeight: t.fontWeights.$semibold, - color: t.colors.$colorForeground, - marginInlineEnd: 'auto', - })} + {/* Pricing details */} + - {subscription.plan.name} - - - - - {/* Pricing details */} - - ({ - fontWeight: t.fontWeights.$medium, - textTransform: 'lowercase', - })} - > - {fee.currencySymbol} - {fee.amountFormatted} /{' '} - {t(localizationKeys(`billing.${subscription.planPeriod === 'month' ? 'month' : 'year'}`))} - + ({ + fontSize: t.fontSizes.$lg, + fontWeight: t.fontWeights.$semibold, + color: t.colors.$colorForeground, + })} + > + {subscription.plan.name} + + + ({ + fontWeight: t.fontWeights.$medium, + textTransform: 'lowercase', + })} + > + {fee.currencySymbol} + {fee.amountFormatted} + + ({ + fontWeight: t.fontWeights.$medium, + textTransform: 'lowercase', + whiteSpace: 'pre', + })} + > + {` / ${t(localizationKeys(`billing.${subscription.planPeriod === 'month' ? 'month' : 'year'}`))}`} + + + + + + + {subscription.seats ? ( + ({ + display: 'inline-flex', + alignItems: 'center', + gap: t.space.$1, + })} + > + + + + } + value={ + subscription.seats.quantity === null + ? localizationKeys('billing.pricingTable.seatCost.unlimitedSeats') + : localizationKeys('billing.pricingTable.seatCost.upToSeats', { + endsAfterBlock: subscription.seats.quantity, + }) + } + /> + ) : null} + {subscription.pastDueAt ? ( ( +const DetailRow = ({ + label, + labelNode, + value, + variant, +}: { + label?: LocalizationKey; + labelNode?: React.ReactNode; + value: string | LocalizationKey; + variant?: 'header'; +}) => ( - - - {value} - + {label ? ( + + ) : null} + {labelNode ? labelNode : null} + {typeof value === 'string' ? ( + + {value} + + ) : ( + + )} );