Skip to content

Commit f314a0b

Browse files
committed
feat: add upgrade CTA for free users + API cost tracking placeholder
PlanCard: free users see a highlighted upgrade banner with 'Upgrade to Pro' button and Pro benefits summary. Pro/Enterprise users see 'Active' label instead. Cost placeholder: dashed-border card at bottom with TrendingUp icon. Shows 'Token usage, cost breakdown by model, monthly spend -- coming soon.' Sets user expectation for Phase 2 metering.
1 parent ef16a8e commit f314a0b

1 file changed

Lines changed: 49 additions & 15 deletions

File tree

frontend/src/pages/UsagePage.tsx

Lines changed: 49 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88

99
import { useAuth } from '@/contexts/AuthContext'
1010
import { useUserUsage } from '@/hooks/useCachedQuery'
11-
import { BarChart3, Package, FunctionSquare, Files, Zap, Search, Server, Sparkles, Lock } from 'lucide-react'
11+
import { BarChart3, Package, FunctionSquare, Files, Zap, Search, Server, Sparkles, Lock, ArrowRight, TrendingUp } from 'lucide-react'
1212
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
13+
import { Button } from '@/components/ui/button'
1314
import { Badge } from '@/components/ui/badge'
1415
import { Separator } from '@/components/ui/separator'
1516
import { Skeleton } from '@/components/ui/Skeleton'
@@ -95,28 +96,61 @@ export function UsagePage() {
9596
</div>
9697
</CardContent>
9798
</Card>
99+
100+
<Card className="border-dashed">
101+
<CardContent className="py-8">
102+
<div className="flex flex-col items-center text-center gap-3">
103+
<div className="w-10 h-10 rounded-full bg-muted flex items-center justify-center">
104+
<TrendingUp className="w-5 h-5 text-muted-foreground" />
105+
</div>
106+
<div>
107+
<p className="text-sm font-medium">API Cost Tracking</p>
108+
<p className="text-xs text-muted-foreground mt-1 max-w-xs">
109+
Token usage, cost breakdown by model (OpenAI, Voyage, Cohere),
110+
and monthly spend tracking -- coming soon.
111+
</p>
112+
</div>
113+
</div>
114+
</CardContent>
115+
</Card>
98116
</div>
99117
)
100118
}
101119

102120

103121
function PlanCard({ tier }: { tier: string }) {
122+
const isFree = tier === 'free'
123+
104124
return (
105-
<Card>
106-
<CardContent className="flex items-center justify-between py-5">
107-
<div className="flex items-center gap-3">
108-
<span className="text-sm text-muted-foreground">Current plan</span>
109-
<Badge
110-
variant="outline"
111-
className={cn('capitalize text-sm px-3 py-1', TIER_COLORS[tier])}
112-
>
113-
{tier}
114-
</Badge>
125+
<Card className={isFree ? 'border-primary/20' : ''}>
126+
<CardContent className="py-5 space-y-4">
127+
<div className="flex items-center justify-between">
128+
<div className="flex items-center gap-3">
129+
<span className="text-sm text-muted-foreground">Current plan</span>
130+
<Badge
131+
variant="outline"
132+
className={cn('capitalize text-sm px-3 py-1', TIER_COLORS[tier])}
133+
>
134+
{tier}
135+
</Badge>
136+
</div>
137+
{!isFree && (
138+
<span className="text-xs text-muted-foreground">Active</span>
139+
)}
115140
</div>
116-
{tier === 'free' && (
117-
<span className="text-xs text-muted-foreground">
118-
Upgrade coming soon
119-
</span>
141+
{isFree && (
142+
<div className="flex items-center justify-between rounded-lg bg-primary/5 border border-primary/10 px-4 py-3">
143+
<div>
144+
<p className="text-sm font-medium">Unlock higher limits and priority indexing</p>
145+
<p className="text-xs text-muted-foreground mt-0.5">
146+
Pro: 20 repos, 20K functions/repo, Cohere reranking
147+
</p>
148+
</div>
149+
<Button size="sm" className="ml-4 shrink-0">
150+
Upgrade to Pro
151+
<ArrowRight className="w-3.5 h-3.5 ml-1" />
152+
</Button>
153+
</div>
120154
)}
121155
</CardContent>
122156
</Card>

0 commit comments

Comments
 (0)