import { useTranslation } from "react-i18next";
import { Badge, ListGroup } from "reactstrap";
import { sprintf } from "sprintf-js";

import EdgeItem from "src/etc/EdgeItem";
import { EtcAPIEdge } from "src/wwwAPI";

export default function TotalEdgesView({
  totalEdges,
}: {
  totalEdges: EtcAPIEdge[];
}) {
  const { t } = useTranslation();

  return (
    <ListGroup>
      <Badge>{t("etcTotalEdges")}</Badge>
      {totalEdges.map(({ edge, value }) => (
        <EdgeItem
          key={edge}
          edge={edge}
          text={sprintf(t("avatarCountText"), value)}
        />
      ))}
    </ListGroup>
  );
}
