import { observer } from "mobx-react-lite";
import { useSiteStore } from "src/Stores";
import AvatarItem from "src/site/AvatarItem";
import { OnAvatarInput } from "src/site/Site";

export default observer(
  ({ onAvatarInput }: { onAvatarInput: OnAvatarInput }) => {
    const { avatars } = useSiteStore();

    return (
      <>
        {avatars.map(
          ({
            avatarID,
            avatarName,
            avatarConfigure,
            isSiteHand,
            isMe,
            isValve,
            isAudioInput,
          }) => (
            <AvatarItem
              key={avatarID}
              avatarID={avatarID}
              avatarName={avatarName}
              avatarConfigure={avatarConfigure}
              isSiteHand={isSiteHand}
              isMe={isMe}
              isValve={isValve}
              isAudioInput={isAudioInput}
              onAvatarInput={onAvatarInput}
            />
          ),
        )}
      </>
    );
  },
);
