Add 'create event' button to profile dropdown for now
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
7b2193d753
commit
6b5e802bd0
|
@ -1,7 +1,7 @@
|
||||||
import classNames from 'clsx';
|
import classNames from 'clsx';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
interface ITextarea extends Pick<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'maxLength' | 'onChange' | 'required' | 'disabled' | 'rows' | 'readOnly'> {
|
interface ITextarea extends Pick<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'maxLength' | 'onChange' | 'onKeyDown' | 'required' | 'disabled' | 'rows' | 'readOnly'> {
|
||||||
/** Put the cursor into the input on mount. */
|
/** Put the cursor into the input on mount. */
|
||||||
autoFocus?: boolean,
|
autoFocus?: boolean,
|
||||||
/** The initial text in the input. */
|
/** The initial text in the input. */
|
||||||
|
|
|
@ -66,6 +66,7 @@ const messages = defineMessages({
|
||||||
removeFromFollowersConfirm: { id: 'confirmations.remove_from_followers.confirm', defaultMessage: 'Remove' },
|
removeFromFollowersConfirm: { id: 'confirmations.remove_from_followers.confirm', defaultMessage: 'Remove' },
|
||||||
userEndorsed: { id: 'account.endorse.success', defaultMessage: 'You are now featuring @{acct} on your profile' },
|
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}' },
|
userUnendorsed: { id: 'account.unendorse.success', defaultMessage: 'You are no longer featuring @{acct}' },
|
||||||
|
composeEvent: { od: 'navigation.compose_event', defaultMessage: 'Create new event' },
|
||||||
});
|
});
|
||||||
|
|
||||||
interface IHeader {
|
interface IHeader {
|
||||||
|
@ -207,6 +208,10 @@ const Header: React.FC<IHeader> = ({ account }) => {
|
||||||
history.push('/search');
|
history.push('/search');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onComposeEvent = () => {
|
||||||
|
dispatch(openModal('COMPOSE_EVENT'));
|
||||||
|
};
|
||||||
|
|
||||||
const onAvatarClick = () => {
|
const onAvatarClick = () => {
|
||||||
const avatar = normalizeAttachment({
|
const avatar = normalizeAttachment({
|
||||||
type: 'image',
|
type: 'image',
|
||||||
|
@ -291,6 +296,13 @@ const Header: React.FC<IHeader> = ({ account }) => {
|
||||||
to: '/blocks',
|
to: '/blocks',
|
||||||
icon: require('@tabler/icons/ban.svg'),
|
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 {
|
} else {
|
||||||
menu.push({
|
menu.push({
|
||||||
text: intl.formatMessage(messages.mention, { name: account.username }),
|
text: intl.formatMessage(messages.mention, { name: account.username }),
|
||||||
|
|
|
@ -3,10 +3,11 @@ import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
||||||
|
|
||||||
import { joinEvent } from 'soapbox/actions/events';
|
import { joinEvent } from 'soapbox/actions/events';
|
||||||
import { closeModal } from 'soapbox/actions/modals';
|
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';
|
import { useAppDispatch } from 'soapbox/hooks';
|
||||||
|
|
||||||
const messages = defineMessages({
|
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' },
|
placeholder: { id: 'join_event.placeholder', defaultMessage: 'Message to organizer' },
|
||||||
join: { id: 'join_event.join', defaultMessage: 'Request join' },
|
join: { id: 'join_event.join', defaultMessage: 'Request join' },
|
||||||
});
|
});
|
||||||
|
@ -51,12 +52,8 @@ const AccountNoteModal: React.FC<IAccountNoteModal> = ({ statusId }) => {
|
||||||
confirmationText={intl.formatMessage(messages.join)}
|
confirmationText={intl.formatMessage(messages.join)}
|
||||||
confirmationDisabled={isSubmitting}
|
confirmationDisabled={isSubmitting}
|
||||||
>
|
>
|
||||||
<Text theme='muted'>
|
<FormGroup labelText={intl.formatMessage(messages.hint)}>
|
||||||
<FormattedMessage id='join_event.hint' defaultMessage='You can tell the organizer why do you want to participate in this event:' />
|
<Textarea
|
||||||
</Text>
|
|
||||||
|
|
||||||
<textarea
|
|
||||||
className='setting-text light'
|
|
||||||
placeholder={intl.formatMessage(messages.placeholder)}
|
placeholder={intl.formatMessage(messages.placeholder)}
|
||||||
value={participationMessage}
|
value={participationMessage}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
|
@ -64,6 +61,7 @@ const AccountNoteModal: React.FC<IAccountNoteModal> = ({ statusId }) => {
|
||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
autoFocus
|
autoFocus
|
||||||
/>
|
/>
|
||||||
|
</FormGroup>
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -20,8 +20,6 @@ const messages = defineMessages({
|
||||||
blankslate: { id: 'report.reason.blankslate', defaultMessage: 'You have removed all statuses from being selected.' },
|
blankslate: { id: 'report.reason.blankslate', defaultMessage: 'You have removed all statuses from being selected.' },
|
||||||
done: { id: 'report.done', defaultMessage: 'Done' },
|
done: { id: 'report.done', defaultMessage: 'Done' },
|
||||||
next: { id: 'report.next', defaultMessage: 'Next' },
|
next: { id: 'report.next', defaultMessage: 'Next' },
|
||||||
close: { id: 'lightbox.close', defaultMessage: 'Close' },
|
|
||||||
placeholder: { id: 'report.placeholder', defaultMessage: 'Additional comments' },
|
|
||||||
submit: { id: 'report.submit', defaultMessage: 'Submit' },
|
submit: { id: 'report.submit', defaultMessage: 'Submit' },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -279,6 +279,8 @@ const getInstanceFeatures = (instance: Instance) => {
|
||||||
*/
|
*/
|
||||||
ethereumLogin: v.software === MITRA,
|
ethereumLogin: v.software === MITRA,
|
||||||
|
|
||||||
|
events: v.software === PLEROMA && v.build === SOAPBOX && gte(v.version, '2.4.50'),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ability to address recipients of a status explicitly (with `to`).
|
* Ability to address recipients of a status explicitly (with `to`).
|
||||||
* @see POST /api/v1/statuses
|
* @see POST /api/v1/statuses
|
||||||
|
|
Loading…
Reference in New Issue