Skip to content

Commit d5a474f

Browse files
committed
completed subscription modal implementations
1 parent cd32074 commit d5a474f

2 files changed

Lines changed: 65 additions & 40 deletions

File tree

src/app/(main)/Navbar.tsx

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
1+
"use client";
2+
13
import SearchField from "@/components/SearchField";
24
import UserButton from "@/components/UserButton";
35
import Link from "next/link";
4-
import LanguageSwitcher from "../../components/LanguageSwitcher"; // Adjusted path
6+
import LanguageSwitcher from "../../components/LanguageSwitcher";
7+
import SubscriptionModal from "./SubscriptionModal"; // 👈 Import your modal
58

69
export default function Navbar() {
710
return (
811
<header className="sticky top-0 z-10 bg-card shadow-sm">
9-
<div className="mx-auto flex max-w-7xl flex-wrap items-center justify-center gap-5 px-5 py-3">
10-
<Link href="/" className="text-2xl font-bold text-primary">
11-
GoTogether
12-
</Link>
12+
<div className="mx-auto flex max-w-7xl flex-wrap items-center justify-between gap-5 px-5 py-3">
13+
{/* Left: Modal Button + Logo */}
14+
<div className="flex items-center gap-3">
15+
<SubscriptionModal /> {/* 👈 Trigger is inside this component */}
16+
<Link href="/" className="text-2xl font-bold text-primary">
17+
GoTogether
18+
</Link>
19+
</div>
20+
21+
{/* Center: Search */}
1322
<SearchField />
14-
<div className="flex items-center gap-3 sm:ms-auto"> {/* Wrapper div for UserButton and LanguageSwitcher */}
23+
24+
{/* Right: Language Switcher & User */}
25+
<div className="flex items-center gap-3 sm:ms-auto">
1526
<LanguageSwitcher />
1627
<UserButton />
1728
</div>

src/app/(main)/SubscriptionModal.tsx

Lines changed: 48 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
DialogTrigger,
2020
} from "@/components/ui/dialog";
2121
import { cn } from "@/lib/utils";
22+
import { CheckCircle2, Zap, ShieldCheck, UserCheck } from "lucide-react";
2223

2324
export default function SubscriptionModal() {
2425
const [open, setOpen] = useState(false);
@@ -28,20 +29,20 @@ export default function SubscriptionModal() {
2829
name: "Free",
2930
price: "$0/mo",
3031
features: [
31-
"Access to basic features",
32-
"Limited support",
33-
"Community access",
32+
{ label: "Access to basic features", icon: CheckCircle2 },
33+
{ label: "Limited support", icon: UserCheck },
34+
{ label: "Community access", icon: ShieldCheck },
3435
],
35-
cta: "Subscribe",
36+
cta: "Start Free",
3637
popular: false,
3738
},
3839
{
3940
name: "Pro",
4041
price: "$10/mo",
4142
features: [
42-
"Access to Pro features",
43-
"Priority email support",
44-
"Advanced analytics",
43+
{ label: "Access to Pro features", icon: Zap },
44+
{ label: "Priority email support", icon: ShieldCheck },
45+
{ label: "Advanced analytics", icon: CheckCircle2 },
4546
],
4647
cta: "Get Pro",
4748
popular: true,
@@ -50,68 +51,78 @@ export default function SubscriptionModal() {
5051
name: "Plus",
5152
price: "$25/mo",
5253
features: [
53-
"Access to all features",
54-
"24/7 phone support",
55-
"Dedicated account manager",
54+
{ label: "All features unlocked", icon: Zap },
55+
{ label: "24/7 phone support", icon: ShieldCheck },
56+
{ label: "Dedicated account manager", icon: UserCheck },
5657
],
57-
cta: "Get Plus",
58+
cta: "Go Plus",
5859
popular: false,
5960
},
6061
];
6162

6263
return (
6364
<Dialog open={open} onOpenChange={setOpen}>
6465
<DialogTrigger asChild>
65-
<Button variant="outline">View Subscription Plans</Button>
66+
<Button
67+
variant="outline"
68+
className="font-semibold"
69+
aria-label="Open subscription plans"
70+
>
71+
Plans
72+
</Button>
6673
</DialogTrigger>
67-
<DialogContent className="max-w-5xl">
74+
<DialogContent className="max-w-6xl p-6 sm:p-8">
6875
<DialogHeader>
69-
<DialogTitle className="text-center text-2xl">
70-
Choose Your Plan
76+
<DialogTitle className="text-center text-3xl font-extrabold text-primary">
77+
Choose the Right Plan for You
7178
</DialogTitle>
7279
</DialogHeader>
73-
<div className="flex flex-col items-stretch justify-center gap-6 md:flex-row">
80+
<div className="mt-6 flex flex-col gap-6 sm:flex-row sm:flex-wrap sm:justify-center">
7481
{plans.map((plan) => (
7582
<Card
7683
key={plan.name}
7784
className={cn(
78-
"flex w-full flex-col shadow-lg transition-shadow duration-300 hover:shadow-xl md:max-w-sm",
79-
plan.popular
80-
? "transform border-2 border-primary md:scale-105"
81-
: "border",
85+
"relative flex w-full flex-col justify-between border shadow-lg transition-transform hover:scale-[1.03] sm:w-72",
86+
plan.popular && "border-primary ring-2 ring-primary",
8287
)}
8388
>
84-
<CardHeader
85-
className={cn("p-6 text-center", plan.popular && "relative")}
86-
>
89+
<CardHeader className="p-6 text-center">
8790
{plan.popular && (
88-
<Badge className="absolute right-0 top-0 -mr-3 -mt-3">
89-
Popular
91+
<Badge
92+
className="absolute right-4 top-4 animate-pulse"
93+
variant="outline"
94+
>
95+
⭐ Best Value
9096
</Badge>
9197
)}
92-
<CardTitle className="text-2xl font-semibold">
98+
<CardTitle className="text-2xl font-bold">
9399
{plan.name}
94100
</CardTitle>
95-
<CardDescription className="text-xl font-medium">
101+
<CardDescription className="mt-1 text-lg text-muted-foreground">
96102
{plan.price}
97103
</CardDescription>
98104
</CardHeader>
99-
<CardContent className="flex-grow p-6">
100-
<ul className="list-inside list-disc space-y-2 text-sm">
101-
{plan.features.map((feature) => (
102-
<li key={feature}>{feature}</li>
105+
<CardContent className="p-6">
106+
<ul className="space-y-4 text-left text-sm">
107+
{plan.features.map((feature, idx) => (
108+
<li key={idx} className="flex items-center gap-3">
109+
<feature.icon className="h-5 w-5 text-green-600" />
110+
<span>{feature.label}</span>
111+
</li>
103112
))}
104113
</ul>
105114
</CardContent>
106115
<CardFooter className="p-6">
107116
<Button
108117
className={cn(
109-
"w-full font-semibold",
110-
plan.popular ? "bg-primary hover:bg-primary/90" : "",
118+
"w-full",
119+
plan.popular
120+
? "bg-primary text-white hover:bg-primary/90"
121+
: "",
111122
)}
112123
onClick={() => {
113124
setOpen(false);
114-
// handleSubscribe(plan.name); // Add logic if needed
125+
// handleSubscribe(plan.name);
115126
}}
116127
>
117128
{plan.cta}
@@ -120,6 +131,9 @@ export default function SubscriptionModal() {
120131
</Card>
121132
))}
122133
</div>
134+
<p className="mx-auto mt-6 max-w-xl text-center text-sm text-muted-foreground">
135+
You can switch or cancel your plan anytime from your account settings.
136+
</p>
123137
</DialogContent>
124138
</Dialog>
125139
);

0 commit comments

Comments
 (0)