"use client"

import { TicketPlus } from "lucide-react"
import type { ReactElement } from "react"
import { Button } from "@/shared/components/ui/button"
import { useTranslations } from "next-intl"

export default function AdminInvitationCodesError({
  error,
  reset,
}: {
  error: Error & { digest?: string }
  reset: () => void
}): ReactElement {
  const t = useTranslations("invitationCodes")
  const tCommon = useTranslations("common")
  return (
    <div className="flex h-full flex-col items-center justify-center space-y-4 p-8">
      <TicketPlus className="h-12 w-12 text-destructive" aria-hidden="true" />
      <h2 className="text-xl font-semibold">{t("errors.loadFailed")}</h2>
      <p className="text-sm text-muted-foreground">{error.message}</p>
      <Button onClick={reset}>{tCommon("actions.retry")}</Button>
    </div>
  )
}
