2017-07-21 20:33:16 +02: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 16:38:10 +02:00
|
|
|
|
2017-07-21 20:33:16 +02:00
|
|
|
import { defineMessages, injectIntl } from 'react-intl';
|
2023-05-28 16:38:10 +02:00
|
|
|
|
|
|
|
import classNames from 'classnames';
|
|
|
|
|
2017-07-21 20:33:16 +02:00
|
|
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
2023-05-28 16:38:10 +02:00
|
|
|
|
2024-01-12 11:31:24 +01:00
|
|
|
import DeleteIcon from '@material-symbols/svg-600/outlined/delete.svg?react';
|
2023-10-24 19:45:08 +02:00
|
|
|
|
2023-05-09 03:11:56 +02:00
|
|
|
import { Icon } from 'flavours/glitch/components/icon';
|
2017-07-21 20:33:16 +02:00
|
|
|
|
|
|
|
const messages = defineMessages({
|
2017-07-30 18:36:28 +02: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-21 20:33:16 +02:00
|
|
|
});
|
|
|
|
|
2019-09-09 15:16:08 +02:00
|
|
|
class NotificationPurgeButtons extends ImmutablePureComponent {
|
2017-07-21 20:33:16 +02:00
|
|
|
|
|
|
|
static propTypes = {
|
2017-07-30 18:36:28 +02:00
|
|
|
onDeleteMarked : PropTypes.func.isRequired,
|
|
|
|
onMarkAll : PropTypes.func.isRequired,
|
|
|
|
onMarkNone : PropTypes.func.isRequired,
|
|
|
|
onInvert : PropTypes.func.isRequired,
|
2017-07-21 20:33:16 +02:00
|
|
|
intl: PropTypes.object.isRequired,
|
2017-07-30 18:36:28 +02:00
|
|
|
markNewForDelete: PropTypes.bool,
|
2017-07-21 20:33:16 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
render () {
|
2017-07-30 18:36:28 +02:00
|
|
|
const { intl, markNewForDelete } = this.props;
|
2017-07-21 20:33:16 +02:00
|
|
|
|
2017-07-30 18:36:28 +02:00
|
|
|
//className='active'
|
|
|
|
return (
|
|
|
|
<div className='column-header__notif-cleaning-buttons'>
|
2023-05-07 15:04:59 +02:00
|
|
|
<button onClick={this.props.onMarkAll} className={classNames('column-header__button', { active: markNewForDelete })}>
|
2017-07-30 18:36:28 +02:00
|
|
|
<b>∀</b><br />{intl.formatMessage(messages.btnAll)}
|
2017-07-21 20:33:16 +02:00
|
|
|
</button>
|
2017-07-30 18:36:28 +02:00
|
|
|
|
2023-05-07 15:04:59 +02:00
|
|
|
<button onClick={this.props.onMarkNone} className={classNames('column-header__button', { active: !markNewForDelete })}>
|
2017-07-30 18:36:28 +02:00
|
|
|
<b>∅</b><br />{intl.formatMessage(messages.btnNone)}
|
2017-07-21 20:33:16 +02:00
|
|
|
</button>
|
2017-07-30 18:36:28 +02:00
|
|
|
|
2023-05-07 15:04:59 +02:00
|
|
|
<button onClick={this.props.onInvert} className='column-header__button'>
|
2017-07-30 18:36:28 +02:00
|
|
|
<b>¬</b><br />{intl.formatMessage(messages.btnInvert)}
|
2017-07-21 20:33:16 +02:00
|
|
|
</button>
|
|
|
|
|
2023-05-07 15:04:59 +02:00
|
|
|
<button onClick={this.props.onDeleteMarked} className='column-header__button'>
|
2023-10-24 19:45:08 +02:00
|
|
|
<Icon id='trash' icon={DeleteIcon} /><br />{intl.formatMessage(messages.btnApply)}
|
2017-07-30 18:36:28 +02:00
|
|
|
</button>
|
2017-07-21 20:33:16 +02:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2023-03-24 23:15:25 +01:00
|
|
|
|
|
|
|
export default injectIntl(NotificationPurgeButtons);
|