import debounce from 'lodash/debounce'; import React from 'react'; import { defineMessages, useIntl, FormattedMessage } from 'react-intl'; import { useDispatch } from 'react-redux'; import { fetchMutes, expandMutes } from 'soapbox/actions/mutes'; import ScrollableList from 'soapbox/components/scrollable_list'; import { Column, Spinner } from 'soapbox/components/ui'; import AccountContainer from 'soapbox/containers/account_container'; import { useAppSelector } from 'soapbox/hooks'; const messages = defineMessages({ heading: { id: 'column.mutes', defaultMessage: 'Muted users' }, }); const handleLoadMore = debounce((dispatch) => { dispatch(expandMutes()); }, 300, { leading: true }); const Mutes: React.FC = () => { const dispatch = useDispatch(); const intl = useIntl(); const accountIds = useAppSelector((state) => state.user_lists.getIn(['mutes', 'items'])); const hasMore = useAppSelector((state) => !!state.user_lists.getIn(['mutes', 'next'])); React.useEffect(() => { dispatch(fetchMutes()); }, []); if (!accountIds) { return ( ); } const emptyMessage = ; return ( handleLoadMore(dispatch)} hasMore={hasMore} emptyMessage={emptyMessage} itemClassName='pb-4' > {accountIds.map((id: string) => , )} ); }; export default Mutes;