import NoteView from "@/app/[language]/note/components/NoteView";
import { useSiteStore } from "@/state/Stores";
import { EtcAPINoteFile } from "@/type/wwwAPI";
import { observer } from "mobx-react-lite";
import ListGroup from "react-bootstrap/ListGroup";
import ListGroupItem from "react-bootstrap/ListGroupItem";

export default observer<{
  title: string;
  favorites: EtcAPINoteFile[];
}>(({ title, favorites }) => {
  const { siteAvatarID } = useSiteStore();

  return (
    <ListGroup>
      <ListGroupItem>{title}</ListGroupItem>
      {favorites.map(
        ({ noteID, artist, title, genre, levelText, level, value }) => (
          <ListGroupItem key={noteID}>
            <NoteView
              noteID={noteID}
              artist={artist}
              title={title}
              genre={genre}
              levelText={levelText}
              level={level}
              fittedText={`👍 ${value}`}
              wantAvatarID={siteAvatarID}
            />
          </ListGroupItem>
        ),
      )}
    </ListGroup>
  );
});
