'use client';
import { type ErrorInfo, type ReactNode } from 'react';
import { ErrorBoundary, type ErrorBoundaryFallbackProps } from './error-boundary';
interface PageErrorBoundaryProps {
children: ReactNode;
/** Page title shown in the full-page error UI. */
pageName?: string;
onError?: (error: Error, info: ErrorInfo) => void;
}
/**
* Full-page error boundary for route layouts.
*
* Renders a centred Vietnamese-language error screen with a retry button and a
* link back to the home page. Wraps the generic `ErrorBoundary` with a
* page-appropriate fallback size.
*/
export function PageErrorBoundary({ children, pageName, onError }: PageErrorBoundaryProps) {
return (
Trang này gặp sự cố. Vui lòng thử lại hoặc quay về trang chủ.
{process.env.NODE_ENV !== 'production' && error.message && ({error.message}
)}