]>
cat aescling's git repositories - mastodon.git/blob - app/javascript/mastodon/features/ui/components/mute_modal.js
1 import React
from 'react';
2 import { connect
} from 'react-redux';
3 import PropTypes
from 'prop-types';
4 import { injectIntl
, FormattedMessage
} from 'react-intl';
5 import Toggle
from 'react-toggle';
6 import Button
from '../../../components/button';
7 import { closeModal
} from '../../../actions/modal';
8 import { muteAccount
} from '../../../actions/accounts';
9 import { toggleHideNotifications
} from '../../../actions/mutes';
12 const mapStateToProps
= state
=> {
14 isSubmitting: state
.getIn(['reports', 'new', 'isSubmitting']),
15 account: state
.getIn(['mutes', 'new', 'account']),
16 notifications: state
.getIn(['mutes', 'new', 'notifications']),
20 const mapDispatchToProps
= dispatch
=> {
22 onConfirm(account
, notifications
) {
23 dispatch(muteAccount(account
.get('id'), notifications
));
27 dispatch(closeModal());
30 onToggleNotifications() {
31 dispatch(toggleHideNotifications());
36 @connect(mapStateToProps
, mapDispatchToProps
)
38 export default class MuteModal
extends React
.PureComponent
{
41 isSubmitting: PropTypes
.bool
.isRequired
,
42 account: PropTypes
.object
.isRequired
,
43 notifications: PropTypes
.bool
.isRequired
,
44 onClose: PropTypes
.func
.isRequired
,
45 onConfirm: PropTypes
.func
.isRequired
,
46 onToggleNotifications: PropTypes
.func
.isRequired
,
47 intl: PropTypes
.object
.isRequired
,
56 this.props
.onConfirm(this.props
.account
, this.props
.notifications
);
59 handleCancel
= () => {
67 toggleNotifications
= () => {
68 this.props
.onToggleNotifications();
72 const { account
, notifications
} = this.props
;
75 <div className
='modal-root__modal mute-modal'>
76 <div className
='mute-modal__container'>
79 id
='confirmations.mute.message'
80 defaultMessage
='Are you sure you want to mute {name}?'
81 values
={{ name: <strong
>@{account
.get('acct')}</strong
> }}
85 <label htmlFor
='mute-modal__hide-notifications-checkbox'>
86 <FormattedMessage id
='mute_modal.hide_notifications' defaultMessage
='Hide notifications from this user?' />
88 <Toggle id
='mute-modal__hide-notifications-checkbox' checked
={notifications
} onChange
={this.toggleNotifications
} />
93 <div className
='mute-modal__action-bar'>
94 <Button onClick
={this.handleCancel
} className
='mute-modal__cancel-button'>
95 <FormattedMessage id
='confirmation_modal.cancel' defaultMessage
='Cancel' />
97 <Button onClick
={this.handleClick
} ref
={this.setRef
}>
98 <FormattedMessage id
='confirmations.mute.confirm' defaultMessage
='Mute' />
This page took 0.127678 seconds and 4 git commands to generate.