import React from 'react'; import { FormattedMessage } from 'react-intl'; import { Link } from 'react-router-dom'; import { openModal } from 'soapbox/actions/modals'; import GroupCard from 'soapbox/components/group-card'; import ScrollableList from 'soapbox/components/scrollable-list'; import { Button, Stack, Text } from 'soapbox/components/ui'; import { useAppDispatch, useAppSelector, useGroups, useFeatures } from 'soapbox/hooks'; import { PERMISSION_CREATE_GROUPS, hasPermission } from 'soapbox/utils/permissions'; import PlaceholderGroupCard from '../placeholder/components/placeholder-group-card'; import PendingGroupsRow from './components/pending-groups-row'; import TabBar, { TabItems } from './components/tab-bar'; import type { Group as GroupEntity } from 'soapbox/types/entities'; const Groups: React.FC = () => { const dispatch = useAppDispatch(); const features = useFeatures(); const canCreateGroup = useAppSelector((state) => hasPermission(state, PERMISSION_CREATE_GROUPS)); const { groups, isLoading } = useGroups(); const createGroup = () => { dispatch(openModal('MANAGE_GROUP')); }; const renderBlankslate = () => ( {canCreateGroup && ( )} ); return ( {canCreateGroup && ( )} {features.groupsDiscovery && ( )} {groups.map((group) => ( ))} ); }; export default Groups;