import { useEffect, useState } from 'react'; import { useLocation, useRouteError } from 'react-router-dom'; import { Frame } from '@shared/frame'; interface RouteError { statusText: string; message: string; } interface DebugInfo { os: null | string; version: null | string; appDir: null | string; } export function ErrorScreen() { const error = useRouteError() as RouteError; const location = useLocation(); const [debugInfo, setDebugInfo] = useState({ os: null, version: null, appDir: null, }); useEffect(() => { async function getInformation() { const { platform, version } = await import('@tauri-apps/api/os'); const { getVersion } = await import('@tauri-apps/api/app'); const { appConfigDir } = await import('@tauri-apps/api/path'); const platformName = await platform(); const osVersion = await version(); const appVersion = await getVersion(); const appDir = await appConfigDir(); setDebugInfo({ os: platformName + ' ' + osVersion, version: appVersion, appDir: appDir, }); } getInformation(); }, []); return (

Sorry, an unexpected error has occurred.

{error.statusText || error.message}

Current location: {location.pathname}

App version: {debugInfo.version}

Platform: {debugInfo.os}

Click here to report the issue on GitHub
); }