mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-19 23:31:21 +02:00
Refactor desktop app into separate client and proxy apps
This commit is contained in:
46
apps/yaak-client/components/RouteError.tsx
Normal file
46
apps/yaak-client/components/RouteError.tsx
Normal file
@@ -0,0 +1,46 @@
|
||||
import { Button } from './core/Button';
|
||||
import { DetailsBanner } from './core/DetailsBanner';
|
||||
import { FormattedError } from './core/FormattedError';
|
||||
import { Heading } from './core/Heading';
|
||||
import { VStack } from './core/Stacks';
|
||||
|
||||
export default function RouteError({ error }: { error: unknown }) {
|
||||
console.log('Error', error);
|
||||
const stringified = JSON.stringify(error);
|
||||
// biome-ignore lint/suspicious/noExplicitAny: none
|
||||
const message = (error as any).message ?? stringified;
|
||||
const stack =
|
||||
typeof error === 'object' && error != null && 'stack' in error ? String(error.stack) : null;
|
||||
return (
|
||||
<div className="flex items-center justify-center h-full">
|
||||
<VStack space={5} className="w-[50rem] !h-auto">
|
||||
<Heading>Route Error 🔥</Heading>
|
||||
<FormattedError>
|
||||
{message}
|
||||
{stack && (
|
||||
<DetailsBanner
|
||||
color="secondary"
|
||||
className="mt-3 select-auto text-xs max-h-[40vh]"
|
||||
summary="Stack Trace"
|
||||
>
|
||||
<div className="mt-2 text-xs">{stack}</div>
|
||||
</DetailsBanner>
|
||||
)}
|
||||
</FormattedError>
|
||||
<VStack space={2}>
|
||||
<Button
|
||||
color="primary"
|
||||
onClick={async () => {
|
||||
window.location.assign('/');
|
||||
}}
|
||||
>
|
||||
Go Home
|
||||
</Button>
|
||||
<Button color="info" onClick={() => window.location.reload()}>
|
||||
Refresh
|
||||
</Button>
|
||||
</VStack>
|
||||
</VStack>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user