@@ -27,6 +27,7 @@ interface Props {
27
27
28
28
export default function UsageBasedBillingConfig ( { attributionId } : Props ) {
29
29
const location = useLocation ( ) ;
30
+ const { currency } = useContext ( PaymentContext ) ;
30
31
const [ showUpdateLimitModal , setShowUpdateLimitModal ] = useState < boolean > ( false ) ;
31
32
const [ showBillingSetupModal , setShowBillingSetupModal ] = useState < boolean > ( false ) ;
32
33
const [ stripeSubscriptionId , setStripeSubscriptionId ] = useState < string | undefined > ( ) ;
@@ -168,7 +169,10 @@ export default function UsageBasedBillingConfig({ attributionId }: Props) {
168
169
169
170
const showSpinner = ! attributionId || isLoadingStripeSubscription || ! ! pendingStripeSubscription ;
170
171
const showBalance = ! showSpinner && ! ( AttributionId . parse ( attributionId ) ?. kind === "team" && ! stripeSubscriptionId ) ;
171
- const showUpgradeBilling = ! showSpinner && ! stripeSubscriptionId ;
172
+ const showUpgradeTeam =
173
+ ! showSpinner && AttributionId . parse ( attributionId ) ?. kind === "team" && ! stripeSubscriptionId ;
174
+ const showUpgradeUser =
175
+ ! showSpinner && AttributionId . parse ( attributionId ) ?. kind === "user" && ! stripeSubscriptionId ;
172
176
const showManageBilling = ! showSpinner && ! ! stripeSubscriptionId ;
173
177
174
178
const updateUsageLimit = async ( newLimit : number ) => {
@@ -244,15 +248,34 @@ export default function UsageBasedBillingConfig({ attributionId }: Props) {
244
248
</ div >
245
249
</ div >
246
250
) }
247
- { showUpgradeBilling && (
248
- < div className = "flex flex-col mt-4 h-32 p-4 rounded-xl bg-gray-100 dark:bg-gray-800" >
249
- < div className = "uppercase text-sm text-gray-400 dark:text-gray-500" > Billing</ div >
250
- < div className = "text-xl font-semibold flex-grow text-gray-600 dark:text-gray-400" > Inactive</ div >
251
+ { showUpgradeTeam && (
252
+ < div className = "flex flex-col mt-4 h-32 p-4 rounded-xl bg-gray-50 dark:bg-gray-900" >
253
+ < div className = "uppercase text-sm text-gray-400 dark:text-gray-500" > Upgrade Plan</ div >
254
+ < div className = "text-xl font-semibold flex-grow text-gray-600 dark:text-gray-400" >
255
+ Pay-as-you-go
256
+ </ div >
251
257
< button className = "self-end" onClick = { ( ) => setShowBillingSetupModal ( true ) } >
252
258
Upgrade Plan
253
259
</ button >
254
260
</ div >
255
261
) }
262
+ { showUpgradeUser && (
263
+ < div className = "flex flex-col mt-4 h-32 p-4 rounded-xl bg-gray-50 dark:bg-gray-900" >
264
+ < div className = "uppercase text-sm text-gray-400 dark:text-gray-500" > Current Plan</ div >
265
+ < div className = "text-xl font-semibold flex-grow text-gray-600 dark:text-gray-400" > Free</ div >
266
+ < div className = "bg-gray-100 dark:bg-gray-800 border-t border-gray-200 dark:border-gray-800 -m-4 p-4 mt-4 rounded-b-xl" >
267
+ < div className = "uppercase text-sm text-gray-400 dark:text-gray-500" > Upgrade Plan</ div >
268
+ < div className = "text-xl font-semibold flex-grow text-gray-600 dark:text-gray-400" >
269
+ { currency === "EUR" ? "€" : "$" } 9 / month
270
+ </ div >
271
+ < div className = "flex flex-col" >
272
+ < button className = "self-end" onClick = { ( ) => setShowBillingSetupModal ( true ) } >
273
+ Upgrade Plan
274
+ </ button >
275
+ </ div >
276
+ </ div >
277
+ </ div >
278
+ ) }
256
279
{ showManageBilling && (
257
280
< div className = "max-w-xl flex space-x-4" >
258
281
< div className = "flex-grow flex flex-col mt-4 h-32 p-4 rounded-xl bg-gray-50 dark:bg-gray-900" >
0 commit comments