import React from 'react'; import { FormattedMessage, defineMessages, useIntl } from 'react-intl'; import { useUnmuteGroup } from 'soapbox/api/hooks'; import GroupAvatar from 'soapbox/components/groups/group-avatar'; import { Button, HStack, Text } from 'soapbox/components/ui'; import { type Group } from 'soapbox/schemas'; import toast from 'soapbox/toast'; interface IGroupListItem { group: Group onUnmute(): void } const messages = defineMessages({ unmuteSuccess: { id: 'group.unmute.success', defaultMessage: 'Unmuted the group' }, }); const GroupListItem = ({ group, onUnmute }: IGroupListItem) => { const intl = useIntl(); const unmuteGroup = useUnmuteGroup(group); const handleUnmute = () => { unmuteGroup.mutate(undefined, { onSuccess() { onUnmute(); toast.success(intl.formatMessage(messages.unmuteSuccess)); }, }); }; return ( ); }; export default GroupListItem;