"use client"

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

export default function AdminFilesError({
  error,
  reset,
}: {
  error: Error & { digest?: string }
  reset: () => void
}): ReactElement {
  const t = useTranslations("files")
  return (
    <div
      role="alert"
      className="flex h-full flex-col items-center justify-center space-y-4 p-8"
    >
      <FileWarning className="h-12 w-12 text-destructive" aria-hidden="true" />
      <h2 className="text-xl font-semibold">
        {t("admin.empty.title")}
      </h2>
      <p className="max-w-md text-center text-sm text-muted-foreground">
        {error.message}
      </p>
      <Button onClick={reset} aria-label={t("admin.columns.actions")}>
        {t("preview.text.load")}
      </Button>
    </div>
  )
}
