diff --git a/app/mobile/page.module.css b/app/mobile/page.module.css new file mode 100644 index 0000000..c77e46f --- /dev/null +++ b/app/mobile/page.module.css @@ -0,0 +1,12 @@ +.main { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + height: 100%; + padding-inline: 12px; +} + +.message { + font-weight: 500; +} diff --git a/app/mobile/page.tsx b/app/mobile/page.tsx new file mode 100644 index 0000000..63a848d --- /dev/null +++ b/app/mobile/page.tsx @@ -0,0 +1,25 @@ +"use client"; + +import React, { useEffect } from "react"; +import styles from "./page.module.css"; +import classnames from "classnames"; +import { outfitFont } from "../styles/fonts"; + +export default function Mobile() { + useEffect(() => { + // if not on mobile, redirect to the main page + if (window.innerWidth > 768) { + window.location.href = "/"; + } + }, []); + return ( +
+
+ We are sorry, +
+ Tour of JSON Schema is not optimized for mobile devices. Please use a + desktop computer for the best experience. +
+
+ ); +} diff --git a/app/providers.tsx b/app/providers.tsx index 22f5f90..01ab9f8 100644 --- a/app/providers.tsx +++ b/app/providers.tsx @@ -1,7 +1,14 @@ "use client"; -import { ChakraProvider, ColorModeScript } from "@chakra-ui/react"; +import { ChakraProvider } from "@chakra-ui/react"; import { theme } from "./styles/theme"; +import { useEffect } from "react"; export function Providers({ children }: { children: React.ReactNode }) { + useEffect(() => { + if (window.innerWidth < 768 && !window.location.href.includes("/mobile")) { + window.location.href = "/mobile"; + } + }, []); + return {children}; }