{"version":3,"sources":["webpack:///./app/javascript/mastodon/features/favourites/index.jsx"],"names":["messages","defineMessages","refresh","id","defaultMessage","Favourites","ImmutablePureComponent","constructor","arguments","_defineProperty","this","props","dispatch","fetchFavourites","params","statusId","_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","handleRefresh","Icon","icon","RefreshIcon","ScrollableList","scrollKey","onLoadMore","handleLoadMore","map","Account","Helmet","name","content","PropTypes","object","isRequired","func","ImmutablePropTypes","list","bool","connect","mapStateToProps","state","getIn","injectIntl"],"mappings":"6SAqBA,MAAMA,EAAWC,YAAe,CAC9BC,QAAS,CAAEC,GAAG,UAAYC,eAAe,aAS3C,MAAMC,UAAmBC,IAAuBC,cAAA,SAAAC,WAAAC,YAAA,sBAkB9B,KACdC,KAAKC,MAAMC,SAASC,YAAgBH,KAAKC,MAAMG,OAAOC,UAAU,IACjEN,YAAA,sBAEgBO,KAAS,KACxBN,KAAKC,MAAMC,SAASK,YAAiBP,KAAKC,MAAMG,OAAOC,UAAU,GAChE,IAAK,CAAEG,SAAS,IAAO,CAZ1BC,4BACOT,KAAKC,MAAMS,YACdV,KAAKC,MAAMC,SAASC,YAAgBH,KAAKC,MAAMG,OAAOC,UAE1D,CAUAM,SACE,MAAM,KAAEC,EAAI,WAAEF,EAAU,QAAEG,EAAO,UAAEC,EAAS,YAAEC,GAAgBf,KAAKC,MAEnE,IAAKS,EACH,OACEM,YAACC,IAAM,UACLD,YAACE,IAAgB,KAKvB,MAAMC,EAAeH,YAACI,IAAgB,CAAC3B,GAAE,0BAA2BC,eAAe,mFAEnF,OACEsB,YAACC,IAAM,CAACI,gBAAiBN,QAAY,EACnCC,YAACM,IAAY,CACXC,gBAAc,EACdR,YAAaA,EACbS,YACER,YAAA,UAAQS,KAAK,SAASC,UAAU,wBAAwBC,MAAOf,EAAKgB,cAActC,EAASE,SAAU,aAAYoB,EAAKgB,cAActC,EAASE,SAAUqC,QAAS7B,KAAK8B,oBAAc,EAACd,YAACe,IAAI,CAACtC,GAAG,UAAUuC,KAAMC,SAIjNjB,YAACkB,IAAc,CACbC,UAAU,aACVC,WAAYpC,KAAKqC,eACjBxB,QAASA,EACTC,UAAWA,EACXK,aAAcA,EACdE,gBAAiBN,QAAY,EAE5BL,EAAW4B,KAAI7C,GACduB,YAACuB,IAAO,CAAU9C,GAAIA,GAARA,MAIlBuB,YAACwB,IAAM,UACLxB,YAAA,QAAMyB,KAAK,SAASC,QAAQ,aAIpC,EAED3C,YArEKJ,EAAU,YAEK,CACjBS,OAAQuC,IAAUC,OAAOC,WACzB3C,SAAUyC,IAAUG,KAAKD,WACzBnC,WAAYqC,IAAmBC,KAC/BnC,QAAS8B,IAAUM,KACnBnC,UAAW6B,IAAUM,KACrBlC,YAAa4B,IAAUM,KACvBrC,KAAM+B,IAAUC,OAAOC,aA8DZK,6BA7ESC,CAACC,EAAOnD,KAAK,CACnCS,WAAY0C,EAAMC,MAAM,CAAC,aAAc,gBAAiBpD,EAAMG,OAAOC,SAAU,UAC/EQ,UAAWuC,EAAMC,MAAM,CAAC,aAAc,gBAAiBpD,EAAMG,OAAOC,SAAU,SAC9ES,UAAWsC,EAAMC,MAAM,CAAC,aAAc,gBAAiBpD,EAAMG,OAAOC,SAAU,cAAc,MA0E/E6C,CAAyBI,YAAW3D,G","file":"js/features/favourites-2ff243cbc4b18b5f65ca.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 RefreshIcon from '@/material-icons/400-24px/refresh.svg?react';\nimport { fetchFavourites, expandFavourites } from 'mastodon/actions/interactions';\nimport { Account } from 'mastodon/components/account';\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 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' icon={RefreshIcon} /></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            <Account key={id} id={id} />,\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":""}