diff --git a/app/root.tsx b/app/root.tsx index 5f7950b..5b81515 100644 --- a/app/root.tsx +++ b/app/root.tsx @@ -22,30 +22,18 @@ import { } from "@remix-run/react"; import { type ErrorResponse } from "@remix-run/router"; import { LinksFunction } from "@remix-run/cloudflare"; -import MobileDetect from "mobile-detect"; import Login from "../components/Login.js"; import Navigation from "../components/Navigation.js"; import { type ReactNode, StrictMode, useContext, useEffect } from "react"; import theme from "../theme.js"; import { withEmotionCache } from "@emotion/react"; -function isMobile(ua: string | null, secChIsMobile: string | null): string { - if (secChIsMobile && ["?0", "?1"].includes(secChIsMobile)) - return secChIsMobile; - - if (ua) return `?${Number(new MobileDetect(ua).mobile())}`; - - return "?0"; -} - export function ErrorBoundary() { const error = useRouteError() as ErrorResponse; - const { ch, ua } = JSON.parse(error.data); - const mobile = isMobile(ua, ch); if (!isRouteErrorResponse(error)) return getMarkup( - { hide: true, mobile }, + { hide: true }, ???
@@ -69,14 +57,14 @@ export function ErrorBoundary() { return ""; case 401: - return getMarkup({ hide: true, mobile }, ); + return getMarkup({ hide: true }, ); case 403: - return getMarkup({ hide: true, mobile }, ); + return getMarkup({ hide: true }, ); case 404: return getMarkup( - { hide: true, mobile }, + { hide: true }, 404
@@ -92,7 +80,7 @@ export function ErrorBoundary() { default: return getMarkup( - { hide: true, mobile }, + { hide: true }, 500
@@ -128,11 +116,6 @@ export async function loader({ if (context.env.DSN) data.dsn = context.env.DSN; if (context.data.theme) data.theme = context.data.theme; - data.mobile = isMobile( - context.request.headers.get("user-agent"), - context.request.headers.get("sec-ch-ua-mobile") - ); - return data; }