Skip to content

Commit e85619b

Browse files
committed
fix blurry image on actual mobile
1 parent d6d6e1c commit e85619b

File tree

4 files changed

+21
-432
lines changed

4 files changed

+21
-432
lines changed

apps/www/app/page.tsx

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,30 @@ import Image from "next/image";
44
import { H1, Paragraph } from "../components/typography";
55
import { Input } from "../components/input";
66
import { Button } from "../components/button";
7-
import { useBoolean, useWindowSize } from "usehooks-ts";
7+
import { useBoolean } from "usehooks-ts";
88
import { registerWaitlist } from "@/services/waitlist";
9-
import { FormEventHandler, useState } from "react";
9+
import { FormEventHandler, useEffect, useState } from "react";
1010
import { BsDiscord, BsGithub, BsTwitter } from "react-icons/bs";
1111

1212
import { toast } from "sonner";
1313
import Link from "next/link";
1414

1515
export default function Home() {
16-
const widthLandingProto = 1024;
17-
const { width } = useWindowSize();
16+
const [isMobile, setIsMobile] = useState<boolean | null>(null);
1817

19-
const matches = width < widthLandingProto;
18+
useEffect(() => {
19+
// Check for the navigator object on the client side
20+
if (typeof window !== "undefined") {
21+
setIsMobile(/iPhone|iPad|iPod|Android/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";
2031

2132
const [email, setEmail] = useState("");
2233
const { value: submitted, setTrue } = useBoolean();
@@ -40,13 +51,14 @@ export default function Home() {
4051
};
4152

4253
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">
4455
<div className="h-full flex flex-col items-center justify-start gap-[5px] pt-[20px]">
4556
<div className="flex items-center justify-center gap-[10px] py-[10px]">
4657
<Image
4758
src="/logo.svg"
4859
width={50}
4960
height={50}
61+
priority
5062
alt="Supernova's logo, a ball with linear gradient from left to right, light teal to orange"
5163
/>
5264
<H1>Supernova</H1>
@@ -110,21 +122,10 @@ export default function Home() {
110122
</div>
111123
</div>
112124
<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 : (
126126
<Image
127-
src={"/landing-proto-2.svg"}
127+
src={graphicsFilePath}
128+
priority
128129
fill
129130
style={{ objectFit: "contain", bottom: 0, right: 0 }}
130131
alt="The prototype showcasing Supernova, a productivity app"
97.9 KB
Loading

0 commit comments

Comments
 (0)