diff --git a/app/soapbox/components/ui/textarea/textarea.tsx b/app/soapbox/components/ui/textarea/textarea.tsx index 43d6efd20..e93229e6a 100644 --- a/app/soapbox/components/ui/textarea/textarea.tsx +++ b/app/soapbox/components/ui/textarea/textarea.tsx @@ -1,7 +1,7 @@ import classNames from 'clsx'; import React from 'react'; -interface ITextarea extends Pick, 'maxLength' | 'onChange' | 'required' | 'disabled' | 'rows' | 'readOnly'> { +interface ITextarea extends Pick, 'maxLength' | 'onChange' | 'onKeyDown' | 'required' | 'disabled' | 'rows' | 'readOnly'> { /** Put the cursor into the input on mount. */ autoFocus?: boolean, /** The initial text in the input. */ diff --git a/app/soapbox/features/account/components/header.tsx b/app/soapbox/features/account/components/header.tsx index 21e44f33b..91e2685b7 100644 --- a/app/soapbox/features/account/components/header.tsx +++ b/app/soapbox/features/account/components/header.tsx @@ -66,6 +66,7 @@ const messages = defineMessages({ removeFromFollowersConfirm: { id: 'confirmations.remove_from_followers.confirm', defaultMessage: 'Remove' }, userEndorsed: { id: 'account.endorse.success', defaultMessage: 'You are now featuring @{acct} on your profile' }, userUnendorsed: { id: 'account.unendorse.success', defaultMessage: 'You are no longer featuring @{acct}' }, + composeEvent: { od: 'navigation.compose_event', defaultMessage: 'Create new event' }, }); interface IHeader { @@ -207,6 +208,10 @@ const Header: React.FC = ({ account }) => { history.push('/search'); }; + const onComposeEvent = () => { + dispatch(openModal('COMPOSE_EVENT')); + }; + const onAvatarClick = () => { const avatar = normalizeAttachment({ type: 'image', @@ -291,6 +296,13 @@ const Header: React.FC = ({ account }) => { to: '/blocks', icon: require('@tabler/icons/ban.svg'), }); + if (features.events) { + menu.push({ + text: intl.formatMessage(messages.composeEvent), + action: onComposeEvent, + icon: require('@tabler/icons/calendar.svg'), + }); + } } else { menu.push({ text: intl.formatMessage(messages.mention, { name: account.username }), diff --git a/app/soapbox/features/ui/components/modals/join-event-modal.tsx b/app/soapbox/features/ui/components/modals/join-event-modal.tsx index e7014bbbf..a8f0e7368 100644 --- a/app/soapbox/features/ui/components/modals/join-event-modal.tsx +++ b/app/soapbox/features/ui/components/modals/join-event-modal.tsx @@ -3,10 +3,11 @@ import { defineMessages, FormattedMessage, useIntl } from 'react-intl'; import { joinEvent } from 'soapbox/actions/events'; import { closeModal } from 'soapbox/actions/modals'; -import { Modal, Text } from 'soapbox/components/ui'; +import { FormGroup, Modal, Textarea } from 'soapbox/components/ui'; import { useAppDispatch } from 'soapbox/hooks'; const messages = defineMessages({ + hint: { id: 'join_event.hint', defaultMessage: 'You can tell the organizer why do you want to participate in this event:' }, placeholder: { id: 'join_event.placeholder', defaultMessage: 'Message to organizer' }, join: { id: 'join_event.join', defaultMessage: 'Request join' }, }); @@ -51,19 +52,16 @@ const AccountNoteModal: React.FC = ({ statusId }) => { confirmationText={intl.formatMessage(messages.join)} confirmationDisabled={isSubmitting} > - - - - -