import React, { useEffect, useState } from 'react'; import { defineMessages, FormattedMessage, useIntl } from 'react-intl'; import { fetchJoinedEvents, fetchRecentEvents } from 'soapbox/actions/events'; import { openModal } from 'soapbox/actions/modals'; import { Button, CardBody, CardHeader, CardTitle, Column, HStack } from 'soapbox/components/ui'; import { useAppDispatch, useAppSelector } from 'soapbox/hooks'; import EventCarousel from './components/event-carousel'; const messages = defineMessages({ title: { id: 'column.events', defaultMessage: 'Events' }, }); const Events = () => { const intl = useIntl(); const dispatch = useAppDispatch(); const recentEvents = useAppSelector((state) => state.status_lists.get('recent_events')!.items); const recentEventsLoading = useAppSelector((state) => state.status_lists.get('recent_events')!.isLoading); const joinedEvents = useAppSelector((state) => state.status_lists.get('joined_events')!.items); const joinedEventsLoading = useAppSelector((state) => state.status_lists.get('joined_events')!.isLoading); const onComposeEvent = () => { dispatch(openModal('COMPOSE_EVENT')); }; useEffect(() => { dispatch(fetchRecentEvents()); dispatch(fetchJoinedEvents()); }, []); return ( } /> } /> ); }; export default Events;