From 1193e250aae5b3fd602659f07cbced110d421090 Mon Sep 17 00:00:00 2001 From: Nur Fikri Date: Mon, 28 Oct 2024 09:25:47 +0700 Subject: [PATCH 1/2] add mobile placeholder --- chain-registry | 2 +- src/pages/index.tsx | 72 +++++++++++++++++++++++++++++---------------- 2 files changed, 47 insertions(+), 27 deletions(-) diff --git a/chain-registry b/chain-registry index d469a854..0e5b998f 160000 --- a/chain-registry +++ b/chain-registry @@ -1 +1 @@ -Subproject commit d469a854d19a08df157513e0757c36cccfd44da8 +Subproject commit 0e5b998fc1770ebe727a2208287fa4394a2b9ba4 diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 28ee3c5f..35ab7fc1 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -1,31 +1,34 @@ +import { useEffect, useMemo, useState } from "react"; import { defaultTheme, lightTheme, Widget } from "widgetv2"; import DiscordButton from "@/components/DiscordButton"; import { LogoGo } from "@/components/LogoGo"; import WidgetButton from "@/components/WidgetButton"; -import { cn } from "@/utils/ui"; - -import { apiURL, endpointOptions } from "@/lib/skip-go-widget"; -import { useEffect, useState } from "react"; import { useURLQueryParams } from "@/hooks/useURLQueryParams"; +import { apiURL, endpointOptions } from "@/lib/skip-go-widget"; +import { isMobile } from "@/utils/os"; +import { cn } from "@/utils/ui"; export default function Home() { const defaultRoute = useURLQueryParams(); - const [theme, setTheme] = useState<'light' | 'dark'>(); + const [theme, setTheme] = useState<"light" | "dark">(); useEffect(() => { - if (typeof window !== 'undefined') { - if (window.matchMedia && window.matchMedia('(prefers-color-scheme: light)').matches) { - setTheme('light'); + if (typeof window !== "undefined") { + if (window.matchMedia && window.matchMedia("(prefers-color-scheme: light)").matches) { + setTheme("light"); } else { - setTheme('dark'); + setTheme("dark"); } - - window.matchMedia('(prefers-color-scheme: light)').addEventListener('change', event => { + + window.matchMedia("(prefers-color-scheme: light)").addEventListener("change", (event) => { const newColorScheme = event.matches ? "light" : "dark"; setTheme(newColorScheme); }); } }, []); + + const mobile = useMemo(() => isMobile(), []); + if (!theme) return null; return (
- +
-
- -
+ {!mobile ? ( +
+ +
+ ) : ( +
+
+ Skip go app is not yet available on mobile. +
+
+ )}
From 9c534ae43c596d2ad41208e554a2b07f1d7bf8a9 Mon Sep 17 00:00:00 2001 From: Nur Fikri Date: Mon, 28 Oct 2024 10:10:53 +0700 Subject: [PATCH 2/2] update text --- src/pages/index.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 35ab7fc1..9c70a6fe 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -74,8 +74,10 @@ export default function Home() { top: "50%", }} > -
- Skip go app is not yet available on mobile. +
+ Mobile support coming soon!
)}