import { Map as ImmutableMap } from 'immutable'; import * as React from 'react'; import { FormattedMessage } from 'react-intl'; import { useDispatch } from 'react-redux'; import { Button, Card, CardBody, Stack, Text } from 'soapbox/components/ui'; import AccountContainer from 'soapbox/containers/account_container'; import { useAppSelector } from 'soapbox/hooks'; import { fetchSuggestions } from '../../../actions/suggestions'; const SuggestedAccountsStep = ({ onNext }: { onNext: () => void }) => { const dispatch = useDispatch(); const suggestions = useAppSelector((state) => state.suggestions.get('items')); const suggestionsToRender = suggestions.slice(0, 5); React.useEffect(() => { dispatch(fetchSuggestions()); }, []); const renderSuggestions = () => { return (
{suggestionsToRender.map((suggestion: ImmutableMap) => (
, but it isn't id={suggestion.get('account')} showProfileHoverCard={false} />
))}
); }; const renderEmpty = () => { return (
); }; const renderBody = () => { if (suggestionsToRender.isEmpty()) { return renderEmpty(); } else { return renderSuggestions(); } }; return (
{renderBody()}
); }; export default SuggestedAccountsStep;