import { format } from "date-fns"; import React, { useState } from "react"; import Link from "next/link"; import styles from "../styles/CellModList.module.css"; import type { Mod } from "./CellData"; const NEXUS_MODS_URL = "https://www.nexusmods.com/skyrimspecialedition"; type Props = { mods: Mod[]; counts: Record | null; }; type ModWithCounts = Mod & { total_downloads: number; unique_downloads: number; views: number; }; const CellModList: React.FC = ({ mods, counts }) => { const [includeTranslations, setIncludeTranslations] = useState(true); const modsWithCounts: ModWithCounts[] = mods .map((mod) => { const modCounts = counts && counts[mod.nexus_mod_id]; return { ...mod, total_downloads: modCounts ? modCounts[0] : 0, unique_downloads: modCounts ? modCounts[1] : 0, views: modCounts ? modCounts[2] : 0, }; }) .filter((mod) => includeTranslations || !mod.is_translation); let numberFmt = new Intl.NumberFormat("en-US"); return ( mods && ( <>

Nexus Mods ({modsWithCounts.length})

) ); }; export default CellModList;