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

import { useEtcStore } from "src/Stores";
import NoteItem from "src/note/NoteItem";

export default observer(() => {
  const { totalNoteFiles } = useEtcStore();
  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>
  );
});
