import { OrderedSet as ImmutableOrderedSet } from 'immutable'; import React, { useEffect } from 'react'; import { FormattedMessage } from 'react-intl'; import { fetchPinnedAccounts } from 'soapbox/actions/accounts'; import { Widget } from 'soapbox/components/ui'; import AccountContainer from 'soapbox/containers/account_container'; import BundleContainer from 'soapbox/features/ui/containers/bundle_container'; import { WhoToFollowPanel } from 'soapbox/features/ui/util/async-components'; import { useAppDispatch, useAppSelector } from 'soapbox/hooks'; import type { Account } from 'soapbox/types/entities'; interface IPinnedAccountsPanel { account: Account, limit: number, } const PinnedAccountsPanel: React.FC = ({ account, limit }) => { const dispatch = useAppDispatch(); const pinned = useAppSelector((state) => state.user_lists.pinned.get(account.id)?.items || ImmutableOrderedSet()).slice(0, limit); useEffect(() => { dispatch(fetchPinnedAccounts(account.id)); }, []); if (pinned.isEmpty()) { return ( {Component => } ); } return ( , }} />} > {pinned && pinned.map((suggestion) => ( ))} ); }; export default PinnedAccountsPanel;