import { useEffect, useState } from 'react'; import { useLocation, useRouteError } from 'react-router-dom'; interface IRouteError { statusText: string; message: string; } interface IDebugInfo { os: null | string; version: null | string; } export function ErrorScreen() { const error = useRouteError() as IRouteError; const location = useLocation(); const [debugInfo, setDebugInfo] = useState({ os: null, version: null }); useEffect(() => { async function getInformation() { const { platform, version } = await import('@tauri-apps/plugin-os'); const { getVersion } = await import('@tauri-apps/plugin-app'); const platformName = await platform(); const osVersion = await version(); const appVersion = await getVersion(); setDebugInfo({ os: platformName + ' ' + osVersion, version: appVersion }); } 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
); }