import React, { ReactNode, useCallback, useEffect } from "react"; import { useLocation } from "react-router-dom"; import classNames from "classnames"; import { Trans, useTranslation } from "react-i18next"; import { Header, HeaderLogo, LeftNav, RightNav } from "./Header"; import { LinkButton, Button } from "./button"; import { useSubmitRageshake } from "./settings/submit-rageshake"; import { ErrorMessage } from "./input/Input"; import styles from "./FullScreenView.module.css"; import { translatedError, TranslatedError } from "./TranslatedError"; interface FullScreenViewProps { className?: string; children: ReactNode; } export function FullScreenView({ className, children }: FullScreenViewProps) { return (
{children}
); } interface ErrorViewProps { error: Error; } export function ErrorView({ error }: ErrorViewProps) { const location = useLocation(); const { t } = useTranslation(); useEffect(() => { console.error(error); }, [error]); const onReload = useCallback(() => { window.location.href = "/"; }, []); return (

Error

{error instanceof TranslatedError ? error.translatedMessage : error.message}

{location.pathname === "/" ? ( ) : ( {t("Return to home screen")} )}
); } export function CrashView() { const { t } = useTranslation(); const { submitRageshake, sending, sent, error } = useSubmitRageshake(); const sendDebugLogs = useCallback(() => { submitRageshake({ description: "**Soft Crash**", sendLogs: true, }); }, [submitRageshake]); const onReload = useCallback(() => { window.location.href = "/"; }, []); let logsComponent: JSX.Element | null = null; if (sent) { logsComponent =
{t("Thanks! We'll get right on it.")}
; } else if (sending) { logsComponent =
{t("Sending…")}
; } else { logsComponent = ( ); } return (

Oops, something's gone wrong.

Submitting debug logs will help us track down the problem.

{logsComponent}
{error && ( )}
); } export function LoadingView() { const { t } = useTranslation(); return (

{t("Loading…")}

); }