@@ -12,68 +12,28 @@ import { AutoTopupSettings } from '@/components/billing/auto-topup-settings'
1212import { CreditActivity } from '@/components/billing/credit-activity'
1313import { UsageAnalytics } from '@/components/billing/usage-analytics'
1414import { Loading } from '@/components/shared/loading'
15- import { Card , CardContent , CardHeader , CardTitle } from '@/components/ui/card'
16- import { ArrowDownToLine , CreditCard , Sparkles } from 'lucide-react'
1715
1816export default function BillingPage ( ) {
1917 const { usage, isLoading : usageLoading } = useUsage ( )
2018 const { credits, isLoading : creditsLoading , mutate } = useCredits ( )
2119 const { instances, isLoading : instancesLoading } = useInstances ( )
2220
23- if ( usageLoading || creditsLoading || instancesLoading ) return < Loading />
24-
25- const topUpNowLabel = credits
26- ? `Top Up €${ credits . auto_topup_amount_eur } Now`
27- : 'Top Up Now'
21+ if ( creditsLoading || instancesLoading ) return < Loading />
2822
2923 return (
3024 < div className = "space-y-6" >
3125 < div className = "flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between" >
32- < div className = "space-y-1" >
33- < h1 className = "text-2xl font-bold" > Billing</ h1 >
34- < p className = "max-w-3xl text-sm text-muted-foreground" >
35- Keep an eye on your AI credit balance, monthly usage, and the automatic refill setup that buys more credits when your balance gets low.
36- </ p >
37- </ div >
26+ < h1 className = "text-2xl font-bold" > Billing</ h1 >
3827 < div className = "flex items-center gap-2" >
3928 < AddCreditsButton
4029 amountEur = { credits ?. auto_topup_amount_eur ?? 20 }
41- label = { topUpNowLabel }
30+ label = "+ Add Credits"
4231 onSuccess = { ( ) => mutate ( ) }
4332 />
4433 < BillingPortalButton />
4534 </ div >
4635 </ div >
4736
48- < Card className = "border border-border/70 bg-gradient-to-br from-muted/40 via-background to-background" >
49- < CardHeader >
50- < CardTitle > How billing works</ CardTitle >
51- </ CardHeader >
52- < CardContent className = "grid gap-4 lg:grid-cols-3" >
53- < div className = "rounded-xl border border-border/70 bg-background/80 p-4" >
54- < Sparkles className = "h-5 w-5 text-muted-foreground" />
55- < p className = "mt-3 font-medium" > AI usage spends credits</ p >
56- < p className = "mt-1 text-sm text-muted-foreground" >
57- Every model request deducts from your credit balance, so the balance card tells you how much AI usage you can still run.
58- </ p >
59- </ div >
60- < div className = "rounded-xl border border-border/70 bg-background/80 p-4" >
61- < ArrowDownToLine className = "h-5 w-5 text-muted-foreground" />
62- < p className = "mt-3 font-medium" > Auto top-up refills low balances</ p >
63- < p className = "mt-1 text-sm text-muted-foreground" >
64- Choose a refill amount and a threshold. When the balance drops below that threshold, we charge your default card and add more credits automatically.
65- </ p >
66- </ div >
67- < div className = "rounded-xl border border-border/70 bg-background/80 p-4" >
68- < CreditCard className = "h-5 w-5 text-muted-foreground" />
69- < p className = "mt-3 font-medium" > Cards and invoices live in Stripe</ p >
70- < p className = "mt-1 text-sm text-muted-foreground" >
71- Use the billing portal to update payment methods, recover from failed top-ups, and review invoices in one place.
72- </ p >
73- </ div >
74- </ CardContent >
75- </ Card >
76-
7737 < div className = "grid gap-4 xl:grid-cols-[1.15fr_0.85fr]" >
7838 < CurrentSpend
7939 baseCost = { usage ?. base_cost ?? 0 }
0 commit comments