1+ import { Button } from "@ethui/ui/components/shadcn/button" ;
12import type { ErrorComponentProps } from "@tanstack/react-router" ;
23import {
34 ErrorComponent ,
@@ -13,42 +14,52 @@ export function DefaultCatchBoundary({ error }: ErrorComponentProps) {
1314 strict : false ,
1415 select : ( state ) => state . id === rootRouteId ,
1516 } ) ;
17+ const showErrorDetails = import . meta. env . DEV ;
1618
1719 console . error ( "DefaultCatchBoundary Error:" , error ) ;
1820
1921 return (
20- < div className = "flex min-w-0 flex-1 flex-col items-center justify-center gap-6 p-4" >
21- < ErrorComponent error = { error } />
22- < div className = "flex flex-wrap items-center gap-2" >
23- < button
24- type = "button"
25- onClick = { ( ) => {
26- router . invalidate ( ) ;
27- } }
28- className = "rounded bg-gray-600 px-2 py-1 font-extrabold text-white uppercase dark:bg-gray-700"
29- >
30- Try Again
31- </ button >
32- { isRoot ? (
33- < Link
34- to = "/"
35- className = "rounded bg-gray-600 px-2 py-1 font-extrabold text-white uppercase dark:bg-gray-700"
36- >
37- Home
38- </ Link >
39- ) : (
40- < Link
41- to = "/"
42- className = "rounded bg-gray-600 px-2 py-1 font-extrabold text-white uppercase dark:bg-gray-700"
43- onClick = { ( e ) => {
44- e . preventDefault ( ) ;
45- window . history . back ( ) ;
22+ < div className = "min-h-screen bg-white" >
23+ < main className = "container mx-auto flex min-h-[60vh] flex-col items-start justify-center gap-4 px-4 py-12 md:py-20" >
24+ < p className = "text-gray-500 text-sm uppercase tracking-wide" >
25+ Something went wrong
26+ </ p >
27+ < h1 className = "font-bold text-3xl text-gray-900 sm:text-4xl" >
28+ We hit an unexpected error
29+ </ h1 >
30+ < p className = "max-w-2xl text-gray-600" >
31+ Please try again. If the problem keeps happening, head back home and
32+ restart your flow.
33+ </ p >
34+ { showErrorDetails && < ErrorComponent error = { error } /> }
35+ < div className = "flex flex-wrap items-center gap-2" >
36+ < Button
37+ type = "button"
38+ onClick = { ( ) => {
39+ router . invalidate ( ) ;
4640 } }
4741 >
48- Go Back
49- </ Link >
50- ) }
51- </ div >
42+ Try again
43+ </ Button >
44+ { isRoot ? (
45+ < Button asChild variant = "secondary" >
46+ < Link to = "/" > Home</ Link >
47+ </ Button >
48+ ) : (
49+ < Button asChild variant = "secondary" >
50+ < Link
51+ to = "/"
52+ onClick = { ( e ) => {
53+ e . preventDefault ( ) ;
54+ window . history . back ( ) ;
55+ } }
56+ >
57+ Go back
58+ </ Link >
59+ </ Button >
60+ ) }
61+ </ div >
62+ </ main >
5263 </ div >
5364 ) ;
5465}
0 commit comments