mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-12-14 14:29:59 +00:00
1 line
23 KiB
Plaintext
1 line
23 KiB
Plaintext
{"version":3,"sources":["webpack:///app/javascript/tank/sources/git/git.pleroma.social/pleroma/mastofe/app/javascript/flavours/glitch/features/directory/components/account_card.js","webpack:///app/javascript/tank/sources/git/git.pleroma.social/pleroma/mastofe/app/javascript/flavours/glitch/components/radio_button.js","webpack:///app/javascript/tank/sources/git/git.pleroma.social/pleroma/mastofe/app/javascript/flavours/glitch/features/directory/index.js"],"names":["messages","defineMessages","follow","unfollow","requested","unblock","unmute","unfollowConfirm","AccountCard","connect","getAccount","makeGetAccount","state","id","account","dispatch","intl","onFollow","getIn","unfollowModal","openModal","message","defaultMessage","values","name","get","confirm","formatMessage","onConfirm","unfollowAccount","followAccount","onBlock","unblockAccount","blockAccount","onMute","unmuteAccount","initMuteModal","injectIntl","target","src","getAttribute","props","c","node","_updateEmojis","this","autoPlayGif","emojis","querySelectorAll","i","length","emoji","classList","contains","add","addEventListener","handleEmojiMouseEnter","handleEmojiMouseLeave","componentDidMount","componentDidUpdate","render","buttons","me","following","blocking","muting","disabled","icon","title","active","onClick","handleBlock","handleMute","handleFollow","className","alt","href","to","size","ref","setRef","dangerouslySetInnerHTML","__html","shortNumberFormat","timestamp","ImmutablePureComponent","ImmutablePropTypes","map","isRequired","PropTypes","object","func","RadioButton","value","checked","onChange","label","type","classNames","React","PureComponent","recentlyActive","newArrivals","local","federated","Directory","accountIds","ImmutableList","isLoading","domain","order","columnId","removeColumn","addColumn","getParams","params","dir","moveColumn","column","scrollTop","e","changeColumnParams","setState","expandDirectory","fetchDirectory","prevProps","prevState","paramsOld","paramsNew","multiColumn","shouldUpdateScroll","pinned","scrollableArea","style","background","role","handleChangeOrder","handleChangeLocal","loading","accountId","handleLoadMore","visible","bindToDocument","onPin","handlePin","onMove","handleMove","handleHeaderClick","scrollKey","router"],"mappings":"8YAkBA,IAAMA,EAAWC,YAAe,CAC9BC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AAC,IAAD,CACED,KAAK,iBACLC,MAAOpD,EAAKW,cAAc3B,EAASoE,OACnC2E,MAAOlG,KAAKmG,UACZC,OAAQpG,KAAKqG,WACb5E,QAASzB,KAAKsG,kBACdhB,OAAQA,EACRF,YAAaA,IAGdA,IAAgBE,EAAS,YAAC,IAAD,CAAiBiB,UAAU,YAAYlB,mBAAoBA,QAA3D,EAAgFE,GAAoCA,I,GArI9HjC,IAAMC,e,6BAEN,CACpBiD,OAAQ5D,IAAUC,S","file":"features/glitch/async/directory.js","sourcesContent":["import React from 'react';\nimport ImmutablePureComponent from 'react-immutable-pure-component';\nimport ImmutablePropTypes from 'react-immutable-proptypes';\nimport PropTypes from 'prop-types';\nimport { connect } from 'react-redux';\nimport { makeGetAccount } from 'flavours/glitch/selectors';\nimport Avatar from 'flavours/glitch/components/avatar';\nimport DisplayName from 'flavours/glitch/components/display_name';\nimport Permalink from 'flavours/glitch/components/permalink';\nimport RelativeTimestamp from 'flavours/glitch/components/relative_timestamp';\nimport IconButton from 'flavours/glitch/components/icon_button';\nimport { FormattedMessage, injectIntl, defineMessages } from 'react-intl';\nimport { autoPlayGif, me, unfollowModal } from 'flavours/glitch/util/initial_state';\nimport { shortNumberFormat } from 'flavours/glitch/util/numbers';\nimport { followAccount, unfollowAccount, blockAccount, unblockAccount, unmuteAccount } from 'flavours/glitch/actions/accounts';\nimport { openModal } from 'flavours/glitch/actions/modal';\nimport { initMuteModal } from 'flavours/glitch/actions/mutes';\n\nconst messages = defineMessages({\n follow: { id: 'account.follow', defaultMessage: 'Follow' },\n unfollow: { id: 'account.unfollow', defaultMessage: 'Unfollow' },\n requested: { id: 'account.requested', defaultMessage: 'Awaiting approval' },\n unblock: { id: 'account.unblock', defaultMessage: 'Unblock @{name}' },\n unmute: { id: 'account.unmute', defaultMessage: 'Unmute @{name}' },\n unfollowConfirm: { id: 'confirmations.unfollow.confirm', defaultMessage: 'Unfollow' },\n});\n\nconst makeMapStateToProps = () => {\n const getAccount = makeGetAccount();\n\n const mapStateToProps = (state, { id }) => ({\n account: getAccount(state, id),\n });\n\n return mapStateToProps;\n};\n\nconst mapDispatchToProps = (dispatch, { intl }) => ({\n\n onFollow (account) {\n if (account.getIn(['relationship', 'following']) || account.getIn(['relationship', 'requested'])) {\n if (unfollowModal) {\n dispatch(openModal('CONFIRM', {\n message: <FormattedMessage id='confirmations.unfollow.message' defaultMessage='Are you sure you want to unfollow {name}?' values={{ name: <strong>@{account.get('acct')}</strong> }} />,\n confirm: intl.formatMessage(messages.unfollowConfirm),\n onConfirm: () => dispatch(unfollowAccount(account.get('id'))),\n }));\n } else {\n dispatch(unfollowAccount(account.get('id')));\n }\n } else {\n dispatch(followAccount(account.get('id')));\n }\n },\n\n onBlock (account) {\n if (account.getIn(['relationship', 'blocking'])) {\n dispatch(unblockAccount(account.get('id')));\n } else {\n dispatch(blockAccount(account.get('id')));\n }\n },\n\n onMute (account) {\n if (account.getIn(['relationship', 'muting'])) {\n dispatch(unmuteAccount(account.get('id')));\n } else {\n dispatch(initMuteModal(account));\n }\n },\n\n});\n\nexport default @injectIntl\n@connect(makeMapStateToProps, mapDispatchToProps)\nclass AccountCard extends ImmutablePureComponent {\n\n static propTypes = {\n account: ImmutablePropTypes.map.isRequired,\n intl: PropTypes.object.isRequired,\n onFollow: PropTypes.func.isRequired,\n onBlock: PropTypes.func.isRequired,\n onMute: PropTypes.func.isRequired,\n };\n\n _updateEmojis () {\n const node = this.node;\n\n if (!node || autoPlayGif) {\n return;\n }\n\n const emojis = node.querySelectorAll('.custom-emoji');\n\n for (var i = 0; i < emojis.length; i++) {\n let emoji = emojis[i];\n if (emoji.classList.contains('status-emoji')) {\n continue;\n }\n emoji.classList.add('status-emoji');\n\n emoji.addEventListener('mouseenter', this.handleEmojiMouseEnter, false);\n emoji.addEventListener('mouseleave', this.handleEmojiMouseLeave, false);\n }\n }\n\n componentDidMount () {\n this._updateEmojis();\n }\n\n componentDidUpdate () {\n this._updateEmojis();\n }\n\n handleEmojiMouseEnter = ({ target }) => {\n target.src = target.getAttribute('data-original');\n }\n\n handleEmojiMouseLeave = ({ target }) => {\n target.src = target.getAttribute('data-static');\n }\n\n handleFollow = () => {\n this.props.onFollow(this.props.account);\n }\n\n handleBlock = () => {\n this.props.onBlock(this.props.account);\n }\n\n handleMute = () => {\n this.props.onMute(this.props.account);\n }\n\n setRef = (c) => {\n this.node = c;\n }\n\n render () {\n const { account, intl } = this.props;\n\n let buttons;\n\n if (account.get('id') !== me && account.get('relationship', null) !== null) {\n const following = account.getIn(['relationship', 'following']);\n const requested = account.getIn(['relationship', 'requested']);\n const blocking = account.getIn(['relationship', 'blocking']);\n const muting = account.getIn(['relationship', 'muting']);\n\n if (requested) {\n buttons = <IconButton disabled icon='hourglass' title={intl.formatMessage(messages.requested)} />;\n } else if (blocking) {\n buttons = <IconButton active icon='unlock' title={intl.formatMessage(messages.unblock, { name: account.get('username') })} onClick={this.handleBlock} />;\n } else if (muting) {\n buttons = <IconButton active icon='volume-up' title={intl.formatMessage(messages.unmute, { name: account.get('username') })} onClick={this.handleMute} />;\n } else if (!account.get('moved') || following) {\n buttons = <IconButton icon={following ? 'user-times' : 'user-plus'} title={intl.formatMessage(following ? messages.unfollow : messages.follow)} onClick={this.handleFollow} active={following} />;\n }\n }\n\n return (\n <div className='directory__card'>\n <div className='directory__card__img'>\n <img src={autoPlayGif ? account.get('header') : account.get('header_static')} alt='' />\n </div>\n\n <div className='directory__card__bar'>\n <Permalink className='directory__card__bar__name' href={account.get('url')} to={`/accounts/${account.get('id')}`}>\n <Avatar account={account} size={48} />\n <DisplayName account={account} />\n </Permalink>\n\n <div className='directory__card__bar__relationship account__relationship'>\n {buttons}\n </div>\n </div>\n\n <div className='directory__card__extra' ref={this.setRef}>\n <div className='account__header__content' dangerouslySetInnerHTML={{ __html: account.get('note_emojified') }} />\n </div>\n\n <div className='directory__card__extra'>\n <div className='accounts-table__count'>{shortNumberFormat(account.get('statuses_count'))} <small><FormattedMessage id='account.posts' defaultMessage='Toots' /></small></div>\n <div className='accounts-table__count'>{account.get('followers_count') < 0 ? '-' : shortNumberFormat(account.get('followers_count'))} <small><FormattedMessage id='account.followers' defaultMessage='Followers' /></small></div>\n <div className='accounts-table__count'>{account.get('last_status_at') === null ? <FormattedMessage id='account.never_active' defaultMessage='Never' /> : <RelativeTimestamp timestamp={account.get('last_status_at')} />} <small><FormattedMessage id='account.last_status' defaultMessage='Last active' /></small></div>\n </div>\n </div>\n );\n }\n\n}\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\n\nexport default class RadioButton extends React.PureComponent {\n\n static propTypes = {\n value: PropTypes.string.isRequired,\n checked: PropTypes.bool,\n name: PropTypes.string.isRequired,\n onChange: PropTypes.func.isRequired,\n label: PropTypes.node.isRequired,\n };\n\n render () {\n const { name, value, checked, onChange, label } = this.props;\n\n return (\n <label className='radio-button'>\n <input\n name={name}\n type='radio'\n value={value}\n checked={checked}\n onChange={onChange}\n />\n\n <span className={classNames('radio-button__input', { checked })} />\n\n <span>{label}</span>\n </label>\n );\n }\n\n}\n","import React from 'react';\nimport { connect } from 'react-redux';\nimport { defineMessages, injectIntl } from 'react-intl';\nimport PropTypes from 'prop-types';\nimport ImmutablePropTypes from 'react-immutable-proptypes';\nimport Column from 'flavours/glitch/components/column';\nimport ColumnHeader from 'flavours/glitch/components/column_header';\nimport { addColumn, removeColumn, moveColumn, changeColumnParams } from 'flavours/glitch/actions/columns';\nimport { fetchDirectory, expandDirectory } from 'flavours/glitch/actions/directory';\nimport { List as ImmutableList } from 'immutable';\nimport AccountCard from './components/account_card';\nimport RadioButton from 'flavours/glitch/components/radio_button';\nimport classNames from 'classnames';\nimport LoadMore from 'flavours/glitch/components/load_more';\nimport { ScrollContainer } from 'react-router-scroll-4';\n\nconst messages = defineMessages({\n title: { id: 'column.directory', defaultMessage: 'Browse profiles' },\n recentlyActive: { id: 'directory.recently_active', defaultMessage: 'Recently active' },\n newArrivals: { id: 'directory.new_arrivals', defaultMessage: 'New arrivals' },\n local: { id: 'directory.local', defaultMessage: 'From {domain} only' },\n federated: { id: 'directory.federated', defaultMessage: 'From known fediverse' },\n});\n\nconst mapStateToProps = state => ({\n accountIds: state.getIn(['user_lists', 'directory', 'items'], ImmutableList()),\n isLoading: state.getIn(['user_lists', 'directory', 'isLoading'], true),\n domain: state.getIn(['meta', 'domain']),\n});\n\nexport default @connect(mapStateToProps)\n@injectIntl\nclass Directory extends React.PureComponent {\n\n static contextTypes = {\n router: PropTypes.object,\n };\n\n static propTypes = {\n isLoading: PropTypes.bool,\n accountIds: ImmutablePropTypes.list.isRequired,\n dispatch: PropTypes.func.isRequired,\n shouldUpdateScroll: PropTypes.func,\n columnId: PropTypes.string,\n intl: PropTypes.object.isRequired,\n multiColumn: PropTypes.bool,\n domain: PropTypes.string.isRequired,\n params: PropTypes.shape({\n order: PropTypes.string,\n local: PropTypes.bool,\n }),\n };\n\n state = {\n order: null,\n local: null,\n };\n\n handlePin = () => {\n const { columnId, dispatch } = this.props;\n\n if (columnId) {\n dispatch(removeColumn(columnId));\n } else {\n dispatch(addColumn('DIRECTORY', this.getParams(this.props, this.state)));\n }\n }\n\n getParams = (props, state) => ({\n order: state.order === null ? (props.params.order || 'active') : state.order,\n local: state.local === null ? (props.params.local || false) : state.local,\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 dispatch(fetchDirectory(this.getParams(this.props, this.state)));\n }\n\n componentDidUpdate (prevProps, prevState) {\n const { dispatch } = this.props;\n const paramsOld = this.getParams(prevProps, prevState);\n const paramsNew = this.getParams(this.props, this.state);\n\n if (paramsOld.order !== paramsNew.order || paramsOld.local !== paramsNew.local) {\n dispatch(fetchDirectory(paramsNew));\n }\n }\n\n setRef = c => {\n this.column = c;\n }\n\n handleChangeOrder = e => {\n const { dispatch, columnId } = this.props;\n\n if (columnId) {\n dispatch(changeColumnParams(columnId, ['order'], e.target.value));\n } else {\n this.setState({ order: e.target.value });\n }\n }\n\n handleChangeLocal = e => {\n const { dispatch, columnId } = this.props;\n\n if (columnId) {\n dispatch(changeColumnParams(columnId, ['local'], e.target.value === '1'));\n } else {\n this.setState({ local: e.target.value === '1' });\n }\n }\n\n handleLoadMore = () => {\n const { dispatch } = this.props;\n dispatch(expandDirectory(this.getParams(this.props, this.state)));\n }\n\n render () {\n const { isLoading, accountIds, intl, columnId, multiColumn, domain, shouldUpdateScroll } = this.props;\n const { order, local } = this.getParams(this.props, this.state);\n const pinned = !!columnId;\n\n const scrollableArea = (\n <div className='scrollable' style={{ background: 'transparent' }}>\n <div className='filter-form'>\n <div className='filter-form__column' role='group'>\n <RadioButton name='order' value='active' label={intl.formatMessage(messages.recentlyActive)} checked={order === 'active'} onChange={this.handleChangeOrder} />\n <RadioButton name='order' value='new' label={intl.formatMessage(messages.newArrivals)} checked={order === 'new'} onChange={this.handleChangeOrder} />\n </div>\n\n <div className='filter-form__column' role='group'>\n <RadioButton name='local' value='1' label={intl.formatMessage(messages.local, { domain })} checked={local} onChange={this.handleChangeLocal} />\n <RadioButton name='local' value='0' label={intl.formatMessage(messages.federated)} checked={!local} onChange={this.handleChangeLocal} />\n </div>\n </div>\n\n <div className={classNames('directory__list', { loading: isLoading })}>\n {accountIds.map(accountId => <AccountCard id={accountId} key={accountId} />)}\n </div>\n\n <LoadMore onClick={this.handleLoadMore} visible={!isLoading} />\n </div>\n );\n\n return (\n <Column bindToDocument={!multiColumn} ref={this.setRef} label={intl.formatMessage(messages.title)}>\n <ColumnHeader\n icon='address-book-o'\n title={intl.formatMessage(messages.title)}\n onPin={this.handlePin}\n onMove={this.handleMove}\n onClick={this.handleHeaderClick}\n pinned={pinned}\n multiColumn={multiColumn}\n />\n\n {multiColumn && !pinned ? <ScrollContainer scrollKey='directory' shouldUpdateScroll={shouldUpdateScroll}>{scrollableArea}</ScrollContainer> : scrollableArea}\n </Column>\n );\n }\n\n}\n"],"sourceRoot":""} |