import { useTranslation } from '@/i18n.ts'
import { useNavigate } from '@tanstack/react-router'
import { Button, Result } from 'antd'
import { useAtomValue } from 'jotai'
import { userMenuDataAtom } from '@/store/system/user.ts'

const NotFound = () => {

    const navigate = useNavigate()
    const { t } = useTranslation()
    const { data } = useAtomValue(userMenuDataAtom)

    if (!data) {
        return null

    }
    return (
            <Result
                    className="error-page"
                    status="404"
                    title={t('error.404.title')}
                    subTitle={t('error.404.message')}
                    extra={
                        <Button type="primary" onClick={() => navigate({
                            to: '../'
                        })}>
                            {t('route.goBack')}
                        </Button>
                    }
            />
    )
}

export default NotFound