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 TitleItem from "src/etc/TitleItem";

export default observer(() => {
  const { totalTitles } = useEtcStore();
  const { t } = useTranslation();

  return (
    <ListGroup>
      <Badge>{t("etcTotalTitles")}</Badge>
      {totalTitles.map(({ title, titleColor, value }) => (
        <TitleItem
          key={title}
          title={title}
          titleColor={titleColor}
          text={sprintf(t("avatarCountText"), value)}
        />
      ))}
    </ListGroup>
  );
});
