list_timeline.js.map 9.67 KB
Newer Older
Haelwenn's avatar
Haelwenn committed
1
{"version":3,"sources":["webpack:///app/javascript/tank/sources/git/git.pleroma.social/pleroma/mastofe/app/javascript/mastodon/features/list_timeline/index.js"],"names":["messages","defineMessages","deleteMessage","deleteConfirm","ListTimeline","connect","state","props","list","getIn","params","id","hasUnread","injectIntl","columnId","dispatch","removeColumn","addColumn","context","router","history","push","dir","moveColumn","column","scrollTop","c","maxId","expandListTimeline","openModal","listId","intl","message","formatMessage","confirm","onConfirm","deleteList","componentDidMount","this","fetchList","disconnect","connectListStream","componentWillReceiveProps","nextProps","componentWillUnmount","render","shouldUpdateScroll","multiColumn","pinned","title","get","className","bindToDocument","ref","setRef","label","icon","active","onPin","handlePin","onMove","handleMove","onClick","handleHeaderClick","tabIndex","handleEditClick","defaultMessage","handleDeleteClick","trackScroll","scrollKey","timelineId","onLoadMore","handleLoadMore","emptyMessage","React","PureComponent","PropTypes","object"],"mappings":"qUAkBMA,EAAWC,YAAe,CAC9BC,cAAc,CAAD,gHACbC,cAAc,CAAD,kEAUTC,EAFUC,kBALQ,SAACC,EAAOC,GAAR,MAAmB,CACzCC,KAAMF,EAAMG,MAAM,CAAC,QAASF,EAAMG,OAAOC,KACzCC,UAAWN,EAAMG,MAAM,CAAC,YAAD,QAAsBF,EAAMG,OAAOC,GAAM,WAAa,I,GAI9EE,a,8LAkBa,WAAO,IAAD,EACe,EAAKN,MAA5BO,EADQ,EACRA,SAAUC,EADF,EACEA,SAEdD,EACFC,EAASC,YAAaF,KAEtBC,EAASE,YAAU,OAAQ,CAAEN,GAAI,EAAKJ,MAAMG,OAAOC,MACnD,EAAKO,QAAQC,OAAOC,QAAQC,KAAK,Q,wCAIxB,SAACC,GAAS,IAAD,EACW,EAAKf,MAA5BO,EADY,EACZA,UACRC,EAFoB,EACFA,UACTQ,YAAWT,EAAUQ,M,+CAGZ,WAClB,EAAKE,OAAOC,c,oCAqCL,SAAAC,GACP,EAAKF,OAASE,I,4CAGC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2B,KAAK/B,MAAMG,OAAlBC,GACFqC,IAAWlC,EACXmC,EAASzC,EAAOA,EAAK0C,IAAI,SAAWvC,EAE1C,YAAoB,IAATH,EAEP,YAAC,IAAD,UACE,mBAAK2C,UAAU,mBAAf,EACE,YAAC,IAAD,OAIY,IAAT3C,EAEP,YAAC,IAAD,UACE,YAAC,IAAD,CAAkBuC,YAAaA,IAC/B,YAAC,IAAD,KAMJ,kBAAC,IAAD,CAAQK,gBAAiBL,EAAaM,IAAKf,KAAKgB,OAAQC,MAAON,GAC7D,YAAC,IAAD,CACEO,KAAK,UACLC,OAAQ7C,EACRqC,MAAOA,EACPS,MAAOpB,KAAKqB,UACZC,OAAQtB,KAAKuB,WACbC,QAASxB,KAAKyB,kBACdf,OAAQA,EACRD,YAAaA,QARf,EAUE,mBAAKI,UAAU,6BAAf,EACE,sBAAQA,UAAU,sCAAsCa,SAAS,IAAIF,QAASxB,KAAK2B,sBAAnF,EACE,YAAC,IAAD,CAAMtD,GAAG,WADX,IACuB,YAAC,IAAD,CAAkBA,GAAG,aAAauD,eAAe,eAGxE,sBAAQf,UAAU,sCAAsCa,SAAS,IAAIF,QAASxB,KAAK6B,wBAAnF,EACE,YAAC,IAAD,CAAMxD,GAAG,UADX,IACsB,YAAC,IAAD,CAAkBA,GAAG,eAAeuD,eAAe,mBAK7E,YAAC,IAAD,CACEE,aAAcpB,EACdqB,UAAS,iBAAmBvD,EAC5BwD,WAAU,QAAU3D,EACpB4D,WAAYjC,KAAKkC,eACjBC,aAAc,YAAC,IAAD,CAAkB9D,GAAG,oBAAoBuD,eAAe,2GACtEpB,mBAAoBA,EACpBM,gBAAiBL,M,GA5JA2B,IAAMC,e,6BAET,CACpBxD,OAAQyD,IAAUC,S","file":"features/list_timeline.js","sourcesContent":["import React from 'react';\nimport { connect } from 'react-redux';\nimport PropTypes from 'prop-types';\nimport ImmutablePropTypes from 'react-immutable-proptypes';\nimport StatusListContainer from '../ui/containers/status_list_container';\nimport Column from '../../components/column';\nimport ColumnBackButton from '../../components/column_back_button';\nimport ColumnHeader from '../../components/column_header';\nimport { addColumn, removeColumn, moveColumn } from '../../actions/columns';\nimport { FormattedMessage, defineMessages, injectIntl } from 'react-intl';\nimport { connectListStream } from '../../actions/streaming';\nimport { expandListTimeline } from '../../actions/timelines';\nimport { fetchList, deleteList } from '../../actions/lists';\nimport { openModal } from '../../actions/modal';\nimport MissingIndicator from '../../components/missing_indicator';\nimport LoadingIndicator from '../../components/loading_indicator';\nimport Icon from 'mastodon/components/icon';\n\nconst messages = defineMessages({\n  deleteMessage: { id: 'confirmations.delete_list.message', defaultMessage: 'Are you sure you want to permanently delete this list?' },\n  deleteConfirm: { id: 'confirmations.delete_list.confirm', defaultMessage: 'Delete' },\n});\n\nconst mapStateToProps = (state, props) => ({\n  list: state.getIn(['lists', props.params.id]),\n  hasUnread: state.getIn(['timelines', `list:${props.params.id}`, 'unread']) > 0,\n});\n\nexport default @connect(mapStateToProps)\n@injectIntl\nclass ListTimeline extends React.PureComponent {\n\n  static contextTypes = {\n    router: PropTypes.object,\n  };\n\n  static propTypes = {\n    params: PropTypes.object.isRequired,\n    dispatch: PropTypes.func.isRequired,\n    shouldUpdateScroll: PropTypes.func,\n    columnId: PropTypes.string,\n    hasUnread: PropTypes.bool,\n    multiColumn: PropTypes.bool,\n    list: PropTypes.oneOfType([ImmutablePropTypes.map, PropTypes.bool]),\n    intl: PropTypes.object.isRequired,\n  };\n\n  handlePin = () => {\n    const { columnId, dispatch } = this.props;\n\n    if (columnId) {\n      dispatch(removeColumn(columnId));\n    } else {\n      dispatch(addColumn('LIST', { id: this.props.params.id }));\n      this.context.router.history.push('/');\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  componentDidMount () {\n    const { dispatch } = this.props;\n    const { id } = this.props.params;\n\n    dispatch(fetchList(id));\n    dispatch(expandListTimeline(id));\n\n    this.disconnect = dispatch(connectListStream(id));\n  }\n\n  componentWillReceiveProps (nextProps) {\n    const { dispatch } = this.props;\n    const { id } = nextProps.params;\n\n    if (id !== this.props.params.id) {\n      if (this.disconnect) {\n        this.disconnect();\n        this.disconnect = null;\n      }\n\n      dispatch(fetchList(id));\n      dispatch(expandListTimeline(id));\n\n      this.disconnect = dispatch(connectListStream(id));\n    }\n  }\n\n  componentWillUnmount () {\n    if (this.disconnect) {\n      this.disconnect();\n      this.disconnect = null;\n    }\n  }\n\n  setRef = c => {\n    this.column = c;\n  }\n\n  handleLoadMore = maxId => {\n    const { id } = this.props.params;\n    this.props.dispatch(expandListTimeline(id, { maxId }));\n  }\n\n  handleEditClick = () => {\n    this.props.dispatch(openModal('LIST_EDITOR', { listId: this.props.params.id }));\n  }\n\n  handleDeleteClick = () => {\n    const { dispatch, columnId, intl } = this.props;\n    const { id } = this.props.params;\n\n    dispatch(openModal('CONFIRM', {\n      message: intl.formatMessage(messages.deleteMessage),\n      confirm: intl.formatMessage(messages.deleteConfirm),\n      onConfirm: () => {\n        dispatch(deleteList(id));\n\n        if (!!columnId) {\n          dispatch(removeColumn(columnId));\n        } else {\n          this.context.router.history.push('/lists');\n        }\n      },\n    }));\n  }\n\n  render () {\n    const { shouldUpdateScroll, hasUnread, columnId, multiColumn, list } = this.props;\n    const { id } = this.props.params;\n    const pinned = !!columnId;\n    const title  = list ? list.get('title') : id;\n\n    if (typeof list === 'undefined') {\n      return (\n        <Column>\n          <div className='scrollable'>\n            <LoadingIndicator />\n          </div>\n        </Column>\n      );\n    } else if (list === false) {\n      return (\n        <Column>\n          <ColumnBackButton multiColumn={multiColumn} />\n          <MissingIndicator />\n        </Column>\n      );\n    }\n\n    return (\n      <Column bindToDocument={!multiColumn} ref={this.setRef} label={title}>\n        <ColumnHeader\n          icon='list-ul'\n          active={hasUnread}\n          title={title}\n          onPin={this.handlePin}\n          onMove={this.handleMove}\n          onClick={this.handleHeaderClick}\n          pinned={pinned}\n          multiColumn={multiColumn}\n        >\n          <div className='column-header__links'>\n            <button className='text-btn column-header__setting-btn' tabIndex='0' onClick={this.handleEditClick}>\n              <Icon id='pencil' /> <FormattedMessage id='lists.edit' defaultMessage='Edit list' />\n            </button>\n\n            <button className='text-btn column-header__setting-btn' tabIndex='0' onClick={this.handleDeleteClick}>\n              <Icon id='trash' /> <FormattedMessage id='lists.delete' defaultMessage='Delete list' />\n            </button>\n          </div>\n        </ColumnHeader>\n\n        <StatusListContainer\n          trackScroll={!pinned}\n          scrollKey={`list_timeline-${columnId}`}\n          timelineId={`list:${id}`}\n          onLoadMore={this.handleLoadMore}\n          emptyMessage={<FormattedMessage id='empty_column.list' defaultMessage='There is nothing in this list yet. When members of this list post new statuses, they will appear here.' />}\n          shouldUpdateScroll={shouldUpdateScroll}\n          bindToDocument={!multiColumn}\n        />\n      </Column>\n    );\n  }\n\n}\n"],"sourceRoot":""}