import React from "react"; import useLinkStore from "@/store/links"; import toast from "react-hot-toast"; import Modal from "../Modal"; import Button from "../ui/Button"; import { useTranslation } from "next-i18next"; type Props = { onClose: Function; }; export default function BulkDeleteLinksModal({ onClose }: Props) { const { t } = useTranslation(); const { selectedLinks, setSelectedLinks, deleteLinksById } = useLinkStore(); const deleteLink = async () => { const load = toast.loading(t("deleting")); const response = await deleteLinksById( selectedLinks.map((link) => link.id as number) ); toast.dismiss(load); if (response.ok) { toast.success(t("deleted")); setSelectedLinks([]); onClose(); } else toast.error(response.data as string); }; return (

{selectedLinks.length === 1 ? t("delete_link") : t("delete_links", { count: selectedLinks.length })}

{selectedLinks.length === 1 ? t("link_deletion_confirmation_message") : t("links_deletion_confirmation_message", { count: selectedLinks.length, })}

{t("warning_irreversible")}

{t("shift_key_tip")}

); }