Skip to content

Commit 9c655f0

Browse files
committed
chore: add loading state in account
1 parent 7b54236 commit 9c655f0

1 file changed

Lines changed: 45 additions & 35 deletions

File tree

  • apps/web/src/app/(main)/dashboard/account

apps/web/src/app/(main)/dashboard/account/page.tsx

Lines changed: 45 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,50 +5,60 @@ import Link from "next/link";
55
import { ArrowLeft } from "lucide-react";
66

77
export default function AccountPage() {
8-
const { isPaidUser } = useSubscription();
8+
const { isPaidUser, isLoading } = useSubscription();
99

1010
const plan = isPaidUser ? "Pro" : "Free";
1111

1212
return (
1313
<div className="w-full h-full flex flex-col p-6 bg-ox-content">
14-
<div className="mb-6">
15-
<Link
16-
href="/dashboard/home"
17-
className="inline-flex items-center gap-2 text-ox-purple hover:text-ox-purple-2 transition-colors mb-4"
18-
>
19-
<ArrowLeft className="h-4 w-4" />
20-
<span>Back to Dashboard</span>
21-
</Link>
22-
<h1 className="text-2xl md:text-3xl font-semibold text-white">
23-
Account Settings
24-
</h1>
25-
</div>
14+
{isLoading ? (
15+
<div className="flex items-center justify-center h-full">
16+
<span className="text-zinc-400">Loading...</span>
17+
</div>
18+
) : (
19+
<>
20+
<div className="mb-6">
21+
<Link
22+
href="/dashboard/home"
23+
className="inline-flex items-center gap-2 text-ox-purple hover:text-ox-purple-2 transition-colors mb-4"
24+
>
25+
<ArrowLeft className="h-4 w-4" />
26+
<span>Back to Dashboard</span>
27+
</Link>
28+
<h1 className="text-2xl md:text-3xl font-semibold text-white">
29+
Account Settings
30+
</h1>
31+
</div>
2632

27-
<div className="bg-ox-sidebar border border-ox-header rounded-lg p-6 max-w-2xl">
28-
<div className="space-y-4">
29-
<div>
30-
<label className="text-sm text-zinc-400 mb-2 block">Plan</label>
31-
<div className="flex items-center gap-2">
32-
<span className="text-lg font-semibold text-white">{plan}</span>
33-
{isPaidUser && (
34-
<span className="px-2 py-0.5 rounded-full bg-ox-purple/20 border border-ox-purple text-ox-purple text-xs font-medium">
35-
Active
36-
</span>
33+
<div className="bg-ox-sidebar border border-ox-header rounded-lg p-6 max-w-2xl">
34+
<div className="space-y-4">
35+
<div>
36+
<label className="text-sm text-zinc-400 mb-2 block">Plan</label>
37+
<div className="flex items-center gap-2">
38+
<span className="text-lg font-semibold text-white">
39+
{plan}
40+
</span>
41+
{isPaidUser && (
42+
<span className="px-2 py-0.5 rounded-full bg-ox-purple/20 border border-ox-purple text-ox-purple text-xs font-medium">
43+
Active
44+
</span>
45+
)}
46+
</div>
47+
</div>
48+
{!isPaidUser && (
49+
<div>
50+
<Link
51+
href="/pricing"
52+
className="inline-flex items-center justify-center px-3 py-1.5 bg-ox-purple hover:bg-ox-purple-2 text-white rounded-md transition-colors text-xs font-medium"
53+
>
54+
be a pro
55+
</Link>
56+
</div>
3757
)}
3858
</div>
3959
</div>
40-
{!isPaidUser && (
41-
<div>
42-
<Link
43-
href="/pricing"
44-
className="inline-flex items-center justify-center px-3 py-1.5 bg-ox-purple hover:bg-ox-purple-2 text-white rounded-md transition-colors text-xs font-medium"
45-
>
46-
be a pro
47-
</Link>
48-
</div>
49-
)}
50-
</div>
51-
</div>
60+
</>
61+
)}
5262
</div>
5363
);
5464
}

0 commit comments

Comments
 (0)