40 lines
1.2 KiB
TypeScript
Raw Normal View History

"use client";
import { Button } from "@/components/atoms/button";
/**
* Full-page fallback for root-level errors
* Used when the entire application crashes
*/
export function GlobalErrorFallback() {
return (
<div className="min-h-screen flex items-center justify-center bg-background">
<div className="text-center space-y-4 p-8">
<h1 className="text-2xl font-semibold">Something went wrong</h1>
<p className="text-muted-foreground">
An unexpected error occurred. Please refresh the page.
</p>
<Button onClick={() => window.location.reload()}>Refresh Page</Button>
</div>
</div>
);
}
/**
* Content area fallback - keeps nav/sidebar functional
* Used for errors within the main content area
*/
export function PageErrorFallback() {
return (
<div className="flex items-center justify-center h-64">
<div className="text-center space-y-4">
<h2 className="text-lg font-semibold text-danger">Something went wrong</h2>
<p className="text-muted-foreground">
This section encountered an error. Please try again.
</p>
<Button onClick={() => window.location.reload()}>Try again</Button>
</div>
</div>
);
}