You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
2.0 KiB

  1. /**
  2. * Buttons widget for controlling the notification clearing mode.
  3. * In idle state, the cleaning mode button is shown. When the mode is active,
  4. * a Confirm and Abort buttons are shown in its place.
  5. */
  6. // Package imports //
  7. import React from 'react';
  8. import PropTypes from 'prop-types';
  9. import { defineMessages, injectIntl } from 'react-intl';
  10. import ImmutablePureComponent from 'react-immutable-pure-component';
  11. const messages = defineMessages({
  12. btnAll : { id: 'notification_purge.btn_all', defaultMessage: 'Select\nall' },
  13. btnNone : { id: 'notification_purge.btn_none', defaultMessage: 'Select\nnone' },
  14. btnInvert : { id: 'notification_purge.btn_invert', defaultMessage: 'Invert\nselection' },
  15. btnApply : { id: 'notification_purge.btn_apply', defaultMessage: 'Clear\nselected' },
  16. });
  17. @injectIntl
  18. export default class NotificationPurgeButtons extends ImmutablePureComponent {
  19. static propTypes = {
  20. onDeleteMarked : PropTypes.func.isRequired,
  21. onMarkAll : PropTypes.func.isRequired,
  22. onMarkNone : PropTypes.func.isRequired,
  23. onInvert : PropTypes.func.isRequired,
  24. intl: PropTypes.object.isRequired,
  25. markNewForDelete: PropTypes.bool,
  26. };
  27. render () {
  28. const { intl, markNewForDelete } = this.props;
  29. //className='active'
  30. return (
  31. <div className='column-header__notif-cleaning-buttons'>
  32. <button onClick={this.props.onMarkAll} className={markNewForDelete ? 'active' : ''}>
  33. <b></b><br />{intl.formatMessage(messages.btnAll)}
  34. </button>
  35. <button onClick={this.props.onMarkNone} className={!markNewForDelete ? 'active' : ''}>
  36. <b></b><br />{intl.formatMessage(messages.btnNone)}
  37. </button>
  38. <button onClick={this.props.onInvert}>
  39. <b>¬</b><br />{intl.formatMessage(messages.btnInvert)}
  40. </button>
  41. <button onClick={this.props.onDeleteMarked}>
  42. <i className='fa fa-trash' /><br />{intl.formatMessage(messages.btnApply)}
  43. </button>
  44. </div>
  45. );
  46. }
  47. }