Skip to content

Commit 4a2dba6

Browse files
committed
Hide register buttons if logged in
1 parent 034d94e commit 4a2dba6

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

app/About/page.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22

33
import Link from "next/link";
44
import {aColor} from "@/lib/client/constants";
5+
import {useSession} from "next-auth/react";
56

67
export default function About() {
8+
const {data: session} = useSession();
9+
const userId = session?.user?.id
710

811
return (
912
<div className="text-gray-600 dark:text-white min-h-screen p-6">
@@ -17,14 +20,14 @@ export default function About() {
1720
<h3 className="text-3xl font-bold mb-2">To find your people with ease.</h3>
1821
</div>
1922
</div>
20-
<div className="flex justify-center mb-8">
23+
{!userId && <div className="flex justify-center mb-8">
2124
<Link
2225
href="/register"
2326
className="px-8 py-3 text-white text-lg rounded-full font-bold shadow transition bg-gradient-to-r from-red-700 to-red-900 hover:from-red-800 hover:to-red-950"
2427
>
2528
Join Now
2629
</Link>
27-
</div>
30+
</div>}
2831
</div>
2932
</div>
3033
<div className="et_pb_text_inner">
@@ -53,14 +56,14 @@ export default function About() {
5356
</div>
5457
</div>
5558
</div>
56-
<div className="flex justify-center mt-8 mb-8">
59+
{!userId && <div className="flex justify-center mt-8 mb-8">
5760
<Link
5861
href="/register"
5962
className="px-8 py-3 text-white text-lg rounded-full font-bold shadow transition bg-gradient-to-r from-red-700 to-red-900 hover:from-red-800 hover:to-red-950"
6063
>
6164
Get Started
6265
</Link>
63-
</div>
66+
</div>}
6467
<div className="w-screen relative left-1/2 right-1/2 -ml-[50vw] -mr-[50vw] bg-gray-100 dark:bg-gray-800 py-8 mt-12 overflow-hidden">
6568
<div className="relative z-10 max-w-3xl mx-auto px-4">
6669
<h3 className="text-4xl font-bold text-center mt-8 mb-8">Help Compass</h3>
@@ -125,14 +128,14 @@ export default function About() {
125128
<p className="mb-4 text-center">Thank you for supporting us!</p>
126129
</div>
127130
</div>
128-
<div className="flex justify-center mt-12 mb-16">
131+
{!userId && <div className="flex justify-center mt-12 mb-16">
129132
<Link
130133
href="/register"
131134
className="px-8 py-3 text-white text-lg rounded-full font-bold shadow transition bg-gradient-to-r from-red-700 to-red-900 hover:from-red-800 hover:to-red-950"
132135
>
133136
Join Compass
134137
</Link>
135-
</div>
138+
</div>}
136139
</div>
137140
</div>
138141
</div>

app/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,14 @@ export default function HomePage() {
7272
{/*</p>*/}
7373
{/* Spacer */}
7474
<div className="h-10"></div>
75-
<div className="py-8">
75+
{!userId && <div className="py-8">
7676
<Link href="/register"
7777
className={`${fontStyle} bg-gradient-to-r from-red-600 to-red-800 text-white rounded-full hover:from-red-700 hover:to-red-900`}>
7878
Join Compass
7979
</Link>
8080
{/* Spacer */}
8181
{/*<div className="h-16"></div>*/}
82-
</div>
82+
</div>}
8383
{/* Why Compass Bar */}
8484
<div className="w-full bg-gray-50 dark:bg-gray-900 py-8 mt-20">
8585
<div className="max-w-6xl mx-auto px-4">

0 commit comments

Comments
 (0)