"use client"; import { AlertCircle, RefreshCw } from "@/components/icons"; import type { AppIcon } from "@/components/icons"; import { Button } from "@/components/ui/button"; import { getPathPrefix } from "@/lib/browser-navigation"; import { cn } from "@/lib/utils"; import type { FallbackProps } from "./error-boundary"; export interface ErrorStateProps { title: string; description?: string; /** Puts the part back together: re-renders it, or reloads the route. */ onRetry: () => void; retryLabel: string; /** Offers a way out to the inbox; left out inside mail itself. */ homeLabel?: string; icon?: AppIcon; className?: string; } /** * The one error fallback: icon, title, a line of text, "Try again", and "Go * to inbox" where the inbox is somewhere else. Every error boundary draws * this, at whatever size its pane has. */ export function ErrorState({ title, description, onRetry, retryLabel, homeLabel, icon: Icon = AlertCircle, className }: ErrorStateProps) { return (

{title}

{description &&

{description}

}
{homeLabel && ( // A full load: whatever broke starts over. {homeLabel} )}
); } /** Full-page error fallback, also used around each app (AppErrorBoundary). */ export function PageErrorFallback({ resetError, t }: FallbackProps) { return ( ); } /** Mail's folder sidebar (256px wide). */ export function SidebarErrorFallback({ resetError, t }: FallbackProps) { return ( ); } /** Mail's message list. */ export function EmailListErrorFallback({ resetError, t }: FallbackProps) { return ; } /** Mail's reading pane. */ export function EmailViewerErrorFallback({ resetError, t }: FallbackProps) { return ( ); } /** The composer. */ export function ComposerErrorFallback({ resetError, t }: FallbackProps) { return ; } /** Settings. */ export function SettingsErrorFallback({ resetError, t }: FallbackProps) { return ( ); }