-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7c65bfe
commit b6747bc
Showing
7 changed files
with
99 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
'use client' | ||
|
||
import { Zap } from "lucide-react"; | ||
import { useEffect, useState } from "react"; | ||
|
||
import { Button } from "@/components/ui/button"; | ||
import { Card, CardContent } from "@/components/ui/card"; | ||
import { Progress } from "@/components/ui/progress"; | ||
import { MAX_FREE_COUNTS } from "@/constants"; | ||
// import { useProModal } from "@/hooks/use-pro-modal"; | ||
|
||
interface FreeCounterProps { | ||
isPro?: boolean; | ||
apiLimitCount: number; | ||
} | ||
|
||
export const FreeCounter: React.FC<FreeCounterProps> = ({ isPro = false, apiLimitCount = 0 }) => { | ||
const [mounted, setMounted] = useState(false); | ||
// const proModal = useProModal(); | ||
|
||
useEffect(() => setMounted(true), []); | ||
|
||
if (!mounted) return null | ||
|
||
if (isPro) return null | ||
|
||
return ( | ||
<div className="px-3"> | ||
<Card className="bg-white/10 border-0"> | ||
<CardContent className="py-6"> | ||
<div className="text-center text-sm text-white mb-4 space-y-2"> | ||
<p> | ||
{apiLimitCount} / {MAX_FREE_COUNTS} Free Generations | ||
</p> | ||
<Progress className="h-3" value={(apiLimitCount / MAX_FREE_COUNTS) * 100} /> | ||
</div> | ||
<Button variant="premium" className="w-full"> | ||
Upgrade | ||
<Zap className="w-4 h-4 ml-2 fill-white" /> | ||
</Button> | ||
</CardContent> | ||
</Card> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
"use client" | ||
|
||
import * as React from "react" | ||
import * as ProgressPrimitive from "@radix-ui/react-progress" | ||
|
||
import { cn } from "@/lib/utils" | ||
|
||
const Progress = React.forwardRef< | ||
React.ElementRef<typeof ProgressPrimitive.Root>, | ||
React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root> | ||
>(({ className, value, ...props }, ref) => ( | ||
<ProgressPrimitive.Root | ||
ref={ref} | ||
className={cn( | ||
"relative h-4 w-full overflow-hidden rounded-full bg-secondary", | ||
className | ||
)} | ||
{...props} | ||
> | ||
<ProgressPrimitive.Indicator | ||
className="h-full w-full flex-1 bg-primary transition-all" | ||
style={{ transform: `translateX(-${100 - (value || 0)}%)` }} | ||
/> | ||
</ProgressPrimitive.Root> | ||
)) | ||
Progress.displayName = ProgressPrimitive.Root.displayName | ||
|
||
export { Progress } |