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

import NoteItem from "src/note/NoteItem";
import { EtcAPINoteFile } from "src/wwwAPI";

export default function TotalNoteFilesView({
  totalNoteFiles,
}: {
  totalNoteFiles: EtcAPINoteFile[];
}) {
  const { t } = useTranslation();

  return (
    <ListGroup>
      <Badge>{t("etcTotalNoteFiles")}</Badge>
      {totalNoteFiles.map(
        ({ noteID, artist, title, genre, levelText, level, value }) => (
          <NoteItem
            key={noteID}
            noteID={noteID}
            artist={artist}
            title={title}
            genre={genre}
            levelText={levelText}
            level={level}
            fittedText={sprintf(t("textHandled"), value)}
          />
        ),
      )}
    </ListGroup>
  );
}
