SPB Git forge
28commits 1branches 0releases
7.7 MBsize
maindefault branch
10 days agolast push
Python 66.3% TypeScript 22.7% JavaScript 8.6% HTML 1.4% CSS 0.7%
1.3 KB · 34 lines tsx
Raw Blame History
1'use client';2import Link from 'next/link';3import { useEffect } from 'react';4import { Container } from '@/components/ui/section';56export default function Error({ error, reset }: { error: Error & { digest?: string }; reset: () => void }) {7  useEffect(() => {8    // Error shells render from scratch and can lose the prepaint theme attribute.9    if (!document.documentElement.getAttribute('data-theme')) {10      const dark = window.matchMedia('(prefers-color-scheme: dark)').matches;11      document.documentElement.setAttribute('data-theme', dark ? 'dark' : 'light');12    }13  }, []);14  return (15    <Container className="py-20 md:py-28">16      <p className="eyebrow">Error</p>17      <h1 className="display mt-2 text-3xl md:text-5xl">Something went wrong.</h1>18      <p className="mt-4 max-w-xl text-ink-2">The page could not be rendered. The dataset itself is intact — this is usually the API being briefly unavailable.</p>19      {error.digest && <p className="mono mt-2 text-xs text-ink-3">ref {error.digest}</p>}20      <div className="mt-6 flex gap-2 text-sm">21        <button type="button" onClick={reset} className="btn btn-primary">22          Try again23        </button>24        <Link href="/" className="btn">25          Home26        </Link>27        <Link href="/system" className="btn">28          System status29        </Link>30      </div>31    </Container>32  );33}34