'use client'

import {useTranslations} from 'next-intl'
import React from 'react'

import {Button} from '@/components/ui/button'

export default function ErrorPage({
	error,
	reset
}: {
	error: Error
	reset: () => void
}) {
	const t = useTranslations('Error')
	return (
		<div className='flex min-h-screen flex-col items-center justify-center'>
			<div className='w-1/3 rounded-lg p-6 text-center shadow-md'>
				<h1 className='mb-4 text-3xl font-bold'>{t('title')}</h1>
				<p className='text-destructive'>{error.message}</p>
				<Button variant='outline' className='mt-4' onClick={() => reset()}>
					{t('try-again')}
				</Button>
				<Button
					variant='outline'
					className='ml-2 mt-4'
					onClick={() => (window.location.href = '/')}
				>
					{t('back-to-home')}
				</Button>
			</div>
		</div>
	)
}
