@@ -4,19 +4,30 @@ import Image from "next/image";
4
4
import { H1 , Paragraph } from "../components/typography" ;
5
5
import { Input } from "../components/input" ;
6
6
import { Button } from "../components/button" ;
7
- import { useBoolean , useWindowSize } from "usehooks-ts" ;
7
+ import { useBoolean } from "usehooks-ts" ;
8
8
import { registerWaitlist } from "@/services/waitlist" ;
9
- import { FormEventHandler , useState } from "react" ;
9
+ import { FormEventHandler , useEffect , useState } from "react" ;
10
10
import { BsDiscord , BsGithub , BsTwitter } from "react-icons/bs" ;
11
11
12
12
import { toast } from "sonner" ;
13
13
import Link from "next/link" ;
14
14
15
15
export default function Home ( ) {
16
- const widthLandingProto = 1024 ;
17
- const { width } = useWindowSize ( ) ;
16
+ const [ isMobile , setIsMobile ] = useState < boolean | null > ( null ) ;
18
17
19
- const matches = width < widthLandingProto ;
18
+ useEffect ( ( ) => {
19
+ // Check for the navigator object on the client side
20
+ if ( typeof window !== "undefined" ) {
21
+ setIsMobile ( / i P h o n e | i P a d | i P o d | A n d r o i d / i. test ( navigator . userAgent ) ) ;
22
+ }
23
+ } , [ ] ) ;
24
+
25
+ const graphicsFilePath : string =
26
+ isMobile === null
27
+ ? ""
28
+ : isMobile
29
+ ? "/landing-proto-2-mobile.png"
30
+ : "/landing-proto-2.svg" ;
20
31
21
32
const [ email , setEmail ] = useState ( "" ) ;
22
33
const { value : submitted , setTrue } = useBoolean ( ) ;
@@ -40,13 +51,14 @@ export default function Home() {
40
51
} ;
41
52
42
53
return (
43
- < main className = "flex relative min-h-screen lg:flex-row flex-col gap-5 items-center justify-between py-15 px-10 pb-0 bg-dark-teal-gradient" >
54
+ < main className = "flex relative min-h-screen lg:flex-row flex-col gap-5 items-center justify-between py-15 px-0 pb-0 bg-dark-teal-gradient" >
44
55
< div className = "h-full flex flex-col items-center justify-start gap-[5px] pt-[20px]" >
45
56
< div className = "flex items-center justify-center gap-[10px] py-[10px]" >
46
57
< Image
47
58
src = "/logo.svg"
48
59
width = { 50 }
49
60
height = { 50 }
61
+ priority
50
62
alt = "Supernova's logo, a ball with linear gradient from left to right, light teal to orange"
51
63
/>
52
64
< H1 > Supernova</ H1 >
@@ -110,21 +122,10 @@ export default function Home() {
110
122
</ div >
111
123
</ div >
112
124
< div className = "relative w-full md:h-[700px] sm:h-[600px] h-[500px]" >
113
- { matches ? (
114
- < Image
115
- // src={"/today-view.svg"}
116
- // fill
117
- // style={{ objectFit: "contain" }}
118
- // alt="The prototype showcasing Supernova, a productivity app"
119
-
120
- src = { "/landing-proto-2.svg" }
121
- fill
122
- style = { { objectFit : "contain" } }
123
- alt = "The prototype showcasing Supernova, a productivity app"
124
- />
125
- ) : (
125
+ { graphicsFilePath === "" ? null : (
126
126
< Image
127
- src = { "/landing-proto-2.svg" }
127
+ src = { graphicsFilePath }
128
+ priority
128
129
fill
129
130
style = { { objectFit : "contain" , bottom : 0 , right : 0 } }
130
131
alt = "The prototype showcasing Supernova, a productivity app"
0 commit comments