Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions frontend/app/(app)/pricing/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ export default function PricingPage() {
{pricingPlans.map((plan) => (
<Card
key={plan.name}
className={`relative border-muted/40 bg-muted/10 transition-all duration-300 hover:shadow-lg ${

className={`relative flex flex-col border-muted/40 bg-muted/10 transition-all duration-300 hover:shadow-lg ${
plan.highlight
? "border-primary/50 bg-primary/5 scale-[1.02]"
: "hover:border-muted/60"
Expand Down Expand Up @@ -135,7 +136,9 @@ export default function PricingPage() {
</p>
</CardHeader>

<CardContent className="space-y-4">

<CardContent className="flex flex-col flex-grow p-6 space-y-4">

<div className="space-y-2">
{plan.features.map((feature, index) => (
<div key={index} className="flex items-center gap-3">
Expand All @@ -151,15 +154,16 @@ export default function PricingPage() {
</div>
))}
</div>

<RazorpayPayment
plan={{
name: plan.name,
price: plan.price,
currency: plan.currency,
interval: plan.interval.replace("per ", ""),
}}
className={`w-full h-10 font-semibold text-sm ${

className={`mt-auto w-full h-10 font-semibold text-sm ${
plan.highlight
? "bg-primary hover:bg-primary/90 text-primary-foreground"
: "bg-muted hover:bg-muted/80 text-foreground"
Expand All @@ -174,4 +178,4 @@ export default function PricingPage() {
</div>
</div>
);
}
}
4 changes: 3 additions & 1 deletion frontend/components/RazorpayPayment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const RazorpayPayment: React.FC<RazorpayPaymentProps> = ({
const { error, isLoading: rzpLoading, Razorpay } = useRazorpay();
const [isProcessing, setIsProcessing] = useState(false);
const { user, isLoading: userLoading } = useUser();
const { userCredits } = useCredits();
const { userCredits, refetchCredits } = useCredits();
const router = useRouter();

const handlePayment = async () => {
Expand Down Expand Up @@ -108,6 +108,8 @@ const RazorpayPayment: React.FC<RazorpayPaymentProps> = ({
toast.success("Payment successful! Your subscription is being activated...", {
duration: 3000
});
await refetchCredits();
router.replace("/ask");
} else {
toast.error("Payment failed! Please try again.");
}
Expand Down