import React, { useEffect, useState } from 'react'; import { defineMessages, FormattedMessage, useIntl } from 'react-intl'; import Toggle from 'react-toggle'; import { changeEditEventApprovalRequired, changeEditEventDescription, changeEditEventEndTime, changeEditEventHasEndTime, changeEditEventName, changeEditEventStartTime, changeEditEventLocation, uploadEventBanner, undoUploadEventBanner, submitEvent, fetchEventParticipationRequests, rejectEventParticipationRequest, authorizeEventParticipationRequest, cancelEventCompose, } from 'soapbox/actions/events'; import { closeModal, openModal } from 'soapbox/actions/modals'; import { ADDRESS_ICONS } from 'soapbox/components/autosuggest-location'; import LocationSearch from 'soapbox/components/location-search'; import { checkEventComposeContent } from 'soapbox/components/modal-root'; import { Button, Form, FormGroup, HStack, Icon, IconButton, Input, Modal, Spinner, Stack, Tabs, Text, Textarea } from 'soapbox/components/ui'; import AccountContainer from 'soapbox/containers/account-container'; import { isCurrentOrFutureDate } from 'soapbox/features/compose/components/schedule-form'; import BundleContainer from 'soapbox/features/ui/containers/bundle-container'; import { DatePicker } from 'soapbox/features/ui/util/async-components'; import { useAppDispatch, useAppSelector } from 'soapbox/hooks'; import UploadButton from './upload-button'; const messages = defineMessages({ eventNamePlaceholder: { id: 'compose_event.fields.name_placeholder', defaultMessage: 'Name' }, eventDescriptionPlaceholder: { id: 'compose_event.fields.description_placeholder', defaultMessage: 'Description' }, eventStartTimePlaceholder: { id: 'compose_event.fields.start_time_placeholder', defaultMessage: 'Event begins on…' }, eventEndTimePlaceholder: { id: 'compose_event.fields.end_time_placeholder', defaultMessage: 'Event ends on…' }, resetLocation: { id: 'compose_event.reset_location', defaultMessage: 'Reset location' }, edit: { id: 'compose_event.tabs.edit', defaultMessage: 'Edit details' }, pending: { id: 'compose_event.tabs.pending', defaultMessage: 'Manage requests' }, authorize: { id: 'compose_event.participation_requests.authorize', defaultMessage: 'Authorize' }, reject: { id: 'compose_event.participation_requests.reject', defaultMessage: 'Reject' }, confirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' }, cancelEditing: { id: 'confirmations.cancel_editing.confirm', defaultMessage: 'Cancel editing' }, }); interface IAccount { eventId: string, id: string, participationMessage: string | null, } const Account: React.FC = ({ eventId, id, participationMessage }) => { const intl = useIntl(); const dispatch = useAppDispatch(); const handleAuthorize = () => { dispatch(authorizeEventParticipationRequest(eventId, id)); }; const handleReject = () => { dispatch(rejectEventParticipationRequest(eventId, id)); }; return (