diff --git a/src/app/page.tsx b/src/app/page.tsx index f6a4fc2..75e466b 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -8,13 +8,17 @@ import { useEffect, useState } from "react"; import { toast } from "sonner"; import { ArrowUpRight, + Coins, Crown, Folder, Github, Loader2, + Minus, + Plus, Star, Wand, X, + Zap, } from "lucide-react"; import { useUser } from "@clerk/nextjs"; import { Skeleton } from "@/components/ui/skeleton"; @@ -28,6 +32,21 @@ import NumberTicker from "@/components/magicui/number-ticker"; import { useGenerationType } from "./usegenerationtype"; import ClientTweetCard from "@/components/magicui/client-tweet-card"; import XIcon from "@/components/svg/XIcon"; +import { + Dialog, + DialogContent, + DialogHeader, + DialogTitle, + DialogTrigger, +} from "@/components/ui/dialog"; +import { Separator } from "@/components/ui/separator"; +import { + Card, + CardContent, + CardDescription, + CardTitle, + CardHeader, +} from "@/components/ui/card"; export default function Home({ searchParams, @@ -197,6 +216,18 @@ export default function Home({ } }, [user.isSignedIn, videoStatus.data?.videos]); + const { mutate: createStripeSession } = + trpc.user.createCreditPackSession.useMutation({ + onSuccess: ({ url }) => { + if (url) window.location.href = url; + }, + }); + + const [showCredits, setShowCredits] = useState(false); + const [creditPacks, setCreditPacks] = useState(1); + const cost = creditPacks * 5; + const totalCredits = creditPacks * 25; + useEffect(() => { if (isInQueue) { toast.info("Your video is currently in queue", { icon: "🕒" }); @@ -258,31 +289,120 @@ export default function Home({ {/* Add the following block */} - {userDB?.user && - !userDB?.user?.subscribed && - (userDB?.user?.credits ?? 0) <= 0 && - !pendingVideo ? ( -
-
-
- {" "} - go pro to generate videos! - - (and to support me 🥹🫶) - -
+ {userDB?.user && !pendingVideo ? ( + + +
+ {userDB?.user?.subscribed ? null : ( +
+

+ Go Pro +

+
+

+ Generate 25 videos, 60 FPS, all agents, perfect + subtitles +

+
+ + + +
+ )} - - - -
-
+
+

+ Buy Credits +

+
+

+ Purchase credits for individual videos +

+
+ + + + + + + + Purchase Credits + + +
+
+
+ +

+ {creditPacks * 25} credits +

+
+
+ + + {creditPacks} + + +
+
+

+ Each pack: 25 credits (~2-3 videos) +

+
+

+ Total: ${creditPacks * 5} +

+ +
+
+
+
+
+
+ + ) : null} {pendingVideo && ( @@ -325,7 +445,7 @@ export default function Home({ > Create Video - Star on GitHub - + */} {/*