{"version":3,"sources":["webpack:///app/javascript/tank/sources/git/git.pleroma.social/pleroma/mastofe/app/javascript/mastodon/features/ui/components/block_modal.js"],"names":["BlockModal","connect","getAccount","makeGetAccount","state","account","getIn","dispatch","onConfirm","blockAccount","get","onBlockAndReport","initReport","onClose","closeModal","injectIntl","props","c","button","componentDidMount","this","focus","render","className","id","defaultMessage","values","name","onClick","handleCancel","handleSecondary","handleClick","ref","setRef","React","PureComponent"],"mappings":"uPAwCMA,EAFUC,mBA3BY,WAC1B,IAAMC,EAAaC,cAMnB,OAJwB,SAAAC,GAAK,MAAK,CAChCC,QAASH,EAAWE,EAAOA,EAAME,MAAM,CAAC,SAAU,MAAO,qBAMlC,SAAAC,GACzB,MAAO,CACLC,UADK,SACKH,GACRE,EAASE,YAAaJ,EAAQK,IAAI,SAGpCC,iBALK,SAKYN,GACfE,EAASE,YAAaJ,EAAQK,IAAI,QAClCH,EAASK,YAAWP,KAGtBQ,QAVK,WAWHN,EAASO,mB,GAMdC,Y,+LAee,WACZ,EAAKC,MAAMH,UACX,EAAKG,MAAMR,UAAU,EAAKQ,MAAMX,Y,8CAGhB,WAChB,EAAKW,MAAMH,UACX,EAAKG,MAAML,iBAAiB,EAAKK,MAAMX,Y,2CAG1B,WACb,EAAKW,MAAMH,a,qCAGJ,SAACI,GACR,EAAKC,OAASD,K,8CAnBhBE,kBAAA,WACEC,KAAKF,OAAOG,S,EAqBdC,OAAA,WAAW,IACDjB,EAAYe,KAAKJ,MAAjBX,QAER,OACE,mBAAKkB,UAAU,sCAAf,EACE,mBAAKA,UAAU,+BAAf,EACE,0BACE,YAAC,IAAD,CACEC,GAAG,8BACHC,eAAe,yCACfC,OAAQ,CAAEC,KAAM,mCAAUtB,EAAQK,IAAI,cAK5C,mBAAKa,UAAU,gCAAf,EACE,YAAC,IAAD,CAAQK,QAASR,KAAKS,aAAcN,UAAU,mCAA9C,EACE,YAAC,IAAD,CAAkBC,GAAG,4BAA4BC,eAAe,YAElE,YAAC,IAAD,CAAQG,QAASR,KAAKU,gBAAiBP,UAAU,6CAAjD,EACE,YAAC,IAAD,CAAkBC,GAAG,uCAAuCC,eAAe,oBAE7E,kBAAC,IAAD,CAAQG,QAASR,KAAKW,YAAaC,IAAKZ,KAAKa,QAC3C,YAAC,IAAD,CAAkBT,GAAG,8BAA8BC,eAAe,c,GAvDrDS,IAAMC,iB","file":"modals/block_modal.js","sourcesContent":["import React from 'react';\nimport { connect } from 'react-redux';\nimport PropTypes from 'prop-types';\nimport { injectIntl, FormattedMessage } from 'react-intl';\nimport { makeGetAccount } from '../../../selectors';\nimport Button from '../../../components/button';\nimport { closeModal } from '../../../actions/modal';\nimport { blockAccount } from '../../../actions/accounts';\nimport { initReport } from '../../../actions/reports';\n\n\nconst makeMapStateToProps = () => {\n  const getAccount = makeGetAccount();\n\n  const mapStateToProps = state => ({\n    account: getAccount(state, state.getIn(['blocks', 'new', 'account_id'])),\n  });\n\n  return mapStateToProps;\n};\n\nconst mapDispatchToProps = dispatch => {\n  return {\n    onConfirm(account) {\n      dispatch(blockAccount(account.get('id')));\n    },\n\n    onBlockAndReport(account) {\n      dispatch(blockAccount(account.get('id')));\n      dispatch(initReport(account));\n    },\n\n    onClose() {\n      dispatch(closeModal());\n    },\n  };\n};\n\nexport default @connect(makeMapStateToProps, mapDispatchToProps)\n@injectIntl\nclass BlockModal extends React.PureComponent {\n\n  static propTypes = {\n    account: PropTypes.object.isRequired,\n    onClose: PropTypes.func.isRequired,\n    onBlockAndReport: PropTypes.func.isRequired,\n    onConfirm: PropTypes.func.isRequired,\n    intl: PropTypes.object.isRequired,\n  };\n\n  componentDidMount() {\n    this.button.focus();\n  }\n\n  handleClick = () => {\n    this.props.onClose();\n    this.props.onConfirm(this.props.account);\n  }\n\n  handleSecondary = () => {\n    this.props.onClose();\n    this.props.onBlockAndReport(this.props.account);\n  }\n\n  handleCancel = () => {\n    this.props.onClose();\n  }\n\n  setRef = (c) => {\n    this.button = c;\n  }\n\n  render () {\n    const { account } = this.props;\n\n    return (\n      <div className='modal-root__modal block-modal'>\n        <div className='block-modal__container'>\n          <p>\n            <FormattedMessage\n              id='confirmations.block.message'\n              defaultMessage='Are you sure you want to block {name}?'\n              values={{ name: <strong>@{account.get('acct')}</strong> }}\n            />\n          </p>\n        </div>\n\n        <div className='block-modal__action-bar'>\n          <Button onClick={this.handleCancel} className='block-modal__cancel-button'>\n            <FormattedMessage id='confirmation_modal.cancel' defaultMessage='Cancel' />\n          </Button>\n          <Button onClick={this.handleSecondary} className='confirmation-modal__secondary-button'>\n            <FormattedMessage id='confirmations.block.block_and_report' defaultMessage='Block & Report' />\n          </Button>\n          <Button onClick={this.handleClick} ref={this.setRef}>\n            <FormattedMessage id='confirmations.block.confirm' defaultMessage='Block' />\n          </Button>\n        </div>\n      </div>\n    );\n  }\n\n}\n"],"sourceRoot":""}