-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
396 additions
and
409 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,10 @@ | ||
"use client"; | ||
import dynamic from "next/dynamic"; | ||
import { useEffect, useState } from "react"; | ||
import { useMediaQuery } from "usehooks-ts"; | ||
import Login from "~/components/GoogleAuth"; | ||
import Landing from "~/components/Landing"; | ||
import Navbar from "~/components/LandingNav"; | ||
import Scene from "~/components/Scene"; | ||
|
||
const NavbarMobile = dynamic(() => import("~/components/LandingNavMobile")); | ||
|
||
export const runtime = "edge"; | ||
interface NavigatorExtended extends Navigator { | ||
deviceMemory?: number | undefined; | ||
} | ||
export default function HomePage() { | ||
const [isClient, setIsClient] = useState(false); | ||
const comingsoon = false; | ||
useEffect(() => { | ||
setIsClient(true); | ||
}, []); | ||
|
||
const matches = useMediaQuery("(max-width: 1024px)"); | ||
|
||
if (!isClient) return null; | ||
const nav = navigator as NavigatorExtended; | ||
const isFirefox = navigator.userAgent.includes("Firefox"); | ||
const isLowMemoryDevice = nav.deviceMemory! <= 4; | ||
const isAndroid = /Android/i.test(navigator.userAgent); | ||
if (comingsoon) { | ||
if (!isFirefox) { | ||
return ( | ||
<main className="bg-black"> | ||
<Navbar /> | ||
{matches && <NavbarMobile />} | ||
<div className="h-screen"> | ||
{isLowMemoryDevice && isAndroid ? ( | ||
<div className="flex min-h-screen items-center justify-center text-[#ffffff]"> | ||
<p>Low memory Android device detected</p> | ||
</div> | ||
) : ( | ||
<Scene /> | ||
)} | ||
<Login /> | ||
</div> | ||
</main> | ||
); | ||
} else { | ||
return ( | ||
<main className="bg-black"> | ||
<Navbar /> | ||
{matches && <NavbarMobile />} | ||
<div className="flex h-screen items-center justify-center"> | ||
<h1 className="text-[#ffffff]"> | ||
Please have the mercy to use chromium based browsers | ||
</h1> | ||
<Login /> | ||
</div> | ||
</main> | ||
); | ||
} | ||
} else { | ||
return ( | ||
<div className="min-h-screen w-screen overflow-hidden bg-[url('/assets/Landing/stars-bg.avif')]"> | ||
<Landing /> | ||
</div> | ||
); | ||
} | ||
return ( | ||
<div className="min-h-screen w-screen overflow-hidden bg-[url('/assets/Landing/stars-bg.avif')]"> | ||
<Landing /> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.