2022-02-24 00:45:22 +09:00
|
|
|
import PropTypes from 'prop-types';
|
2023-05-28 23:38:10 +09:00
|
|
|
|
2022-02-24 00:45:22 +09:00
|
|
|
import { FormattedMessage } from 'react-intl';
|
2023-05-28 23:38:10 +09:00
|
|
|
|
|
|
|
import classNames from 'classnames';
|
2023-10-20 02:44:55 +09:00
|
|
|
import { withRouter } from 'react-router-dom';
|
2023-05-28 23:38:10 +09:00
|
|
|
|
|
|
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
2022-02-24 00:45:22 +09:00
|
|
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
2023-05-28 23:38:10 +09:00
|
|
|
|
2022-02-24 00:45:22 +09:00
|
|
|
import { HotKeys } from 'react-hotkeys';
|
2023-05-28 23:38:10 +09:00
|
|
|
|
2024-01-16 19:27:26 +09:00
|
|
|
import PersonAddIcon from '@/material-icons/400-24px/person_add-fill.svg?react';
|
2023-05-28 23:38:10 +09:00
|
|
|
import { Icon } from 'flavours/glitch/components/icon';
|
2024-01-14 22:15:23 +09:00
|
|
|
import { Permalink } from 'flavours/glitch/components/permalink';
|
2022-02-24 00:45:22 +09:00
|
|
|
import AccountContainer from 'flavours/glitch/containers/account_container';
|
2023-10-20 02:44:55 +09:00
|
|
|
import { WithRouterPropTypes } from 'flavours/glitch/utils/react_router';
|
2023-05-28 23:38:10 +09:00
|
|
|
|
2022-02-24 00:45:22 +09:00
|
|
|
import NotificationOverlayContainer from '../containers/overlay_container';
|
|
|
|
|
2023-10-20 02:44:55 +09:00
|
|
|
class NotificationAdminSignup extends ImmutablePureComponent {
|
2022-02-24 00:45:22 +09:00
|
|
|
|
|
|
|
static propTypes = {
|
|
|
|
hidden: PropTypes.bool,
|
|
|
|
id: PropTypes.string.isRequired,
|
|
|
|
account: ImmutablePropTypes.map.isRequired,
|
|
|
|
notification: ImmutablePropTypes.map.isRequired,
|
|
|
|
unread: PropTypes.bool,
|
2023-10-20 02:44:55 +09:00
|
|
|
...WithRouterPropTypes,
|
2022-02-24 00:45:22 +09:00
|
|
|
};
|
|
|
|
|
|
|
|
handleMoveUp = () => {
|
|
|
|
const { notification, onMoveUp } = this.props;
|
|
|
|
onMoveUp(notification.get('id'));
|
2023-02-04 04:52:07 +09:00
|
|
|
};
|
2022-02-24 00:45:22 +09:00
|
|
|
|
|
|
|
handleMoveDown = () => {
|
|
|
|
const { notification, onMoveDown } = this.props;
|
|
|
|
onMoveDown(notification.get('id'));
|
2023-02-04 04:52:07 +09:00
|
|
|
};
|
2022-02-24 00:45:22 +09:00
|
|
|
|
|
|
|
handleOpen = () => {
|
|
|
|
this.handleOpenProfile();
|
2023-02-04 04:52:07 +09:00
|
|
|
};
|
2022-02-24 00:45:22 +09:00
|
|
|
|
|
|
|
handleOpenProfile = () => {
|
2023-10-20 02:44:55 +09:00
|
|
|
const { history, notification } = this.props;
|
|
|
|
history.push(`/@${notification.getIn(['account', 'acct'])}`);
|
2023-02-04 04:52:07 +09:00
|
|
|
};
|
2022-02-24 00:45:22 +09:00
|
|
|
|
|
|
|
handleMention = e => {
|
|
|
|
e.preventDefault();
|
|
|
|
|
2023-10-20 02:44:55 +09:00
|
|
|
const { history, notification, onMention } = this.props;
|
|
|
|
onMention(notification.get('account'), history);
|
2023-02-04 04:52:07 +09:00
|
|
|
};
|
2022-02-24 00:45:22 +09:00
|
|
|
|
|
|
|
getHandlers () {
|
|
|
|
return {
|
|
|
|
moveUp: this.handleMoveUp,
|
|
|
|
moveDown: this.handleMoveDown,
|
|
|
|
open: this.handleOpen,
|
|
|
|
openProfile: this.handleOpenProfile,
|
|
|
|
mention: this.handleMention,
|
|
|
|
reply: this.handleMention,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
render () {
|
|
|
|
const { account, notification, hidden, unread } = this.props;
|
|
|
|
|
|
|
|
// Links to the display name.
|
|
|
|
const displayName = account.get('display_name_html') || account.get('username');
|
|
|
|
const link = (
|
|
|
|
<bdi><Permalink
|
|
|
|
className='notification__display-name'
|
|
|
|
href={account.get('url')}
|
|
|
|
title={account.get('acct')}
|
|
|
|
to={`/@${account.get('acct')}`}
|
|
|
|
dangerouslySetInnerHTML={{ __html: displayName }}
|
|
|
|
/></bdi>
|
|
|
|
);
|
|
|
|
|
|
|
|
// Renders.
|
|
|
|
return (
|
|
|
|
<HotKeys handlers={this.getHandlers()}>
|
2023-04-04 23:33:44 +09:00
|
|
|
<div className={classNames('notification notification-admin-sign-up focusable', { unread })} tabIndex={0}>
|
2022-02-24 00:45:22 +09:00
|
|
|
<div className='notification__message'>
|
|
|
|
<div className='notification__favourite-icon-wrapper'>
|
2023-10-25 02:45:08 +09:00
|
|
|
<Icon id='user-plus' icon={PersonAddIcon} />
|
2022-02-24 00:45:22 +09:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<FormattedMessage
|
|
|
|
id='notification.admin.sign_up'
|
|
|
|
defaultMessage='{name} signed up'
|
|
|
|
values={{ name: link }}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<AccountContainer hidden={hidden} id={account.get('id')} withNote={false} />
|
|
|
|
<NotificationOverlayContainer notification={notification} />
|
|
|
|
</div>
|
|
|
|
</HotKeys>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2023-10-20 02:44:55 +09:00
|
|
|
|
|
|
|
export default withRouter(NotificationAdminSignup);
|