11import Login from '@/app/pages/login' ;
22import { useAuthStore } from '@/features/auth/stores/auth-store' ;
3- import {
4- AlertDialog ,
5- AlertDialogBody ,
6- AlertDialogCloseButton ,
7- AlertDialogContent ,
8- AlertDialogFooter ,
9- AlertDialogHeader ,
10- Button ,
11- } from '@chakra-ui/react' ;
12- import { useRef , useState } from 'react' ;
3+
4+ import { useState } from 'react' ;
135import { useTranslation } from 'react-i18next' ;
14- import {
15- isRouteErrorResponse ,
16- useNavigate ,
17- useRouteError ,
18- } from 'react-router-dom' ;
6+ import { isRouteErrorResponse , useNavigate , useRouteError } from 'react-router' ;
197
208interface IError {
219 error ?: Error ;
@@ -30,7 +18,6 @@ interface RouterErrorProps {
3018export const RouterError = ( { error } : RouterErrorProps ) => {
3119 const { t } = useTranslation ( ) ;
3220 const nav = useNavigate ( ) ;
33- const cancelRef = useRef ( null ) ;
3421 const authStore = useAuthStore ( ) ;
3522 const displayedError : unknown = useRouteError ( ) ?? error ;
3623 const [ isOpened , setIsOpened ] = useState ( true ) ;
@@ -65,25 +52,33 @@ export const RouterError = ({ error }: RouterErrorProps) => {
6552 )
6653 errorMessage = 'ForbidError' ;
6754 return (
68- < AlertDialog
69- isOpen = { isOpened }
70- onClose = { onClose }
71- leastDestructiveRef = { cancelRef }
55+ < div
56+ className = { `fixed inset-0 flex items-center justify-center ${ isOpened ? 'block' : 'hidden' } ` }
7257 >
73- < AlertDialogContent >
74- < AlertDialogHeader >
75- { t ( 'Message.RouterError' ) }
76- </ AlertDialogHeader >
77- < AlertDialogCloseButton />
78- < AlertDialogBody >
79- { t ( 'Message.' + errorMessage ) }
80- </ AlertDialogBody >
81- < AlertDialogFooter >
82- < Button colorScheme = "green" ml = { 3 } onClick = { ( ) => nav ( '/' ) } >
58+ < div className = "bg-white rounded-lg shadow-lg p-6 w-full max-w-md" >
59+ < div className = "flex justify-between items-center border-b pb-3" >
60+ < h2 className = "text-lg font-semibold" >
61+ { t ( 'Message.RouterError' ) }
62+ </ h2 >
63+ < button
64+ className = "text-gray-500 hover:text-gray-700"
65+ onClick = { onClose }
66+ >
67+ ×
68+ </ button >
69+ </ div >
70+ < div className = "py-4" >
71+ < p > { t ( 'Message.' + errorMessage ) } </ p >
72+ </ div >
73+ < div className = "flex justify-end pt-3 border-t" >
74+ < button
75+ className = "bg-green-500 text-white px-4 py-2 rounded hover:bg-green-600"
76+ onClick = { ( ) => nav ( '/' ) }
77+ >
8378 { t ( 'OK' ) }
84- </ Button >
85- </ AlertDialogFooter >
86- </ AlertDialogContent >
87- </ AlertDialog >
79+ </ button >
80+ </ div >
81+ </ div >
82+ </ div >
8883 ) ;
8984} ;
0 commit comments