import { MOD_ENDPOINT } from "@/api/ENDPOINTS"; import { Mod } from "@/types/mod"; import { Button, Checkbox, Table, TableBody, TableCell, TableHead, TableHeadCell, TableRow, } from "flowbite-react"; import { HiDownload, HiTrash } from "react-icons/hi"; import { toast } from "react-toastify"; export const ModTable = (props: { mods: Mod[]; updatePack: () => void; packID: string; }) => { async function deleteMod(slug: string, title: string) { if (!window) return; if (window.confirm(`Delete mod ${title}?`)) { const res = await fetch(MOD_ENDPOINT("deleteMod", props.packID, slug)); const data = await res.json(); if (data.status != "ok") { toast.error(data.message, { autoClose: 2500, closeOnClick: true, draggable: true, }); return; } props.updatePack(); } } return (
Icon Title Version Developer Source Source URL Actions {props.mods && props.mods.length > 0 && props.mods.map((mod) => { return ( {/* eslint-disable-next-line @next/next/no-img-element */} {mod.title} {mod.file.version} {mod.developers.join(", ")} {mod.source} {mod.url}
); })}
); };