list_editor.js.map 15.1 KB
Newer Older
1
{"version":3,"sources":["webpack:///app/javascript/tank/sources/git/git.pleroma.social/pleroma/mastofe/app/javascript/mastodon/features/list_editor/components/account.js","webpack:///app/javascript/tank/sources/git/git.pleroma.social/pleroma/mastofe/app/javascript/mastodon/features/list_editor/components/search.js","webpack:///app/javascript/tank/sources/git/git.pleroma.social/pleroma/mastofe/app/javascript/mastodon/features/list_editor/components/edit_list_form.js","webpack:///app/javascript/tank/sources/git/git.pleroma.social/pleroma/mastofe/app/javascript/mastodon/features/list_editor/index.js"],"names":["messages","defineMessages","remove","add","Account","connect","getAccount","makeGetAccount","state","accountId","added","account","getIn","includes","dispatch","onRemove","removeFromListEditor","onAdd","addToListEditor","injectIntl","render","button","this","props","intl","icon","title","formatMessage","onClick","className","size","ImmutablePureComponent","ImmutablePropTypes","map","isRequired","PropTypes","object","func","bool","search","Search","value","onSubmit","fetchListSuggestions","onClear","clearListSuggestions","onChange","changeListSuggestions","e","target","keyCode","hasValue","length","style","display","type","handleChange","onKeyUp","handleKeyUp","placeholder","role","tabIndex","handleClear","id","classNames","active","aria-label","React","PureComponent","ListForm","disabled","changeListEditorTitle","submitListEditor","preventDefault","handleSubmit","handleClick","ListEditor","accountIds","searchAccountIds","onInitialize","listId","setupListEditor","onReset","resetListEditor","componentDidMount","componentWillUnmount","showSearch","defaultStyle","x","spring","stiffness","damping","transform","visibility","string","onClose","list"],"mappings":"wSAYA,I,EAAMA,EAAWC,YAAe,CAC9BC,OAAO,CAAD,6DACNC,IAAI,CAAD,uDAqBCC,EAFUC,mBAhBY,WAC1B,IAAMC,EAAaC,cAOnB,OALwB,SAACC,EAAD,OAAUC,EAAV,EAAUA,UAAWC,EAArB,EAAqBA,MAArB,MAAkC,CACxDC,QAASL,EAAWE,EAAOC,GAC3BC,WAAwB,IAAVA,EAAwBF,EAAMI,MAAM,CAAC,aAAc,WAAY,UAAUC,SAASJ,GAAaC,OAMtF,SAACI,EAAD,OAAaL,EAAb,EAAaA,U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D,CAAQ2C,aAAc,CAAEC,GAAI,KAAOnC,MAAO,CAAEmC,EAAGC,IAAOH,EAAa,GAAK,IAAK,CAAEI,UAAW,IAAKC,QAAS,YAAxG,GACG,gBAAGH,EAAH,EAAGA,EAAH,OACC,mBAAK3D,UAAU,yBAAyBwB,MAAO,CAAEuC,UAAiB,IAANJ,EAAU,KAAV,cAA+BA,EAA/B,KAAsCK,YAAmB,MAAPL,EAAa,SAAW,iBAAtI,EACGV,EAAiB7C,KAAI,SAAAxB,GAAS,OAAI,YAAC,EAAD,CAAyBA,UAAWA,GAAtBA,c,GA3CxCsB,K,0BAEJ,CACjBiD,OAAQ7C,IAAU2D,OAAO5D,WACzB6D,QAAS5D,IAAUE,KAAKH,WACxBV,KAAMW,IAAUC,OAAOF,WACvB6C,aAAc5C,IAAUE,KAAKH,WAC7BU,QAAST,IAAUE,KAAKH,WACxBgD,QAAS/C,IAAUE,KAAKH,WACxB2C,WAAY7C,IAAmBgE,KAAK9D,WACpC4C,iBAAkB9C,IAAmBgE,KAAK9D,a","file":"features/list_editor.js","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { connect } from 'react-redux';\nimport { makeGetAccount } from '../../../selectors';\nimport ImmutablePureComponent from 'react-immutable-pure-component';\nimport ImmutablePropTypes from 'react-immutable-proptypes';\nimport Avatar from '../../../components/avatar';\nimport DisplayName from '../../../components/display_name';\nimport IconButton from '../../../components/icon_button';\nimport { defineMessages, injectIntl } from 'react-intl';\nimport { removeFromListEditor, addToListEditor } from '../../../actions/lists';\n\nconst messages = defineMessages({\n  remove: { id: 'lists.account.remove', defaultMessage: 'Remove from list' },\n  add: { id: 'lists.account.add', defaultMessage: 'Add to list' },\n});\n\nconst makeMapStateToProps = () => {\n  const getAccount = makeGetAccount();\n\n  const mapStateToProps = (state, { accountId, added }) => ({\n    account: getAccount(state, accountId),\n    added: typeof added === 'undefined' ? state.getIn(['listEditor', 'accounts', 'items']).includes(accountId) : added,\n  });\n\n  return mapStateToProps;\n};\n\nconst mapDispatchToProps = (dispatch, { accountId }) => ({\n  onRemove: () => dispatch(removeFromListEditor(accountId)),\n  onAdd: () => dispatch(addToListEditor(accountId)),\n});\n\nexport default @connect(makeMapStateToProps, mapDispatchToProps)\n@injectIntl\nclass Account extends ImmutablePureComponent {\n\n  static propTypes = {\n    account: ImmutablePropTypes.map.isRequired,\n    intl: PropTypes.object.isRequired,\n    onRemove: PropTypes.func.isRequired,\n    onAdd: PropTypes.func.isRequired,\n    added: PropTypes.bool,\n  };\n\n  static defaultProps = {\n    added: false,\n  };\n\n  render () {\n    const { account, intl, onRemove, onAdd, added } = this.props;\n\n    let button;\n\n    if (added) {\n      button = <IconButton icon='times' title={intl.formatMessage(messages.remove)} onClick={onRemove} />;\n    } else {\n      button = <IconButton icon='plus' title={intl.formatMessage(messages.add)} onClick={onAdd} />;\n    }\n\n    return (\n      <div className='account'>\n        <div className='account__wrapper'>\n          <div className='account__display-name'>\n            <div className='account__avatar-wrapper'><Avatar account={account} size={36} /></div>\n            <DisplayName account={account} />\n          </div>\n\n          <div className='account__relationship'>\n            {button}\n          </div>\n        </div>\n      </div>\n    );\n  }\n\n}\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport { connect } from 'react-redux';\nimport { defineMessages, injectIntl } from 'react-intl';\nimport { fetchListSuggestions, clearListSuggestions, changeListSuggestions } from '../../../actions/lists';\nimport classNames from 'classnames';\nimport Icon from 'mastodon/components/icon';\n\nconst messages = defineMessages({\n  search: { id: 'lists.search', defaultMessage: 'Search among people you follow' },\n});\n\nconst mapStateToProps = state => ({\n  value: state.getIn(['listEditor', 'suggestions', 'value']),\n});\n\nconst mapDispatchToProps = dispatch => ({\n  onSubmit: value => dispatch(fetchListSuggestions(value)),\n  onClear: () => dispatch(clearListSuggestions()),\n  onChange: value => dispatch(changeListSuggestions(value)),\n});\n\nexport default @connect(mapStateToProps, mapDispatchToProps)\n@injectIntl\nclass Search extends React.PureComponent {\n\n  static propTypes = {\n    intl: PropTypes.object.isRequired,\n    value: PropTypes.string.isRequired,\n    onChange: PropTypes.func.isRequired,\n    onSubmit: PropTypes.func.isRequired,\n    onClear: PropTypes.func.isRequired,\n  };\n\n  handleChange = e => {\n    this.props.onChange(e.target.value);\n  }\n\n  handleKeyUp = e => {\n    if (e.keyCode === 13) {\n      this.props.onSubmit(this.props.value);\n    }\n  }\n\n  handleClear = () => {\n    this.props.onClear();\n  }\n\n  render () {\n    const { value, intl } = this.props;\n    const hasValue = value.length > 0;\n\n    return (\n      <div className='list-editor__search search'>\n        <label>\n          <span style={{ display: 'none' }}>{intl.formatMessage(messages.search)}</span>\n\n          <input\n            className='search__input'\n            type='text'\n            value={value}\n            onChange={this.handleChange}\n            onKeyUp={this.handleKeyUp}\n            placeholder={intl.formatMessage(messages.search)}\n          />\n        </label>\n\n        <div role='button' tabIndex='0' className='search__icon' onClick={this.handleClear}>\n          <Icon id='search' className={classNames({ active: !hasValue })} />\n          <Icon id='times-circle' aria-label={intl.formatMessage(messages.search)} className={classNames({ active: hasValue })} />\n        </div>\n      </div>\n    );\n  }\n\n}\n","import React from 'react';\nimport { connect } from 'react-redux';\nimport PropTypes from 'prop-types';\nimport { changeListEditorTitle, submitListEditor } from '../../../actions/lists';\nimport IconButton from '../../../components/icon_button';\nimport { defineMessages, injectIntl } from 'react-intl';\n\nconst messages = defineMessages({\n  title: { id: 'lists.edit.submit', defaultMessage: 'Change title' },\n});\n\nconst mapStateToProps = state => ({\n  value: state.getIn(['listEditor', 'title']),\n  disabled: !state.getIn(['listEditor', 'isChanged']) || !state.getIn(['listEditor', 'title']),\n});\n\nconst mapDispatchToProps = dispatch => ({\n  onChange: value => dispatch(changeListEditorTitle(value)),\n  onSubmit: () => dispatch(submitListEditor(false)),\n});\n\nexport default @connect(mapStateToProps, mapDispatchToProps)\n@injectIntl\nclass ListForm extends React.PureComponent {\n\n  static propTypes = {\n    value: PropTypes.string.isRequired,\n    disabled: PropTypes.bool,\n    intl: PropTypes.object.isRequired,\n    onChange: PropTypes.func.isRequired,\n    onSubmit: PropTypes.func.isRequired,\n  };\n\n  handleChange = e => {\n    this.props.onChange(e.target.value);\n  }\n\n  handleSubmit = e => {\n    e.preventDefault();\n    this.props.onSubmit();\n  }\n\n  handleClick = () => {\n    this.props.onSubmit();\n  }\n\n  render () {\n    const { value, disabled, intl } = this.props;\n\n    const title = intl.formatMessage(messages.title);\n\n    return (\n      <form className='column-inline-form' onSubmit={this.handleSubmit}>\n        <input\n          className='setting-text'\n          value={value}\n          onChange={this.handleChange}\n        />\n\n        <IconButton\n          disabled={disabled}\n          icon='check'\n          title={title}\n          onClick={this.handleClick}\n        />\n      </form>\n    );\n  }\n\n}\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport ImmutablePropTypes from 'react-immutable-proptypes';\nimport { connect } from 'react-redux';\nimport ImmutablePureComponent from 'react-immutable-pure-component';\nimport { injectIntl } from 'react-intl';\nimport { setupListEditor, clearListSuggestions, resetListEditor } from '../../actions/lists';\nimport Account from './components/account';\nimport Search from './components/search';\nimport EditListForm from './components/edit_list_form';\nimport Motion from '../ui/util/optional_motion';\nimport spring from 'react-motion/lib/spring';\n\nconst mapStateToProps = state => ({\n  accountIds: state.getIn(['listEditor', 'accounts', 'items']),\n  searchAccountIds: state.getIn(['listEditor', 'suggestions', 'items']),\n});\n\nconst mapDispatchToProps = dispatch => ({\n  onInitialize: listId => dispatch(setupListEditor(listId)),\n  onClear: () => dispatch(clearListSuggestions()),\n  onReset: () => dispatch(resetListEditor()),\n});\n\nexport default @connect(mapStateToProps, mapDispatchToProps)\n@injectIntl\nclass ListEditor extends ImmutablePureComponent {\n\n  static propTypes = {\n    listId: PropTypes.string.isRequired,\n    onClose: PropTypes.func.isRequired,\n    intl: PropTypes.object.isRequired,\n    onInitialize: PropTypes.func.isRequired,\n    onClear: PropTypes.func.isRequired,\n    onReset: PropTypes.func.isRequired,\n    accountIds: ImmutablePropTypes.list.isRequired,\n    searchAccountIds: ImmutablePropTypes.list.isRequired,\n  };\n\n  componentDidMount () {\n    const { onInitialize, listId } = this.props;\n    onInitialize(listId);\n  }\n\n  componentWillUnmount () {\n    const { onReset } = this.props;\n    onReset();\n  }\n\n  render () {\n    const { accountIds, searchAccountIds, onClear } = this.props;\n    const showSearch = searchAccountIds.size > 0;\n\n    return (\n      <div className='modal-root__modal list-editor'>\n        <EditListForm />\n\n        <Search />\n\n        <div className='drawer__pager'>\n          <div className='drawer__inner list-editor__accounts'>\n            {accountIds.map(accountId => <Account key={accountId} accountId={accountId} added />)}\n          </div>\n\n          {showSearch && <div role='button' tabIndex='-1' className='drawer__backdrop' onClick={onClear} />}\n\n          <Motion defaultStyle={{ x: -100 }} style={{ x: spring(showSearch ? 0 : -100, { stiffness: 210, damping: 20 }) }}>\n            {({ x }) => (\n              <div className='drawer__inner backdrop' style={{ transform: x === 0 ? null : `translateX(${x}%)`, visibility: x === -100 ? 'hidden' : 'visible' }}>\n                {searchAccountIds.map(accountId => <Account key={accountId} accountId={accountId} />)}\n              </div>\n            )}\n          </Motion>\n        </div>\n      </div>\n    );\n  }\n\n}\n"],"sourceRoot":""}