list_timeline.js.map 11.8 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/flavours/glitch/features/list_timeline/index.js"],"names":["messages","defineMessages","deleteMessage","deleteConfirm","all_replies","no_replies","list_replies","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","target","updateList","undefined","value","componentDidMount","this","fetchList","disconnect","connectListStream","componentWillReceiveProps","nextProps","componentWillUnmount","render","multiColumn","pinned","title","get","replies_policy","className","ref","setRef","label","icon","active","onPin","handlePin","onMove","handleMove","onClick","handleHeaderClick","tabIndex","handleEditClick","defaultMessage","handleDeleteClick","map","policy","join","type","checked","onChange","handleRepliesPolicyChange","htmlFor","trackScroll","scrollKey","timelineId","onLoadMore","handleLoadMore","emptyMessage","React","PureComponent","PropTypes","object"],"mappings":"4TAiBMA,EAAWC,YAAe,CAC9BC,cAAc,CAAD,gHACbC,cAAc,CAAD,gEACbC,YAAY,CAAD,0EACXC,WAAW,CAAD,8DACVC,aAAa,CAAD,+EAURC,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,8LAiBa,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,EACZ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AAG,6BAA6B0D,eAAe,sBACvE,CAAC,aAAc,eAAgB,eAAeE,IAAI,SAAAC,GAAM,OACxD,mBAAKjB,UAAU,sBAAf,EACE,qBAAOA,UAAU,uBAAuB5C,GAAI,CAAC,UAAW,QAASA,EAAI6D,GAAQC,KAAK,KAAMC,KAAK,QAAQlC,MAAOgC,EAAQG,QAASrB,IAAmBkB,EAAQI,SAAU,EAAKC,4BACvK,qBAAOtB,UAAU,uBAAuBuB,QAAS,CAAC,UAAW,QAASnE,EAAI6D,GAAQC,KAAK,WAAvF,EACE,kBAAC,IAAqB5E,EAAS2E,WAS7C,sBAGF,YAAC,IAAD,CACEO,aAAc5B,EACd6B,UAAS,iBAAmBlE,EAC5BmE,WAAU,QAAUtE,EACpBuE,WAAYxC,KAAKyC,eACjBC,aAAc,YAAC,IAAD,CAAkBzE,GAAG,oBAAoB0D,eAAe,2C,GArLrDgB,IAAMC,e,6BAET,CACpBnE,OAAQoE,IAAUC,S","file":"flavours/glitch/async/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 'flavours/glitch/features/ui/containers/status_list_container';\nimport Column from 'flavours/glitch/components/column';\nimport ColumnHeader from 'flavours/glitch/components/column_header';\nimport { addColumn, removeColumn, moveColumn } from 'flavours/glitch/actions/columns';\nimport { FormattedMessage, defineMessages, injectIntl } from 'react-intl';\nimport { connectListStream } from 'flavours/glitch/actions/streaming';\nimport { expandListTimeline } from 'flavours/glitch/actions/timelines';\nimport { fetchList, deleteList, updateList } from 'flavours/glitch/actions/lists';\nimport { openModal } from 'flavours/glitch/actions/modal';\nimport MissingIndicator from 'flavours/glitch/components/missing_indicator';\nimport LoadingIndicator from 'flavours/glitch/components/loading_indicator';\nimport Icon from 'flavours/glitch/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  all_replies:   { id: 'lists.replies_policy.all_replies', defaultMessage: 'any followed user' },\n  no_replies:    { id: 'lists.replies_policy.no_replies', defaultMessage: 'no one' },\n  list_replies:  { id: 'lists.replies_policy.list_replies', defaultMessage: 'members of the list' },\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    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  handleRepliesPolicyChange = ({ target }) => {\n    const { dispatch, list } = this.props;\n    const { id } = this.props.params;\n    this.props.dispatch(updateList(id, undefined, false, target.value));\n  }\n\n  render () {\n    const { hasUnread, columnId, multiColumn, list, intl } = this.props;\n    const { id } = this.props.params;\n    const pinned = !!columnId;\n    const title  = list ? list.get('title') : id;\n    const replies_policy = list ? list.get('replies_policy') : undefined;\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          <div className='scrollable'>\n            <MissingIndicator />\n          </div>\n        </Column>\n      );\n    }\n\n    return (\n      <Column 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\n          { replies_policy !== undefined && (\n            <div>\n              <div className='column-settings__row'>\n                <fieldset>\n                  <legend><FormattedMessage id='lists.replies_policy.title' defaultMessage='Show replies to:' /></legend>\n                  { ['no_replies', 'list_replies', 'all_replies'].map(policy => (\n                    <div className='setting-radio'>\n                      <input className='setting-radio__input' id={['setting', 'radio', id, policy].join('-')} type='radio' value={policy} checked={replies_policy === policy} onChange={this.handleRepliesPolicyChange} />\n                      <label className='setting-radio__label' htmlFor={['setting', 'radio', id, policy].join('-')}>\n                        <FormattedMessage {...messages[policy]} />\n                      </label>\n                    </div>\n                  ))}\n                </fieldset>\n              </div>\n            </div>\n          )}\n\n          <hr />\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.' />}\n        />\n      </Column>\n    );\n  }\n\n}\n"],"sourceRoot":""}