This repository has been archived by the owner on Nov 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
31174ac
commit 7a7f02d
Showing
4 changed files
with
75 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
'use client'; | ||
|
||
import { TRPCClientError } from '@trpc/client'; | ||
import { XIcon } from 'lucide-react'; | ||
import { FormattedMessage } from 'react-intl'; | ||
|
||
import { Button } from '~/components/ui/button'; | ||
|
||
export default function Error({ | ||
error, | ||
reset, | ||
}: { | ||
error: Error; | ||
reset: () => void; | ||
}) { | ||
const getError = (error: Error) => { | ||
if (error instanceof TRPCClientError) { | ||
if (error.message === 'ticket_not_found') { | ||
return <FormattedMessage id="errors.ticket_not_found" />; | ||
} | ||
} | ||
|
||
return <FormattedMessage id="errors.unhandled_error" />; | ||
}; | ||
|
||
return ( | ||
<main className="lg:pl-60"> | ||
<div className="flex items-center justify-center xl:mr-96 xl:h-[100dvh] xl:overflow-y-auto xl:pl-96"> | ||
<div className="sm:w-full sm:max-w-sm"> | ||
<div> | ||
<div className="mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-destructive-foreground"> | ||
<XIcon className="h-6 w-6 text-destructive" aria-hidden="true" /> | ||
</div> | ||
<div className="mt-3 text-center sm:mt-5"> | ||
<h3 className="text-base font-semibold leading-6 text-foreground"> | ||
<FormattedMessage id="error.an_error_occured" /> | ||
</h3> | ||
<div className="mt-2"> | ||
<p className="text-sm text-muted-foreground"> | ||
{getError(error)} | ||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
<div className="mt-5 sm:mt-6"> | ||
<Button type="button" className="w-full" onClick={() => reset()}> | ||
<FormattedMessage id="try_again" /> | ||
</Button> | ||
</div> | ||
</div> | ||
</div> | ||
</main> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters