{"version":3,"sources":["webpack:///app/javascript/tank/sources/git/git.pleroma.social/pleroma/mastofe/app/javascript/mastodon/features/favourites/index.js"],"names":["messages","defineMessages","refresh","Favourites","connect","state","props","accountIds","getIn","params","statusId","injectIntl","dispatch","fetchFavourites","componentWillMount","this","componentWillReceiveProps","nextProps","render","intl","shouldUpdateScroll","multiColumn","emptyMessage","id","defaultMessage","bindToDocument","showBackButton","extraButton","className","title","formatMessage","aria-label","onClick","handleRefresh","scrollKey","map","withNote","ImmutablePureComponent","PropTypes","object","isRequired","func","ImmutablePropTypes","list","bool"],"mappings":"0TAcA,IAAMA,EAAWC,YAAe,CAC9BC,QAAQ,CAAD,yCASHC,EAFUC,mBAJQ,SAACC,EAAOC,GAAR,MAAmB,CACzCC,WAAYF,EAAMG,MAAM,CAAC,aAAc,gBAAiBF,EAAMG,OAAOC,c,GAItEC,a,8NAwBiB,WACd,EAAKL,MAAMM,SAASC,YAAgB,EAAKP,MAAMG,OAAOC,c,6BAbxDI,mBAAA,WACOC,KAAKT,MAAMC,YACdQ,KAAKT,MAAMM,SAASC,YAAgBE,KAAKT,MAAMG,OAAOC,Y,EAI1DM,0BAAA,SAA2BC,GACrBA,EAAUR,OAAOC,WAAaK,KAAKT,MAAMG,OAAOC,UAAYO,EAAUR,OAAOC,UAC/EK,KAAKT,MAAMM,SAASC,YAAgBI,EAAUR,OAAOC,Y,EAQzDQ,OAAA,WAAW,IAAD,EACsDH,KAAKT,MAA3Da,EADA,EACAA,KAAMC,EADN,EACMA,mBAAoBb,EAD1B,EAC0BA,WAAYc,EADtC,EACsCA,YAE9C,IAAKd,EACH,OACE,YAAC,IAAD,UACE,YAAC,IAAD,KAKN,IAAMe,EAAe,YAAC,IAAD,CAAkBC,GAAG,0BAA0BC,eAAe,oFAEnF,OACE,YAAC,IAAD,CAAQC,gBAAiBJ,QAAzB,EACE,YAAC,IAAD,CACEK,gBAAc,EACdL,YAAaA,EACbM,YACE,sBAAQC,UAAU,wBAAwBC,MAAOV,EAAKW,cAAc9B,EAASE,SAAU6B,aAAYZ,EAAKW,cAAc9B,EAASE,SAAU8B,QAASjB,KAAKkB,oBAAvJ,EAAsK,YAAC,IAAD,CAAMV,GAAG,eAInL,YAAC,IAAD,CACEW,UAAU,aACVd,mBAAoBA,EACpBE,aAAcA,EACdG,gBAAiBJ,QAJnB,EAMGd,EAAW4B,KAAI,SAAAZ,GAAE,OAChB,YAAC,IAAD,CAA2BA,GAAIA,EAAIa,UAAU,GAAtBb,U,GAzDVc,K,0BAEJ,CACjB5B,OAAQ6B,IAAUC,OAAOC,WACzB5B,SAAU0B,IAAUG,KAAKD,WACzBpB,mBAAoBkB,IAAUG,KAC9BlC,WAAYmC,IAAmBC,KAC/BtB,YAAaiB,IAAUM,KACvBzB,KAAMmB,IAAUC,OAAOC,a","file":"features/favourites.js","sourcesContent":["import React from 'react';\nimport { connect } from 'react-redux';\nimport ImmutablePureComponent from 'react-immutable-pure-component';\nimport PropTypes from 'prop-types';\nimport ImmutablePropTypes from 'react-immutable-proptypes';\nimport LoadingIndicator from '../../components/loading_indicator';\nimport { fetchFavourites } from '../../actions/interactions';\nimport { defineMessages, injectIntl, FormattedMessage } from 'react-intl';\nimport AccountContainer from '../../containers/account_container';\nimport Column from '../ui/components/column';\nimport ScrollableList from '../../components/scrollable_list';\nimport Icon from 'mastodon/components/icon';\nimport ColumnHeader from '../../components/column_header';\n\nconst messages = defineMessages({\n  refresh: { id: 'refresh', defaultMessage: 'Refresh' },\n});\n\nconst mapStateToProps = (state, props) => ({\n  accountIds: state.getIn(['user_lists', 'favourited_by', props.params.statusId]),\n});\n\nexport default @connect(mapStateToProps)\n@injectIntl\nclass Favourites extends ImmutablePureComponent {\n\n  static propTypes = {\n    params: PropTypes.object.isRequired,\n    dispatch: PropTypes.func.isRequired,\n    shouldUpdateScroll: PropTypes.func,\n    accountIds: ImmutablePropTypes.list,\n    multiColumn: PropTypes.bool,\n    intl: PropTypes.object.isRequired,\n  };\n\n  componentWillMount () {\n    if (!this.props.accountIds) {\n      this.props.dispatch(fetchFavourites(this.props.params.statusId));\n    }\n  }\n\n  componentWillReceiveProps (nextProps) {\n    if (nextProps.params.statusId !== this.props.params.statusId && nextProps.params.statusId) {\n      this.props.dispatch(fetchFavourites(nextProps.params.statusId));\n    }\n  }\n\n  handleRefresh = () => {\n    this.props.dispatch(fetchFavourites(this.props.params.statusId));\n  }\n\n  render () {\n    const { intl, shouldUpdateScroll, accountIds, multiColumn } = this.props;\n\n    if (!accountIds) {\n      return (\n        <Column>\n          <LoadingIndicator />\n        </Column>\n      );\n    }\n\n    const emptyMessage = <FormattedMessage id='empty_column.favourites' defaultMessage='No one has favourited this toot yet. When someone does, they will show up here.' />;\n\n    return (\n      <Column bindToDocument={!multiColumn}>\n        <ColumnHeader\n          showBackButton\n          multiColumn={multiColumn}\n          extraButton={(\n            <button className='column-header__button' title={intl.formatMessage(messages.refresh)} aria-label={intl.formatMessage(messages.refresh)} onClick={this.handleRefresh}><Icon id='refresh' /></button>\n          )}\n        />\n\n        <ScrollableList\n          scrollKey='favourites'\n          shouldUpdateScroll={shouldUpdateScroll}\n          emptyMessage={emptyMessage}\n          bindToDocument={!multiColumn}\n        >\n          {accountIds.map(id =>\n            <AccountContainer key={id} id={id} withNote={false} />,\n          )}\n        </ScrollableList>\n      </Column>\n    );\n  }\n\n}\n"],"sourceRoot":""}