Fix unsupported browser alert
This commit is contained in:
parent
6d357e4c7c
commit
31af6fa3ec
@ -25,7 +25,7 @@ import {
|
|||||||
VStack,
|
VStack,
|
||||||
} from "@chakra-ui/react";
|
} from "@chakra-ui/react";
|
||||||
import { useLoaderData } from "@remix-run/react";
|
import { useLoaderData } from "@remix-run/react";
|
||||||
import { useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
|
|
||||||
export async function loader({ context }: { context: RequestContext }) {
|
export async function loader({ context }: { context: RequestContext }) {
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
@ -56,6 +56,10 @@ export default function () {
|
|||||||
const [isBrowserSupported, setIsBrowserSupported] = useState(true);
|
const [isBrowserSupported, setIsBrowserSupported] = useState(true);
|
||||||
const toast = useToast();
|
const toast = useToast();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (typeof structuredClone === "undefined") setIsBrowserSupported(false);
|
||||||
|
}, []);
|
||||||
|
|
||||||
async function displayErrorToast(response: Response, title: string) {
|
async function displayErrorToast(response: Response, title: string) {
|
||||||
let msg = "Unknown error";
|
let msg = "Unknown error";
|
||||||
|
|
||||||
@ -197,7 +201,7 @@ export default function () {
|
|||||||
<AlertIcon />
|
<AlertIcon />
|
||||||
The cutoff period for retroactively actioning events has passed.
|
The cutoff period for retroactively actioning events has passed.
|
||||||
</Alert>
|
</Alert>
|
||||||
<Alert display={isBrowserSupported ? undefined : "none"} status="error">
|
<Alert display={isBrowserSupported ? "none" : undefined} status="error">
|
||||||
<AlertIcon />
|
<AlertIcon />
|
||||||
This browser is unsupported. Please upgrade to a browser not several
|
This browser is unsupported. Please upgrade to a browser not several
|
||||||
years out of date.
|
years out of date.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user