import React from 'react'; import { FormattedMessage } from 'react-intl'; import { useHistory } from 'react-router-dom'; import { Column, Layout, Tabs } from 'soapbox/components/ui'; import PlaceholderStatus from 'soapbox/features/placeholder/components/placeholder-status'; import LinkFooter from 'soapbox/features/ui/components/link-footer'; import { EventHeader, CtaBanner, SignUpPanel, TrendsPanel, WhoToFollowPanel, } from 'soapbox/features/ui/util/async-components'; import { useAppSelector, useFeatures } from 'soapbox/hooks'; import { makeGetStatus } from 'soapbox/selectors'; const getStatus = makeGetStatus(); interface IEventPage { params?: { statusId?: string; }; children: React.ReactNode; } const EventPage: React.FC = ({ params, children }) => { const me = useAppSelector(state => state.me); const features = useFeatures(); const history = useHistory(); const statusId = params?.statusId!; const status = useAppSelector(state => getStatus(state, { id: statusId }) || undefined); const event = status?.event; if (status && !event) { history.push(`/@${status.getIn(['account', 'acct'])}/posts/${status.id}`); return ( ); } const pathname = history.location.pathname; const activeItem = pathname.endsWith('/discussion') ? 'discussion' : 'info'; const tabs = status ? [ { text: , to: `/@${status.getIn(['account', 'acct'])}/events/${status.id}`, name: 'info', }, { text: , to: `/@${status.getIn(['account', 'acct'])}/events/${status.id}/discussion`, name: 'discussion', }, ] : []; const showTabs = !['/participations', 'participation_requests'].some(path => pathname.endsWith(path)); return ( <>
{status && showTabs && ( )} {children}
{!me && ( )}
{!me && ( )} {features.trends && ( )} {features.suggestions && ( )} ); }; export default EventPage;