Skip to content

Commit 76ddb0d

Browse files
committed
Show credits earned from ads on website
1 parent b693fdc commit 76ddb0d

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

web/src/app/profile/components/usage-display.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
Users,
1010
CreditCard,
1111
Star,
12+
Megaphone,
1213
} from 'lucide-react'
1314
import React from 'react'
1415

@@ -31,7 +32,7 @@ interface UsageDisplayProps {
3132
isLoading?: boolean
3233
}
3334

34-
type FilteredGrantType = Exclude<GrantType, 'organization' | 'ad'>
35+
type FilteredGrantType = Exclude<GrantType, 'organization'>
3536

3637
const grantTypeInfo: Record<
3738
FilteredGrantType,
@@ -76,6 +77,14 @@ const grantTypeInfo: Record<
7677
label: 'Special Grant',
7778
description: 'Special credits from Codebuff',
7879
},
80+
ad: {
81+
bg: 'bg-purple-500',
82+
text: 'text-purple-600 dark:text-purple-400',
83+
gradient: 'from-purple-500/70 to-purple-600/70',
84+
icon: <Megaphone className="h-4 w-4" />,
85+
label: 'Ad Credits',
86+
description: 'Earned from viewing ads',
87+
},
7988
}
8089

8190
interface CreditLeafProps {
@@ -227,6 +236,7 @@ export const UsageDisplay = ({
227236
referral: 0,
228237
purchase: 0,
229238
admin: 0,
239+
ad: 0,
230240
}
231241

232242
Object.entries(GRANT_PRIORITIES).forEach(([type]) => {
@@ -243,7 +253,7 @@ export const UsageDisplay = ({
243253

244254
// Group credits by expiration type (excluding organization)
245255
const expiringTypes: FilteredGrantType[] = ['free', 'referral']
246-
const nonExpiringTypes: FilteredGrantType[] = ['admin', 'purchase']
256+
const nonExpiringTypes: FilteredGrantType[] = ['admin', 'purchase', 'ad']
247257

248258
const expiringTotal = expiringTypes.reduce(
249259
(acc, type) => acc + (principals?.[type] || breakdown[type] || 0),

0 commit comments

Comments
 (0)