'use client';

import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert';
import { Button } from '@/components/ui/button';
import { Icons } from '@/components/icons';

export default function OverviewError({
  error,
  reset
}: {
  error: Error;
  reset: () => void;
}) {
  return (
    <Alert variant='destructive' className='max-w-3xl'>
      <Icons.alertCircle className='h-4 w-4' />
      <AlertTitle>เกิดข้อผิดพลาด</AlertTitle>
      <AlertDescription className='space-y-3'>
        <p>ไม่สามารถโหลดสถิติได้: {error.message}</p>
        <Button variant='outline' onClick={reset}>
          ลองใหม่
        </Button>
      </AlertDescription>
    </Alert>
  );
}
