2017-07-22 03:33:16 +09:00
|
|
|
/**
|
|
|
|
* Buttons widget for controlling the notification clearing mode.
|
|
|
|
* In idle state, the cleaning mode button is shown. When the mode is active,
|
|
|
|
* a Confirm and Abort buttons are shown in its place.
|
|
|
|
*/
|
|
|
|
|
|
|
|
import PropTypes from 'prop-types';
|
2023-05-28 23:38:10 +09:00
|
|
|
|
2017-07-22 03:33:16 +09:00
|
|
|
import { defineMessages, injectIntl } from 'react-intl';
|
2023-05-28 23:38:10 +09:00
|
|
|
|
|
|
|
import classNames from 'classnames';
|
|
|
|
|
2017-07-22 03:33:16 +09:00
|
|
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
2023-05-28 23:38:10 +09:00
|
|
|
|
2023-10-25 02:45:08 +09:00
|
|
|
import { ReactComponent as DeleteIcon } from '@material-symbols/svg-600/outlined/delete.svg';
|
|
|
|
|
2023-05-09 10:11:56 +09:00
|
|
|
import { Icon } from 'flavours/glitch/components/icon';
|
2017-07-22 03:33:16 +09:00
|
|
|
|
|
|
|
const messages = defineMessages({
|
2017-07-31 01:36:28 +09:00
|
|
|
btnAll : { id: 'notification_purge.btn_all', defaultMessage: 'Select\nall' },
|
|
|
|
btnNone : { id: 'notification_purge.btn_none', defaultMessage: 'Select\nnone' },
|
|
|
|
btnInvert : { id: 'notification_purge.btn_invert', defaultMessage: 'Invert\nselection' },
|
|
|
|
btnApply : { id: 'notification_purge.btn_apply', defaultMessage: 'Clear\nselected' },
|
2017-07-22 03:33:16 +09:00
|
|
|
});
|
|
|
|
|
2019-09-09 22:16:08 +09:00
|
|
|
class NotificationPurgeButtons extends ImmutablePureComponent {
|
2017-07-22 03:33:16 +09:00
|
|
|
|
|
|
|
static propTypes = {
|
2017-07-31 01:36:28 +09:00
|
|
|
onDeleteMarked : PropTypes.func.isRequired,
|
|
|
|
onMarkAll : PropTypes.func.isRequired,
|
|
|
|
onMarkNone : PropTypes.func.isRequired,
|
|
|
|
onInvert : PropTypes.func.isRequired,
|
2017-07-22 03:33:16 +09:00
|
|
|
intl: PropTypes.object.isRequired,
|
2017-07-31 01:36:28 +09:00
|
|
|
markNewForDelete: PropTypes.bool,
|
2017-07-22 03:33:16 +09:00
|
|
|
};
|
|
|
|
|
|
|
|
render () {
|
2017-07-31 01:36:28 +09:00
|
|
|
const { intl, markNewForDelete } = this.props;
|
2017-07-22 03:33:16 +09:00
|
|
|
|
2017-07-31 01:36:28 +09:00
|
|
|
//className='active'
|
|
|
|
return (
|
|
|
|
<div className='column-header__notif-cleaning-buttons'>
|
2023-05-07 22:04:59 +09:00
|
|
|
<button onClick={this.props.onMarkAll} className={classNames('column-header__button', { active: markNewForDelete })}>
|
2017-07-31 01:36:28 +09:00
|
|
|
<b>∀</b><br />{intl.formatMessage(messages.btnAll)}
|
2017-07-22 03:33:16 +09:00
|
|
|
</button>
|
2017-07-31 01:36:28 +09:00
|
|
|
|
2023-05-07 22:04:59 +09:00
|
|
|
<button onClick={this.props.onMarkNone} className={classNames('column-header__button', { active: !markNewForDelete })}>
|
2017-07-31 01:36:28 +09:00
|
|
|
<b>∅</b><br />{intl.formatMessage(messages.btnNone)}
|
2017-07-22 03:33:16 +09:00
|
|
|
</button>
|
2017-07-31 01:36:28 +09:00
|
|
|
|
2023-05-07 22:04:59 +09:00
|
|
|
<button onClick={this.props.onInvert} className='column-header__button'>
|
2017-07-31 01:36:28 +09:00
|
|
|
<b>¬</b><br />{intl.formatMessage(messages.btnInvert)}
|
2017-07-22 03:33:16 +09:00
|
|
|
</button>
|
|
|
|
|
2023-05-07 22:04:59 +09:00
|
|
|
<button onClick={this.props.onDeleteMarked} className='column-header__button'>
|
2023-10-25 02:45:08 +09:00
|
|
|
<Icon id='trash' icon={DeleteIcon} /><br />{intl.formatMessage(messages.btnApply)}
|
2017-07-31 01:36:28 +09:00
|
|
|
</button>
|
2017-07-22 03:33:16 +09:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2023-03-25 07:15:25 +09:00
|
|
|
|
|
|
|
export default injectIntl(NotificationPurgeButtons);
|