{"version":3,"sources":["webpack:///app/javascript/builds/pleroma/mastofe/app/javascript/flavours/glitch/features/mutes/index.js"],"names":["messages","defineMessages","heading","id","defaultMessage","Mutes","connect","state","accountIds","getIn","injectIntl","e","_e$target","target","scrollTop","scrollHeight","clientHeight","_this","props","dispatch","expandMutes","prevRouterProps","_ref","location","mastodonModalOpen","componentWillMount","this","fetchMutes","render","_this$props","intl","Object","_babel_runtime_helpers_esm_jsx__WEBPACK_IMPORTED_MODULE_0__","flavours_glitch_features_ui_components_column__WEBPACK_IMPORTED_MODULE_10__","name","icon","formatMessage","flavours_glitch_components_column_back_button_slim__WEBPACK_IMPORTED_MODULE_11__","react_router_scroll_4__WEBPACK_IMPORTED_MODULE_9__","scrollKey","shouldUpdateScroll","className","onScroll","handleScroll","map","flavours_glitch_containers_account_container__WEBPACK_IMPORTED_MODULE_12__","flavours_glitch_components_loading_indicator__WEBPACK_IMPORTED_MODULE_8__","ImmutablePureComponent","params","PropTypes","object","isRequired","func","ImmutablePropTypes","list"],"mappings":"mSAaMA,EAAWC,YAAe,CAC9BC,QAAO,CAAAC,GAAA,eAAAC,eAAA,iBASYC,EAFpBC,kBAJuB,SAAAC,GAAK,MAAK,CAChCC,WAAYD,EAAME,MAAM,CAAC,aAAc,QAAS,eAIjDC,8MAcgB,SAACC,GAAM,IAAAC,EAC8BD,EAAEE,OADhCD,EACZE,YADYF,EACDG,aADCH,EACaI,cAG/BC,EAAKC,MAAMC,SAASC,iEAIH,SAACC,EAADC,GAAmC,IAAfC,EAAeD,EAAfC,SACvC,UAAOF,GAAmB,IAAIE,UAAY,IAAIhB,OAAS,IAAIiB,qBAClDD,EAAShB,OAASgB,EAAShB,MAAMiB,mEAd5CC,mBAAA,WACEC,KAAKR,MAAMC,SAASQ,kBAgBtBC,OAAA,WAAU,IAAAC,EACqBH,KAAKR,MAA1BY,EADAD,EACAC,KAAMtB,EADNqB,EACMrB,WAEd,OAAKA,EASHuB,OAAAC,EAAA,EAAAD,CAACE,EAAA,EAAD,CAAQC,KAAK,QAAQC,KAAK,aAAajC,QAAS4B,EAAKM,cAAcpC,EAASE,eAA5E,EACE6B,OAAAC,EAAA,EAAAD,CAACM,EAAA,EAAD,IACAN,OAAAC,EAAA,EAAAD,CAACO,EAAA,EAAD,CAAiBC,UAAU,QAAQC,mBAAoBd,KAAKc,yBAA5D,EACET,OAAAC,EAAA,EAAAD,CAAA,OAAKU,UAAU,mBAAmBC,SAAUhB,KAAKiB,mBAAjD,EACGnC,EAAWoC,IAAI,SAAAzC,GAAE,OAChB4B,OAAAC,EAAA,EAAAD,CAACc,EAAA,EAAD,CAA2B1C,GAAIA,GAARA,QAZ7B4B,OAAAC,EAAA,EAAAD,CAACE,EAAA,EAAD,UACEF,OAAAC,EAAA,EAAAD,CAACe,EAAA,EAAD,SAhCyBC,+BAEd,CACjBC,OAAQC,IAAUC,OAAOC,WACzBhC,SAAU8B,IAAUG,KAAKD,WACzB3C,WAAY6C,IAAmBC,KAC/BxB,KAAMmB,IAAUC,OAAOC","file":"flavours/glitch/async/mutes.js","sourcesContent":["import React from 'react';\nimport { connect } from 'react-redux';\nimport PropTypes from 'prop-types';\nimport ImmutablePropTypes from 'react-immutable-proptypes';\nimport LoadingIndicator from 'flavours/glitch/components/loading_indicator';\nimport { ScrollContainer } from 'react-router-scroll-4';\nimport Column from 'flavours/glitch/features/ui/components/column';\nimport ColumnBackButtonSlim from 'flavours/glitch/components/column_back_button_slim';\nimport AccountContainer from 'flavours/glitch/containers/account_container';\nimport { fetchMutes, expandMutes } from 'flavours/glitch/actions/mutes';\nimport { defineMessages, injectIntl } from 'react-intl';\nimport ImmutablePureComponent from 'react-immutable-pure-component';\n\nconst messages = defineMessages({\n  heading: { id: 'column.mutes', defaultMessage: 'Muted users' },\n});\n\nconst mapStateToProps = state => ({\n  accountIds: state.getIn(['user_lists', 'mutes', 'items']),\n});\n\n@connect(mapStateToProps)\n@injectIntl\nexport default class Mutes extends ImmutablePureComponent {\n\n  static propTypes = {\n    params: PropTypes.object.isRequired,\n    dispatch: PropTypes.func.isRequired,\n    accountIds: ImmutablePropTypes.list,\n    intl: PropTypes.object.isRequired,\n  };\n\n  componentWillMount () {\n    this.props.dispatch(fetchMutes());\n  }\n\n  handleScroll = (e) => {\n    const { scrollTop, scrollHeight, clientHeight } = e.target;\n\n    if (scrollTop === scrollHeight - clientHeight) {\n      this.props.dispatch(expandMutes());\n    }\n  }\n\n  shouldUpdateScroll = (prevRouterProps, { location }) => {\n    if ((((prevRouterProps || {}).location || {}).state || {}).mastodonModalOpen) return false;\n    return !(location.state && location.state.mastodonModalOpen);\n  }\n\n  render () {\n    const { intl, accountIds } = this.props;\n\n    if (!accountIds) {\n      return (\n        <Column>\n          <LoadingIndicator />\n        </Column>\n      );\n    }\n\n    return (\n      <Column name='mutes' icon='volume-off' heading={intl.formatMessage(messages.heading)}>\n        <ColumnBackButtonSlim />\n        <ScrollContainer scrollKey='mutes' shouldUpdateScroll={this.shouldUpdateScroll}>\n          <div className='scrollable mutes' onScroll={this.handleScroll}>\n            {accountIds.map(id =>\n              <AccountContainer key={id} id={id} />\n            )}\n          </div>\n        </ScrollContainer>\n      </Column>\n    );\n  }\n\n}\n"],"sourceRoot":""}