{"version":3,"sources":["webpack:///./app/javascript/mastodon/features/favourites/index.jsx"],"names":["messages","defineMessages","refresh","id","defaultMessage","Favourites","ImmutablePureComponent","constructor","arguments","handleRefresh","this","props","dispatch","fetchFavourites","params","statusId","handleLoadMore","_debounce","expandFavourites","leading","UNSAFE_componentWillMount","accountIds","render","intl","hasMore","isLoading","multiColumn","_jsx","Column","LoadingIndicator","emptyMessage","FormattedMessage","bindToDocument","ColumnHeader","showBackButton","extraButton","type","className","title","formatMessage","onClick","Icon","ScrollableList","scrollKey","onLoadMore","map","AccountContainer","withNote","Helmet","name","content","propTypes","PropTypes","object","isRequired","func","ImmutablePropTypes","list","bool","connect","mapStateToProps","state","getIn","injectIntl"],"mappings":"8QAoBA,MAAMA,EAAWC,YAAe,CAC9BC,QAAS,CAAEC,GAAG,UAAYC,eAAe,aAS3C,MAAMC,UAAmBC,IAAuBC,cAAA,SAAAC,WAAA,KAkB9CC,cAAgB,KACdC,KAAKC,MAAMC,SAASC,YAAgBH,KAAKC,MAAMG,OAAOC,UAAU,EAChE,KAEFC,eAAiBC,KAAS,KACxBP,KAAKC,MAAMC,SAASM,YAAiBR,KAAKC,MAAMG,OAAOC,UAAU,GAChE,IAAK,CAAEI,SAAS,GAAQ,CAZ3BC,4BACOV,KAAKC,MAAMU,YACdX,KAAKC,MAAMC,SAASC,YAAgBH,KAAKC,MAAMG,OAAOC,UAE1D,CAUAO,SACE,MAAM,KAAEC,EAAI,WAAEF,EAAU,QAAEG,EAAO,UAAEC,EAAS,YAAEC,GAAgBhB,KAAKC,MAEnE,IAAKU,EACH,OACEM,YAACC,IAAM,UACLD,YAACE,IAAgB,KAKvB,MAAMC,EAAeH,YAACI,IAAgB,CAAC5B,GAAE,0BAA2BC,eAAe,mFAEnF,OACEuB,YAACC,IAAM,CAACI,gBAAiBN,QAAY,EACnCC,YAACM,IAAY,CACXC,gBAAc,EACdR,YAAaA,EACbS,YACER,YAAA,UAAQS,KAAK,SAASC,UAAU,wBAAwBC,MAAOf,EAAKgB,cAAcvC,EAASE,SAAU,aAAYqB,EAAKgB,cAAcvC,EAASE,SAAUsC,QAAS9B,KAAKD,oBAAc,EAACkB,YAACc,IAAI,CAACtC,GAAG,eAIjMwB,YAACe,IAAc,CACbC,UAAU,aACVC,WAAYlC,KAAKM,eACjBQ,QAASA,EACTC,UAAWA,EACXK,aAAcA,EACdE,gBAAiBN,QAAY,EAE5BL,EAAWwB,KAAI1C,GACdwB,YAACmB,IAAgB,CAAU3C,GAAIA,EAAI4C,UAAU,GAAtB5C,MAI3BwB,YAACqB,IAAM,UACLrB,YAAA,QAAMsB,KAAK,SAASC,QAAQ,aAIpC,EAnEI7C,EAEG8C,UAAY,CACjBrC,OAAQsC,IAAUC,OAAOC,WACzB1C,SAAUwC,IAAUG,KAAKD,WACzBjC,WAAYmC,IAAmBC,KAC/BjC,QAAS4B,IAAUM,KACnBjC,UAAW2B,IAAUM,KACrBhC,YAAa0B,IAAUM,KACvBnC,KAAM6B,IAAUC,OAAOC,YA8DZK,6BA7ESC,CAACC,EAAOlD,KAAK,CACnCU,WAAYwC,EAAMC,MAAM,CAAC,aAAc,gBAAiBnD,EAAMG,OAAOC,SAAU,UAC/ES,UAAWqC,EAAMC,MAAM,CAAC,aAAc,gBAAiBnD,EAAMG,OAAOC,SAAU,SAC9EU,UAAWoC,EAAMC,MAAM,CAAC,aAAc,gBAAiBnD,EAAMG,OAAOC,SAAU,cAAc,MA0E/E4C,CAAyBI,YAAW1D,G","file":"js/features/favourites-254e11c76304097a2f65.chunk.js","sourcesContent":["import PropTypes from 'prop-types';\n\nimport { defineMessages, injectIntl, FormattedMessage } from 'react-intl';\n\nimport { Helmet } from 'react-helmet';\n\nimport ImmutablePropTypes from 'react-immutable-proptypes';\nimport ImmutablePureComponent from 'react-immutable-pure-component';\nimport { connect } from 'react-redux';\n\nimport { debounce } from 'lodash';\n\nimport { fetchFavourites, expandFavourites } from 'mastodon/actions/interactions';\nimport ColumnHeader from 'mastodon/components/column_header';\nimport { Icon }  from 'mastodon/components/icon';\nimport { LoadingIndicator } from 'mastodon/components/loading_indicator';\nimport ScrollableList from 'mastodon/components/scrollable_list';\nimport AccountContainer from 'mastodon/containers/account_container';\nimport Column from 'mastodon/features/ui/components/column';\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, 'items']),\n  hasMore: !!state.getIn(['user_lists', 'favourited_by', props.params.statusId, 'next']),\n  isLoading: state.getIn(['user_lists', 'favourited_by', props.params.statusId, 'isLoading'], true),\n});\n\nclass Favourites extends ImmutablePureComponent {\n\n  static propTypes = {\n    params: PropTypes.object.isRequired,\n    dispatch: PropTypes.func.isRequired,\n    accountIds: ImmutablePropTypes.list,\n    hasMore: PropTypes.bool,\n    isLoading: PropTypes.bool,\n    multiColumn: PropTypes.bool,\n    intl: PropTypes.object.isRequired,\n  };\n\n  UNSAFE_componentWillMount () {\n    if (!this.props.accountIds) {\n      this.props.dispatch(fetchFavourites(this.props.params.statusId));\n    }\n  }\n\n  handleRefresh = () => {\n    this.props.dispatch(fetchFavourites(this.props.params.statusId));\n  };\n\n  handleLoadMore = debounce(() => {\n    this.props.dispatch(expandFavourites(this.props.params.statusId));\n  }, 300, { leading: true });\n\n  render () {\n    const { intl, accountIds, hasMore, isLoading, 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 favorited this post 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 type='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          onLoadMore={this.handleLoadMore}\n          hasMore={hasMore}\n          isLoading={isLoading}\n          emptyMessage={emptyMessage}\n          bindToDocument={!multiColumn}\n        >\n          {accountIds.map(id =>\n            <AccountContainer key={id} id={id} withNote={false} />,\n          )}\n        </ScrollableList>\n\n        <Helmet>\n          <meta name='robots' content='noindex' />\n        </Helmet>\n      </Column>\n    );\n  }\n\n}\n\nexport default connect(mapStateToProps)(injectIntl(Favourites));\n"],"sourceRoot":""}