error.tsx 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. "use client";
  2. export default function Error({
  3. reset
  4. }: {
  5. error: Error & { digest?: string };
  6. reset: () => void;
  7. }) {
  8. return (
  9. <div className="min-h-screen flex items-center justify-center">
  10. <div className="text-center p-8 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg max-w-lg">
  11. <div className="mb-6">
  12. <svg
  13. className="mx-auto h-16 w-16 text-red-400"
  14. fill="none"
  15. viewBox="0 0 24 24"
  16. stroke="currentColor"
  17. >
  18. <path
  19. strokeLinecap="round"
  20. strokeLinejoin="round"
  21. strokeWidth={2}
  22. d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z"
  23. />
  24. </svg>
  25. </div>
  26. <h1 className="text-2xl font-bold text-red-800 dark:text-red-200 mb-4">
  27. Something went wrong!
  28. </h1>
  29. <p className="text-gray-600 dark:text-gray-400 mb-6">
  30. An unexpected error occurred while loading this page.
  31. </p>
  32. <div className="space-x-4">
  33. <button
  34. onClick={reset}
  35. className="inline-flex items-center px-6 py-3 border border-transparent text-base font-medium rounded-md text-white bg-red-600 hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500"
  36. >
  37. Try Again
  38. </button>
  39. <button
  40. onClick={() => (window.location.href = "/")}
  41. className="inline-flex items-center px-6 py-3 border border-gray-300 dark:border-gray-600 text-base font-medium rounded-md text-gray-700 dark:text-gray-200 bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
  42. >
  43. Go Home
  44. </button>
  45. </div>
  46. </div>
  47. </div>
  48. );
  49. }