import React, { useEffect } from 'react'; import { FormattedMessage } from 'react-intl'; import { fetchEventParticipations } from 'soapbox/actions/events'; import ScrollableList from 'soapbox/components/scrollable-list'; import { Modal, Spinner } from 'soapbox/components/ui'; import AccountContainer from 'soapbox/containers/account-container'; import { useAppDispatch, useAppSelector } from 'soapbox/hooks'; interface IEventParticipantsModal { onClose: (type: string) => void statusId: string } const EventParticipantsModal: React.FC = ({ onClose, statusId }) => { const dispatch = useAppDispatch(); const accountIds = useAppSelector((state) => state.user_lists.event_participations.get(statusId)?.items); const fetchData = () => { dispatch(fetchEventParticipations(statusId)); }; useEffect(() => { fetchData(); }, []); const onClickClose = () => { onClose('EVENT_PARTICIPANTS'); }; let body; if (!accountIds) { body = ; } else { const emptyMessage = ; body = ( {accountIds.map(id => , )} ); } return ( } onClose={onClickClose} > {body} ); }; export default EventParticipantsModal;