{"version":3,"sources":["webpack:///app/javascript/builds/pleroma/mastofe/app/javascript/mastodon/features/favourited_statuses/index.js"],"names":["messages","defineMessages","heading","id","defaultMessage","Favourites","connect","state","statusIds","getIn","isLoading","hasMore","injectIntl","_this$props","_this","props","columnId","dispatch","removeColumn","addColumn","dir","_this$props2","moveColumn","column","scrollTop","c","lodash_debounce__WEBPACK_IMPORTED_MODULE_4___default","expandFavouritedStatuses","leading","componentWillMount","this","fetchFavouritedStatuses","render","_this$props3","intl","shouldUpdateScroll","multiColumn","pinned","emptyMessage","Object","_babel_runtime_helpers_esm_jsx__WEBPACK_IMPORTED_MODULE_0__","react_intl__WEBPACK_IMPORTED_MODULE_14__","react__WEBPACK_IMPORTED_MODULE_5___default","a","createElement","_ui_components_column__WEBPACK_IMPORTED_MODULE_10__","ref","setRef","label","formatMessage","_components_column_header__WEBPACK_IMPORTED_MODULE_11__","icon","title","onPin","handlePin","onMove","handleMove","onClick","handleHeaderClick","showBackButton","_components_status_list__WEBPACK_IMPORTED_MODULE_13__","trackScroll","scrollKey","onLoadMore","handleLoadMore","ImmutablePureComponent","PropTypes","func","isRequired","ImmutablePropTypes","list","object","string","bool"],"mappings":"oTAaMA,EAAWC,YAAe,CAC9BC,QAAO,CAAAC,GAAA,oBAAAC,eAAA,gBAWHC,EAFUC,kBANQ,SAAAC,GAAK,MAAK,CAChCC,UAAWD,EAAME,MAAM,CAAC,eAAgB,aAAc,UACtDC,UAAWH,EAAME,MAAM,CAAC,eAAgB,aAAc,cAAc,GACpEE,UAAWJ,EAAME,MAAM,CAAC,eAAgB,aAAc,cAIvDG,2MAkBa,WAAM,IAAAC,EACeC,EAAKC,MAA5BC,EADQH,EACRG,SAAUC,EADFJ,EACEI,SAGhBA,EADED,EACOE,YAAaF,GAEbG,YAAU,aAAc,+CAIxB,SAACC,GAAQ,IAAAC,EACWP,EAAKC,MAA5BC,EADYK,EACZL,UACRC,EAFoBI,EACFJ,UACTK,YAAWN,EAAUI,qDAGZ,WAClBN,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","sourcesContent":["import React from 'react';\nimport { connect } from 'react-redux';\nimport PropTypes from 'prop-types';\nimport ImmutablePropTypes from 'react-immutable-proptypes';\nimport { fetchFavouritedStatuses, expandFavouritedStatuses } from '../../actions/favourites';\nimport Column from '../ui/components/column';\nimport ColumnHeader from '../../components/column_header';\nimport { addColumn, removeColumn, moveColumn } from '../../actions/columns';\nimport StatusList from '../../components/status_list';\nimport { defineMessages, injectIntl, FormattedMessage } from 'react-intl';\nimport ImmutablePureComponent from 'react-immutable-pure-component';\nimport { debounce } from 'lodash';\n\nconst messages = defineMessages({\n  heading: { id: 'column.favourites', defaultMessage: 'Favourites' },\n});\n\nconst mapStateToProps = state => ({\n  statusIds: state.getIn(['status_lists', 'favourites', 'items']),\n  isLoading: state.getIn(['status_lists', 'favourites', 'isLoading'], true),\n  hasMore: !!state.getIn(['status_lists', 'favourites', 'next']),\n});\n\nexport default @connect(mapStateToProps)\n@injectIntl\nclass Favourites extends ImmutablePureComponent {\n\n  static propTypes = {\n    dispatch: PropTypes.func.isRequired,\n    shouldUpdateScroll: PropTypes.func,\n    statusIds: ImmutablePropTypes.list.isRequired,\n    intl: PropTypes.object.isRequired,\n    columnId: PropTypes.string,\n    multiColumn: PropTypes.bool,\n    hasMore: PropTypes.bool,\n    isLoading: PropTypes.bool,\n  };\n\n  componentWillMount () {\n    this.props.dispatch(fetchFavouritedStatuses());\n  }\n\n  handlePin = () => {\n    const { columnId, dispatch } = this.props;\n\n    if (columnId) {\n      dispatch(removeColumn(columnId));\n    } else {\n      dispatch(addColumn('FAVOURITES', {}));\n    }\n  }\n\n  handleMove = (dir) => {\n    const { columnId, dispatch } = this.props;\n    dispatch(moveColumn(columnId, dir));\n  }\n\n  handleHeaderClick = () => {\n    this.column.scrollTop();\n  }\n\n  setRef = c => {\n    this.column = c;\n  }\n\n  handleLoadMore = debounce(() => {\n    this.props.dispatch(expandFavouritedStatuses());\n  }, 300, { leading: true })\n\n  render () {\n    const { intl, shouldUpdateScroll, statusIds, columnId, multiColumn, hasMore, isLoading } = this.props;\n    const pinned = !!columnId;\n\n    const emptyMessage = <FormattedMessage id='empty_column.favourited_statuses' defaultMessage=\"You don't have any favourite toots yet. When you favourite one, it will show up here.\" />;\n\n    return (\n      <Column ref={this.setRef} label={intl.formatMessage(messages.heading)}>\n        <ColumnHeader\n          icon='star'\n          title={intl.formatMessage(messages.heading)}\n          onPin={this.handlePin}\n          onMove={this.handleMove}\n          onClick={this.handleHeaderClick}\n          pinned={pinned}\n          multiColumn={multiColumn}\n          showBackButton\n        />\n\n        <StatusList\n          trackScroll={!pinned}\n          statusIds={statusIds}\n          scrollKey={`favourited_statuses-${columnId}`}\n          hasMore={hasMore}\n          isLoading={isLoading}\n          onLoadMore={this.handleLoadMore}\n          shouldUpdateScroll={shouldUpdateScroll}\n          emptyMessage={emptyMessage}\n        />\n      </Column>\n    );\n  }\n\n}\n"],"sourceRoot":""}