-
Notifications
You must be signed in to change notification settings - Fork 126
Expand file tree
/
Copy pathpage.tsx
More file actions
92 lines (85 loc) · 2.48 KB
/
Copy pathpage.tsx
File metadata and controls
92 lines (85 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
"use client";
import { useState } from "react";
import { PlanCard } from "@/components/subscription/PlanCard";
import { PlanType } from "@/types";
import { usePayment } from "@/hooks/usePayment";
import { motion } from "framer-motion";
import { useAuth } from "@/hooks/useAuth";
export default function SubscriptionPage() {
const [, setSelectedPlan] = useState<PlanType | null>(null);
const { handlePayment } = usePayment();
const { isAuthenticated } = useAuth();
const handlePlanSelect = async (plan: PlanType) => {
if (!isAuthenticated) return;
setSelectedPlan(plan);
await handlePayment(plan, false, "razorpay");
setSelectedPlan(null);
};
const plans = [
{
type: PlanType.basic,
name: "Basic Plan",
price: 50,
credits: 500,
features: [
"500 Credits",
"Basic Support",
"Standard Processing",
"Flux Lora",
"24/7 Email Support",
],
},
{
type: PlanType.premium,
name: "Premium Plan",
price: 100,
credits: 1000,
features: [
"1000 Credits",
"Priority Support",
"Fast Processing",
"Advanced Features",
"Flux Lora",
"Custom Solutions",
],
},
] as const;
return (
<div className="min-h-screen flex flex-col items-center justify-center px-4 py-12">
<motion.div
initial={{ opacity: 0, y: 30 }}
animate={{ opacity: 1, y: 25 }}
transition={{ duration: 0.5, ease: "easeOut" }}
className="max-w-4xl text-center"
>
<h1 className="text-4xl font-extrabold tracking-tight mb-4 text-gray-900 dark:text-white">
Choose Your Plan
</h1>
<p className="text-lg text-gray-600 dark:text-gray-400">
Find the perfect plan for your needs. Every plan includes access to
our core features.
</p>
</motion.div>
<motion.div
className="grid md:grid-cols-2 gap-8 mt-10"
initial={{ opacity: 0, scale: 0.95 }}
animate={{ opacity: 1, scale: 1 }}
transition={{ duration: 0.4, delay: 0.2 }}
>
{plans.map((plan) => (
<PlanCard
key={plan.type}
plan={{
type: plan.type,
name: plan.name,
price: plan.price,
credits: plan.credits,
features: [...plan.features],
}}
onSelect={() => handlePlanSelect(plan.type)}
/>
))}
</motion.div>
</div>
);
}