"use client";

import { useTranslation } from "react-i18next";
import Button from "@/components/ui/Button";
import { getApiErrorMessages } from "@/lib/api/errors";

export default function QueryErrorNotice({ error, onRetry }: { error: unknown; onRetry: () => void }) {
  const { t, i18n } = useTranslation();
  return <div role="alert" className="space-y-3 py-8 text-center">
    <p className="text-red-600">{getApiErrorMessages(error, i18n.language)[0] || t("COMMON.SOMETHING_WENT_WRONG")}</p>
    <Button onClick={onRetry}>{t("COMMON.RETRY")}</Button>
  </div>;
}
