omninexus-ai / components /PricingView.tsx
aditya9708's picture
Auto-deploy from AI Studio
e4c7604 verified
Raw History Blame Contribute Delete
4.51 kB
import React, { useState } from 'react';
import PaymentGateway from './PaymentGateway';
interface PricingViewProps {
onPaymentSuccess: (amount: number, credits: number) => void;
}
const PricingView: React.FC<PricingViewProps> = ({ onPaymentSuccess }) => {
const [selectedPlan, setSelectedPlan] = useState<{name: string, price: number, credits: number} | null>(null);
const plans = [
{
name: 'Starter',
price: 0,
credits: 500,
description: 'Perfect for exploring AI capabilities.',
features: ['500 Monthly Credits', 'Standard Chat', '1:1 Images', 'Watermarked Videos'],
button: 'Current Plan',
current: true
},
{
name: 'Pro',
price: 1599, // INR
credits: 5000,
description: 'For power users and creators.',
features: ['5,000 Monthly Credits', 'Google Search Grounding', 'HD Image Generation', 'Veo 3.1 Fast Video', 'Priority Support'],
button: 'Upgrade to Pro',
current: false,
popular: true
},
{
name: 'Agency',
price: 7999, // INR
credits: 50000,
description: 'Unlimited potential for teams.',
features: ['50,000 Monthly Credits', 'API Access', 'Custom Model Tuning', 'Dedicated Manager', 'White-label Support'],
button: 'Get Agency',
current: false
}
];
const handleUpgrade = (plan: any) => {
if (plan.current) return;
setSelectedPlan({ name: plan.name, price: plan.price, credits: plan.credits });
};
return (
<div className="max-w-6xl mx-auto py-20 px-6">
<div className="text-center mb-16">
<h2 className="text-5xl font-black mb-4 tracking-tight">Fuel Your Creativity</h2>
<p className="text-slate-500 text-lg max-w-2xl mx-auto">Choose the plan that fits your ambition. Prices converted to INR for Indian users.</p>
</div>
<div className="grid grid-cols-1 md:grid-cols-3 gap-8">
{plans.map((plan) => (
<div key={plan.name} className={`relative bg-[#0a0f1e] border p-10 rounded-[40px] flex flex-col transition-all duration-500 ${plan.popular ? 'border-indigo-500 ring-2 ring-indigo-500/20 scale-105 z-10' : 'border-slate-800 hover:border-slate-700'}`}>
{plan.popular && (
<div className="absolute -top-4 left-1/2 -translate-x-1/2 bg-indigo-500 text-white text-[9px] font-black uppercase tracking-[0.3em] px-5 py-2 rounded-full shadow-xl shadow-indigo-500/30">
Most Popular
</div>
)}
<h3 className="text-2xl font-black mb-2 uppercase tracking-tighter">{plan.name}</h3>
<div className="flex items-baseline gap-2 mb-6">
<span className="text-4xl font-black">₹{plan.price.toLocaleString('en-IN')}</span>
<span className="text-slate-500 text-xs font-bold uppercase tracking-widest">/month</span>
</div>
<p className="text-slate-500 text-sm mb-10 font-medium leading-relaxed">{plan.description}</p>
<ul className="flex-1 space-y-5 mb-12">
{plan.features.map((feat) => (
<li key={feat} className="flex items-center gap-4 text-xs font-bold text-slate-300">
<div className="w-5 h-5 rounded-full bg-indigo-500/10 flex items-center justify-center">
<svg className="w-3 h-3 text-indigo-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path strokeLinecap="round" strokeLinejoin="round" strokeWidth={3} d="M5 13l4 4L19 7" /></svg>
</div>
{feat}
</li>
))}
</ul>
<button
onClick={() => handleUpgrade(plan)}
className={`w-full py-5 rounded-2xl font-black uppercase tracking-widest text-xs transition-all ${plan.current ? 'bg-slate-800 text-slate-500 cursor-default' : 'premium-gradient text-white hover:scale-105 shadow-2xl shadow-indigo-600/20 active:scale-95'}`}
>
{plan.button}
</button>
</div>
))}
</div>
{selectedPlan && (
<PaymentGateway
planName={selectedPlan.name}
amount={selectedPlan.price}
creditAmount={selectedPlan.credits}
onClose={() => setSelectedPlan(null)}
onSuccess={() => {
onPaymentSuccess(selectedPlan.price, selectedPlan.credits);
setSelectedPlan(null);
}}
/>
)}
</div>
);
};
export default PricingView;