22
33import ProfilePage from "@/app/profiles/page" ;
44import Link from "next/link" ;
5- import React from 'react' ; // ← Add this line here
5+ import { useEffect } from 'react' ;
6+ import { useSession } from "next-auth/react" ; // ← Add this line here
67
78export const dynamic = "force-dynamic" ; // This disables SSG and ISR
89
910
1011export default function HomePage ( ) {
11- const profilePage = ( ) => {
12- return (
13- < main className = "min-h-screen flex flex-col" >
14- < ProfilePage />
15- </ main >
16- )
17- }
12+ const { data : session } = useSession ( ) ;
13+ const userId = session ?. user ?. id
14+ console . log ( "session:" , userId )
15+
1816 const fontStyle = "transition px-5 py-3 text-3xl font-medium xs:text-sm"
1917
20-
21- React . useEffect ( ( ) => {
22- const text = "Search." ;
23- const typewriter = document . getElementById ( "typewriter" ) ;
24- let i = 0 ;
25- let timeoutId : any ;
26- let intervalId ;
27-
28- // Clear any existing content
29- if ( typewriter ) {
30- typewriter . textContent = "" ;
31- }
32-
33- function typeWriter ( ) {
34- if ( i < text . length && typewriter ) {
35- typewriter . textContent = text . substring ( 0 , i + 1 ) ;
36- i ++ ;
37- timeoutId = setTimeout ( typeWriter , 150 ) ;
38- }
39- }
40-
41- // Start typing after delay
42- intervalId = setTimeout ( ( ) => {
43- typeWriter ( ) ;
44- } , 500 ) ;
45-
46- // Cleanup function - this runs when component unmounts
47- return ( ) => {
48- clearTimeout ( timeoutId ) ;
49- clearTimeout ( intervalId ) ;
50- if ( typewriter ) {
51- typewriter . textContent = "Search." ; // Just show the full text
18+ useEffect ( ( ) => {
19+ const text = "Search." ;
20+ const typewriter = document . getElementById ( "typewriter" ) ;
21+ let i = 0 ;
22+ let timeoutId : any ;
23+ let intervalId ;
24+
25+ // Clear any existing content
26+ if ( typewriter ) typewriter . textContent = ""
27+
28+ function typeWriter ( ) {
29+ if ( i < text . length && typewriter ) {
30+ typewriter . textContent = text . substring ( 0 , i + 1 ) ;
31+ i ++ ;
32+ timeoutId = setTimeout ( typeWriter , 150 ) ;
33+ }
5234 }
53- } ;
54- } , [ ] ) ;
35+
36+ // Start typing after delay
37+ intervalId = setTimeout ( ( ) => typeWriter ( ) , 500 ) ;
38+
39+ // Cleanup function - this runs when component unmounts
40+ return ( ) => {
41+ clearTimeout ( timeoutId ) ;
42+ clearTimeout ( intervalId ) ;
43+ if ( typewriter ) typewriter . textContent = "Search."
44+ } ;
45+ } , [ ] ) ;
46+
5547 return (
5648 < main className = "min-h-screen flex flex-col" >
5749 { /* Header */ }
@@ -70,25 +62,26 @@ React.useEffect(() => {
7062
7163 { /* Hero Section */ }
7264 < section className = "flex flex-col items-center justify-start flex-1 text-center px-4" >
73- < div className = "h-20" > </ div >
74- < h1 className = "pt-48 pb-2 text-7xl md:text-8xl xs:text-6xl font-extrabold max-w-4xl leading-tight xl:whitespace-nowrap md:whitespace-nowrap " >
65+ < div className = "h-10" > </ div >
66+ < h1
67+ className = "pt-12 pb-2 text-7xl md:text-8xl xs:text-6xl font-extrabold max-w-4xl leading-tight xl:whitespace-nowrap md:whitespace-nowrap " >
7568 Don't Swipe. < span id = "typewriter" > </ span > < span id = "cursor" className = "animate-pulse" > |</ span >
7669 </ h1 >
7770 { /*<p className="mt-6 text-lg md:text-xl text-gray-400 max-w-2xl">*/ }
7871 { /* {"Tired of swiping? Search what you're looking for!"}*/ }
7972 { /*</p>*/ }
8073 { /* Spacer */ }
8174 < div className = "h-10" > </ div >
82- < div className = "py-18" >
83- < Link href = "/register" className = { `${ fontStyle } bg-gradient-to-r from-red-600 to-red-800 text-white rounded-full hover:from-red-700 hover:to-red-900` } >
75+ < div className = "py-8" >
76+ < Link href = "/register"
77+ className = { `${ fontStyle } bg-gradient-to-r from-red-600 to-red-800 text-white rounded-full hover:from-red-700 hover:to-red-900` } >
8478 Join Compass
85-
8679 </ Link >
87- { /* Spacer */ }
88- < div className = "h-52 " > </ div >
80+ { /* Spacer */ }
81+ { /* <div className="h-16 "></div>*/ }
8982 </ div >
9083 { /* Why Compass Bar */ }
91- < div className = "w-full bg-gray-50 dark:bg-gray-900 py-16 mt-20" >
84+ < div className = "w-full bg-gray-50 dark:bg-gray-900 py-8 mt-20" >
9285 < div className = "max-w-6xl mx-auto px-4" >
9386 < div className = "grid md:grid-cols-3 gap-8 text-center" >
9487 < div className = "space-y-2" >
@@ -97,14 +90,14 @@ React.useEffect(() => {
9790 No algorithms. Every profile searchable.
9891 </ p >
9992 </ div >
100-
93+
10194 < div className = "space-y-2" >
10295 < h3 className = "text-lg font-bold" > Built for Depth</ h3 >
10396 < p className = "text-gray-600 dark:text-gray-400" >
10497 Filter by any keyword and what matters most.
10598 </ p >
10699 </ div >
107-
100+
108101 < div className = "space-y-2" >
109102 < h3 className = "text-lg font-bold" > Community Owned</ h3 >
110103 < p className = "text-gray-600 dark:text-gray-400" >
@@ -115,10 +108,16 @@ React.useEffect(() => {
115108 </ div >
116109 </ div >
117110 { /* Spacer */ }
118- < div className = "h-20" > </ div >
119- < div className = " w-full py-18" >
120- { profilePage ( ) }
121- </ div >
111+ { userId &&
112+ < >
113+ { /*<div className="h-20"></div>*/ }
114+ < div className = " w-full py-10" >
115+ < main className = "min-h-screen flex flex-col" >
116+ < ProfilePage />
117+ </ main >
118+ </ div >
119+ </ >
120+ }
122121 </ section >
123122 </ main >
124123 ) ;
0 commit comments