# All files / composer/components EmptyTextAlert.jsx

0% Statements 0/10
100% Branches 0/0
0% Functions 0/4
0% Lines 0/10

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52

     import React from 'react';
    import PropTypes from 'prop-types';
    import Modal from '../__legacy-buffer-web-shared-components__/modal/modal';
    import ModalActionCreators from '../__legacy-buffer-web-shared-components__/modal/actionCreators.js';
    import AppActionCreators from '../action-creators/AppActionCreators';
    import Button from '../components/Button';
    import styles from './css/EmptyTextAlert.css';

    class EmptyTextAlert extends React.Component {
      static propTypes = {
        queueingType: PropTypes.string.isRequired,
      };

      onClickCancel = () => {
        ModalActionCreators.closeModal();
        AppActionCreators.trackUserAction(
          ['composer', 'empty_text_alert', 'button_click', 'cancel']);
      };
      onClickSendAndRemember = () => {
        ModalActionCreators.closeModal();
        AppActionCreators.rememberModalView('remember_confirm_saving_modal');
        AppActionCreators.saveDrafts(this.props.queueingType);
        AppActionCreators.trackUserAction(
          ['composer', 'empty_text_alert', 'button_click', 'confirm_and_remember']);
      };
      onClickSend = () => {
        ModalActionCreators.closeModal();
        AppActionCreators.saveDrafts(this.props.queueingType);
        AppActionCreators.trackUserAction(
          ['composer', 'empty_text_alert', 'button_click', 'confirm']);
      };

      render() {
        return (
          <Modal classNames={{modal: styles.modalStyles}}>
            <h2 className={styles.title}>Send update?</h2>
            <p>Looks like you're posting an update to Facebook without any text.</p>
            <p>Keen to post this to Facebook anyway?</p>
            <div className={styles.buttonsContainer}>
              <Button className={styles.cancelButton} onClick={this.onClickCancel}>Cancel</Button>
              <Button className={styles.sendAndRemember} onClick={this.onClickSendAndRemember}>
                Send and don't ask again
              </Button>
              <Button className={styles.sendButton} onClick={this.onClickSend}>Send</Button>
            </div>
          </Modal>
        );
      }
    }

    export default EmptyTextAlert;