import React, { useEffect } from 'react'; import { FormattedMessage } from 'react-intl'; import { Link } from 'react-router-dom'; import { groupCompose } from 'soapbox/actions/compose'; import { fetchGroup } from 'soapbox/actions/groups'; import { connectGroupStream } from 'soapbox/actions/streaming'; import { expandGroupTimeline } from 'soapbox/actions/timelines'; import { Avatar, HStack, Stack } from 'soapbox/components/ui'; import ComposeForm from 'soapbox/features/compose/components/compose-form'; import { useAppDispatch, useAppSelector, useOwnAccount } from 'soapbox/hooks'; import Timeline from '../ui/components/timeline'; type RouteParams = { id: string }; interface IGroupTimeline { params: RouteParams, } const GroupTimeline: React.FC = (props) => { const account = useOwnAccount(); const dispatch = useAppDispatch(); const groupId = props.params.id; const relationship = useAppSelector((state) => state.group_relationships.get(groupId)); const handleLoadMore = (maxId: string) => { dispatch(expandGroupTimeline(groupId, { maxId })); }; useEffect(() => { dispatch(fetchGroup(groupId)); dispatch(expandGroupTimeline(groupId)); dispatch(groupCompose(`group:${groupId}`, groupId)); const disconnect = dispatch(connectGroupStream(groupId)); return () => { disconnect(); }; }, [groupId]); return ( {!!account && relationship?.member && (
)} } divideType='border' showGroup={false} />
); }; export default GroupTimeline;