import React from 'react'; import { FormattedMessage } from 'react-intl'; import { Link } from 'react-router-dom'; import GroupAvatar from 'soapbox/components/groups/group-avatar'; import { Button, HStack, Icon, Stack, Text } from 'soapbox/components/ui'; import { useJoinGroup } from 'soapbox/hooks/api'; import { Group as GroupEntity } from 'soapbox/types/entities'; import { shortNumberFormat } from 'soapbox/utils/numbers'; interface IGroup { group: GroupEntity withJoinAction?: boolean } const GroupListItem = (props: IGroup) => { const { group, withJoinAction = true } = props; const joinGroup = useJoinGroup(group); const onJoinGroup = () => joinGroup.mutate(group); return ( {group.locked ? ( ) : ( )} {typeof group.members_count !== 'undefined' && ( <> {shortNumberFormat(group.members_count)} {' '} )} {withJoinAction && ( )} ); }; export default GroupListItem;