"use client";

import { Button } from "@heroui/react";
import Link from "next/link";

interface Props {
  message?: string;
  onRetry: () => void;
}

export function OrdersErrorState({
  message = "Something went wrong while loading your orders.",
  onRetry,
}: Props) {
  return (
    <div className="flex flex-col items-center justify-center py-20 text-center">
      <div className="mb-4 text-5xl" aria-hidden="true">
        ⚠️
      </div>
      <h2 className="font-[family-name:var(--font-fraunces)] text-xl font-semibold text-[#1a2e2d]">
        Something went wrong
      </h2>
      <p className="mt-2 max-w-xs text-sm text-gray-500">{message}</p>
      <div className="mt-6 flex flex-col gap-3 sm:flex-row">
        <Button variant="primary" onPress={onRetry}>
          Try Again
        </Button>
        <Link
          href="/account"
          className="inline-flex items-center justify-center rounded-md border border-gray-300 px-4 py-2 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-50"
        >
          Back to Account
        </Link>
      </div>
    </div>
  );
}
