forked from AkkomaGang/akkoma
1 line
No EOL
16 KiB
Text
1 line
No EOL
16 KiB
Text
{"version":3,"sources":["webpack:///app/javascript/tank/sources/git/git.pleroma.social/pleroma/mastofe/app/javascript/flavours/glitch/features/hashtag_timeline/components/column_settings.js","webpack:///app/javascript/tank/sources/git/git.pleroma.social/pleroma/mastofe/app/javascript/flavours/glitch/features/hashtag_timeline/containers/column_settings_container.js","webpack:///app/javascript/tank/sources/git/git.pleroma.social/pleroma/mastofe/app/javascript/flavours/glitch/features/hashtag_timeline/index.js"],"names":["messages","defineMessages","placeholder","noOptions","ColumnSettings","injectIntl","open","hasTags","mode","value","props","onChange","state","setState","intl","formatMessage","map","tags","length","includes","this","settings","getIn","toJSON","modeSelect","className","modeLabel","isMulti","autoFocus","onSelect","loadOptions","onLoad","classNamePrefix","name","noOptionsMessage","id","defaultMessage","render","onToggle","checked","React","PureComponent","connect","columnId","columns","index","findIndex","c","get","dispatch","key","changeColumnParams","api","params","q","type","then","response","data","hashtags","tag","label","HashtagTimeline","hasUnread","removeColumn","addColumn","title","additionalFor","push","values","additional","join","dir","moveColumn","column","scrollTop","maxId","expandHashtagTimeline","_subscribe","any","all","none","disconnects","connectHashtagStream","status","filter","_unsubscribe","disconnect","componentDidMount","componentWillReceiveProps","nextProps","clearTimeline","componentWillUnmount","multiColumn","pinned","ref","setRef","icon","active","onPin","handlePin","onMove","handleMove","onClick","handleHeaderClick","showBackButton","bindToDocument","trackScroll","scrollKey","timelineId","onLoadMore","handleLoadMore","emptyMessage"],"mappings":"kSAOA,I,EAAMA,EAAWC,YAAe,CAC9BC,YAAY,CAAD,kFACXC,UAAU,CAAD,gGAILC,EADUC,Y,mNAUN,CACNC,KAAM,EAAKC,Y,uCAiBF,SAAAC,GAAI,OAAI,SAAAC,GAAK,OAAI,EAAKC,MAAMC,SAAS,CAAC,OAAQH,GAAOC,O,uCAErD,WACL,EAAKG,MAAMN,MAAQ,EAAKC,WAC1B,EAAKG,MAAMC,SAAS,OAAQ,I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AC,IAAD,CAAQoD,IAAK3E,KAAK4E,OAAQ/D,KAAK,UAAU4B,MAAK,IAAM1B,GAClD,YAAC,IAAD,CACE8D,KAAK,UACLC,OAAQnC,EACRG,MAAO9C,KAAK8C,QACZiC,MAAO/E,KAAKgF,UACZC,OAAQjF,KAAKkF,WACbC,QAASnF,KAAKoF,kBACdV,OAAQA,EACRD,YAAaA,EACbY,gBAAc,EACdC,gBAAiBb,QAVnB,EAYGlD,GAAY,YAAC,EAAD,CAAyBA,SAAUA,KAGlD,YAAC,IAAD,CACEgE,aAAcb,EACdc,UAAS,oBAAsBjE,EAC/BkE,WAAU,WAAa1E,EACvB2E,WAAY1F,KAAK2F,eACjBC,aAAc,YAAC,IAAD,CAAkB7E,GAAG,uBAAuBC,eAAe,0CACzEsE,gBAAiBb,M,GA5IGrD,IAAMC,iB","file":"flavours/glitch/async/hashtag_timeline.js","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport ImmutablePropTypes from 'react-immutable-proptypes';\nimport { defineMessages, injectIntl, FormattedMessage } from 'react-intl';\nimport Toggle from 'react-toggle';\nimport AsyncSelect from 'react-select/async';\n\nconst messages = defineMessages({\n placeholder: { id: 'hashtag.column_settings.select.placeholder', defaultMessage: 'Enter hashtags…' },\n noOptions: { id: 'hashtag.column_settings.select.no_options_message', defaultMessage: 'No suggestions found' },\n});\n\nexport default @injectIntl\nclass ColumnSettings extends React.PureComponent {\n\n static propTypes = {\n settings: ImmutablePropTypes.map.isRequired,\n onChange: PropTypes.func.isRequired,\n onLoad: PropTypes.func.isRequired,\n intl: PropTypes.object.isRequired,\n };\n\n state = {\n open: this.hasTags(),\n };\n\n hasTags () {\n return ['all', 'any', 'none'].map(mode => this.tags(mode).length > 0).includes(true);\n }\n\n tags (mode) {\n let tags = this.props.settings.getIn(['tags', mode]) || [];\n\n if (tags.toJSON) {\n return tags.toJSON();\n } else {\n return tags;\n }\n };\n\n onSelect = mode => value => this.props.onChange(['tags', mode], value);\n\n onToggle = () => {\n if (this.state.open && this.hasTags()) {\n this.props.onChange('tags', {});\n }\n\n this.setState({ open: !this.state.open });\n };\n\n noOptionsMessage = () => this.props.intl.formatMessage(messages.noOptions);\n\n modeSelect (mode) {\n return (\n <div className='column-settings__row'>\n <span className='column-settings__section'>\n {this.modeLabel(mode)}\n </span>\n\n <AsyncSelect\n isMulti\n autoFocus\n value={this.tags(mode)}\n onChange={this.onSelect(mode)}\n loadOptions={this.props.onLoad}\n className='column-select__container'\n classNamePrefix='column-select'\n name='tags'\n placeholder={this.props.intl.formatMessage(messages.placeholder)}\n noOptionsMessage={this.noOptionsMessage}\n />\n </div>\n );\n }\n\n modeLabel (mode) {\n switch(mode) {\n case 'any':\n return <FormattedMessage id='hashtag.column_settings.tag_mode.any' defaultMessage='Any of these' />;\n case 'all':\n return <FormattedMessage id='hashtag.column_settings.tag_mode.all' defaultMessage='All of these' />;\n case 'none':\n return <FormattedMessage id='hashtag.column_settings.tag_mode.none' defaultMessage='None of these' />;\n default:\n return '';\n }\n };\n\n render () {\n return (\n <div>\n <div className='column-settings__row'>\n <div className='setting-toggle'>\n <Toggle id='hashtag.column_settings.tag_toggle' onChange={this.onToggle} checked={this.state.open} />\n\n <span className='setting-toggle__label'>\n <FormattedMessage id='hashtag.column_settings.tag_toggle' defaultMessage='Include additional tags in this column' />\n </span>\n </div>\n </div>\n\n {this.state.open && (\n <div className='column-settings__hashtags'>\n {this.modeSelect('any')}\n {this.modeSelect('all')}\n {this.modeSelect('none')}\n </div>\n )}\n </div>\n );\n }\n\n}\n","import { connect } from 'react-redux';\nimport ColumnSettings from '../components/column_settings';\nimport { changeColumnParams } from 'flavours/glitch/actions/columns';\nimport api from 'flavours/glitch/util/api';\n\nconst mapStateToProps = (state, { columnId }) => {\n const columns = state.getIn(['settings', 'columns']);\n const index = columns.findIndex(c => c.get('uuid') === columnId);\n\n if (!(columnId && index >= 0)) {\n return {};\n }\n\n return { settings: columns.get(index).get('params') };\n};\n\nconst mapDispatchToProps = (dispatch, { columnId }) => ({\n onChange (key, value) {\n dispatch(changeColumnParams(columnId, key, value));\n },\n\n onLoad (value) {\n return api().get('/api/v2/search', { params: { q: value, type: 'hashtags' } }).then(response => {\n return (response.data.hashtags || []).map((tag) => {\n return { value: tag.name, label: `#${tag.name}` };\n });\n });\n },\n});\n\nexport default connect(mapStateToProps, mapDispatchToProps)(ColumnSettings);\n","import React from 'react';\nimport { connect } from 'react-redux';\nimport PropTypes from 'prop-types';\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 ColumnSettingsContainer from './containers/column_settings_container';\nimport { expandHashtagTimeline, clearTimeline } from 'flavours/glitch/actions/timelines';\nimport { addColumn, removeColumn, moveColumn } from 'flavours/glitch/actions/columns';\nimport { FormattedMessage } from 'react-intl';\nimport { connectHashtagStream } from 'flavours/glitch/actions/streaming';\nimport { isEqual } from 'lodash';\n\nconst mapStateToProps = (state, props) => ({\n hasUnread: state.getIn(['timelines', `hashtag:${props.params.id}`, 'unread']) > 0,\n});\n\nexport default @connect(mapStateToProps)\nclass HashtagTimeline extends React.PureComponent {\n\n disconnects = [];\n\n static propTypes = {\n params: PropTypes.object.isRequired,\n columnId: PropTypes.string,\n dispatch: PropTypes.func.isRequired,\n hasUnread: PropTypes.bool,\n multiColumn: PropTypes.bool,\n };\n\n handlePin = () => {\n const { columnId, dispatch } = this.props;\n\n if (columnId) {\n dispatch(removeColumn(columnId));\n } else {\n dispatch(addColumn('HASHTAG', { id: this.props.params.id }));\n }\n }\n\n title = () => {\n let title = [this.props.params.id];\n\n if (this.additionalFor('any')) {\n title.push(' ', <FormattedMessage key='any' id='hashtag.column_header.tag_mode.any' values={{ additional: this.additionalFor('any') }} defaultMessage='or {additional}' />);\n }\n\n if (this.additionalFor('all')) {\n title.push(' ', <FormattedMessage key='all' id='hashtag.column_header.tag_mode.all' values={{ additional: this.additionalFor('all') }} defaultMessage='and {additional}' />);\n }\n\n if (this.additionalFor('none')) {\n title.push(' ', <FormattedMessage key='none' id='hashtag.column_header.tag_mode.none' values={{ additional: this.additionalFor('none') }} defaultMessage='without {additional}' />);\n }\n\n return title;\n }\n\n additionalFor = (mode) => {\n const { tags } = this.props.params;\n\n if (tags && (tags[mode] || []).length > 0) {\n return tags[mode].map(tag => tag.value).join('/');\n } else {\n return '';\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 _subscribe (dispatch, id, tags = {}) {\n let any = (tags.any || []).map(tag => tag.value);\n let all = (tags.all || []).map(tag => tag.value);\n let none = (tags.none || []).map(tag => tag.value);\n\n [id, ...any].map(tag => {\n this.disconnects.push(dispatch(connectHashtagStream(id, tag, status => {\n let tags = status.tags.map(tag => tag.name);\n\n return all.filter(tag => tags.includes(tag)).length === all.length &&\n none.filter(tag => tags.includes(tag)).length === 0;\n })));\n });\n }\n\n _unsubscribe () {\n this.disconnects.map(disconnect => disconnect());\n this.disconnects = [];\n }\n\n componentDidMount () {\n const { dispatch } = this.props;\n const { id, tags } = this.props.params;\n\n this._subscribe(dispatch, id, tags);\n dispatch(expandHashtagTimeline(id, { tags }));\n }\n\n componentWillReceiveProps (nextProps) {\n const { dispatch, params } = this.props;\n const { id, tags } = nextProps.params;\n\n if (id !== params.id || !isEqual(tags, params.tags)) {\n this._unsubscribe();\n this._subscribe(dispatch, id, tags);\n this.props.dispatch(clearTimeline(`hashtag:${id}`));\n this.props.dispatch(expandHashtagTimeline(id, { tags }));\n }\n }\n\n componentWillUnmount () {\n this._unsubscribe();\n }\n\n setRef = c => {\n this.column = c;\n }\n\n handleLoadMore = maxId => {\n const { id, tags } = this.props.params;\n this.props.dispatch(expandHashtagTimeline(id, { maxId, tags }));\n }\n\n render () {\n const { hasUnread, columnId, multiColumn } = this.props;\n const { id } = this.props.params;\n const pinned = !!columnId;\n\n return (\n <Column ref={this.setRef} name='hashtag' label={`#${id}`}>\n <ColumnHeader\n icon='hashtag'\n active={hasUnread}\n title={this.title()}\n onPin={this.handlePin}\n onMove={this.handleMove}\n onClick={this.handleHeaderClick}\n pinned={pinned}\n multiColumn={multiColumn}\n showBackButton\n bindToDocument={!multiColumn}\n >\n {columnId && <ColumnSettingsContainer columnId={columnId} />}\n </ColumnHeader>\n\n <StatusListContainer\n trackScroll={!pinned}\n scrollKey={`hashtag_timeline-${columnId}`}\n timelineId={`hashtag:${id}`}\n onLoadMore={this.handleLoadMore}\n emptyMessage={<FormattedMessage id='empty_column.hashtag' defaultMessage='There is nothing in this hashtag yet.' />}\n bindToDocument={!multiColumn}\n />\n </Column>\n );\n }\n\n}\n"],"sourceRoot":""} |