"use client";

import { Button } from "@/components/ui/button";

/**
 * Shared fallback UI for route-segment `error.tsx` boundaries — keeps the
 * retry affordance and copy consistent across segments instead of each one
 * reinventing it.
 */
export function ErrorState({
  title = "Something went wrong",
  description = "Sorry, an unexpected error occurred. Please try again.",
  onRetry,
}: {
  title?: string;
  description?: string;
  onRetry: () => void;
}) {
  return (
    <div className="flex flex-col items-center justify-center gap-4 px-6 py-24 text-center">
      <h2 className="text-xl font-semibold">{title}</h2>
      <p className="max-w-md text-sm text-kolabora-neutral-dark/70">{description}</p>
      <Button type="button" onClick={onRetry}>
        Try Again
      </Button>
    </div>
  );
}
