File tree Expand file tree Collapse file tree
free-tier/_components/balance Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -60,11 +60,15 @@ export const HeaderCard: React.FC<Props> = ({ appId }) => {
6060 < div className = "grid grid-cols-1 md:grid-cols-7" >
6161 < div className = "flex flex-col gap-4 p-4 pt-12 md:pt-14 col-span-5" >
6262 < div className = "" >
63- < h1 className = "text-3xl font-bold break-words line-clamp-2" > { app . name } </ h1 >
63+ < h1 className = "text-3xl font-bold break-words line-clamp-2" >
64+ { app . name }
65+ </ h1 >
6466 < p
6567 className = { cn (
6668 'break-words line-clamp-2' ,
67- app . description ? 'text-muted-foreground' : 'text-muted-foreground/40'
69+ app . description
70+ ? 'text-muted-foreground'
71+ : 'text-muted-foreground/40'
6872 ) }
6973 >
7074 { app . description ?? 'No description' }
Original file line number Diff line number Diff line change @@ -75,6 +75,8 @@ export const AddCredits: React.FC<Props> = ({ appId }) => {
7575 createPaymentFromBalance ( { appId, amountInDollars : amount } ) ;
7676 } ;
7777
78+ const [ currentUserBalance ] = api . user . balance . get . useSuspenseQuery ( ) ;
79+
7880 return (
7981 < div className = "flex flex-col w-full gap-4" >
8082 < MoneyInput
@@ -95,9 +97,9 @@ export const AddCredits: React.FC<Props> = ({ appId }) => {
9597 < div className = "flex gap-3" >
9698 < Button
9799 onClick = { onAddCredits }
98- disabled = { isPending || ! amount || amount <= 0 || isSuccess }
100+ disabled = { isPending || ! amount || amount < 1 || isSuccess }
99101 size = "lg"
100- variant = "turbo "
102+ variant = "turboSecondary "
101103 className = "flex-1"
102104 >
103105 { isPending ? (
@@ -113,8 +115,9 @@ export const AddCredits: React.FC<Props> = ({ appId }) => {
113115 disabled = {
114116 isPendingFromBalance ||
115117 ! amount ||
116- amount <= 0 ||
117- isSuccessFromBalance
118+ amount < 0 ||
119+ isSuccessFromBalance ||
120+ currentUserBalance . balance < amount
118121 }
119122 size = "lg"
120123 variant = "turbo"
Original file line number Diff line number Diff line change @@ -13,8 +13,10 @@ import {
1313 DialogTitle ,
1414 DialogDescription ,
1515 DialogTrigger ,
16+ DialogFooter ,
1617} from '@/components/ui/dialog' ;
1718import { Skeleton } from '@/components/ui/skeleton' ;
19+ import { Balance as BalanceDisplay } from '@/app/(app)/_components/layout/header/balance/balance-display' ;
1820
1921import { AddCredits } from './add-credits' ;
2022
@@ -29,7 +31,9 @@ interface Props {
2931const BalanceContainer = ( { children } : { children : React . ReactNode } ) => {
3032 return (
3133 < Card className = "border rounded-lg overflow-hidden flex flex-col gap-2 p-4" >
32- < h1 className = "text-lg font-semibold text-muted-foreground" > Balance</ h1 >
34+ < h1 className = "text-lg font-semibold text-muted-foreground" >
35+ Free Tier Balance
36+ </ h1 >
3337 < div className = "flex items-center gap-4 w-full" > { children } </ div >
3438 </ Card >
3539 ) ;
@@ -58,6 +62,12 @@ export const Balance: React.FC<Props> = ({ appId }) => {
5862 Your users will be able to use free tier credits before they have
5963 to buy credits and spend their Echo balance.
6064 </ DialogDescription >
65+ < DialogFooter >
66+ < span className = "text-sm font-semibold text-muted-foreground" >
67+ Current Balance:
68+ </ span >
69+ < BalanceDisplay />
70+ </ DialogFooter >
6171 </ DialogHeader >
6272 < AddCredits appId = { appId } />
6373 </ DialogContent >
Original file line number Diff line number Diff line change @@ -32,6 +32,15 @@ const buttonVariants = cva(
3232 'before:content-[""] before:absolute before:w-full before:h-full before:rounded-md before:pointer-events-none' ,
3333 'before:bg-gradient-to-r before:from-transparent before:via-white/10 before:to-transparent before:animate-shimmer'
3434 ) ,
35+ turboSecondary : cn (
36+ 'bg-gradient-to-br from-gray-400 via-gray-500 to-gray-600 text-white hover:opacity-90' ,
37+ 'shadow-[0_2px_6px_color-mix(in_oklab,theme(colors.gray.500)_70%,transparent)]' ,
38+ 'hover:shadow-[0_2px_4px_color-mix(in_oklab,theme(colors.gray.500)_70%,transparent)]' ,
39+ 'inset-ring-2 inset-ring-inset inset-ring-border/50' ,
40+ 'relative overflow-hidden' ,
41+ 'before:content-[""] before:absolute before:w-full before:h-full before:rounded-md before:pointer-events-none' ,
42+ 'before:bg-gradient-to-r before:from-transparent before:via-white/10 before:to-transparent before:animate-shimmer'
43+ ) ,
3544 unstyled : '' ,
3645 } ,
3746 size : {
You can’t perform that action at this time.
0 commit comments