import { captureException } from '@sentry/browser'; import { FallbackProps } from 'react-error-boundary'; import { useRouteError } from 'react-router'; import { useDebugState } from '@sd/client'; import { Button } from '@sd/ui'; import { useOperatingSystem } from './hooks'; export function RouterErrorBoundary() { const error = useRouteError(); return ( { captureException(error); location.reload(); }} reloadBtn={() => { location.reload(); }} /> ); } export default ({ error, resetErrorBoundary }: FallbackProps) => ( { captureException(error); resetErrorBoundary(); }} reloadBtn={resetErrorBoundary} /> ); export function ErrorPage({ reloadBtn, sendReportBtn, message, submessage }: { reloadBtn?: () => void; sendReportBtn?: () => void; message: string; submessage?: string; }) { const debug = useDebugState(); const os = useOperatingSystem(); const isMacOS = os === 'macOS'; if (!submessage && debug.enabled) submessage = 'Check the console (CMD/CTRL + OPTION + i) for stack trace.'; return (

APP CRASHED

We're past the event horizon...

{message}
{submessage &&
{submessage}
}
{reloadBtn && ( )} {sendReportBtn && ( )} {message === 'failed to initialize config' && (

We detected you may have created your library with an older version of Spacedrive. Please reset it to continue using the app!

{' '} YOU WILL LOSE ANY EXISTING SPACEDRIVE DATA!

)}
); }