mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-30 09:02:28 +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/mastodon/features/directory/components/account_card.js","webpack:///app/javascript/tank/sources/git/git.pleroma.social/pleroma/mastofe/app/javascript/mastodon/components/radio_button.js","webpack:///app/javascript/tank/sources/git/git.pleroma.social/pleroma/mastofe/app/javascript/mastodon/features/directory/index.js"],"names":["messages","defineMessages","follow","unfollow","requested","unblock","unmute","AccountCard","connect","getAccount","makeGetAccount","state","id","account","dispatch","intl","onFollow","getIn","unfollowModal","openModal","message","defaultMessage","values","name","get","confirm","formatMessage","unfollowConfirm","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":"kWAkBMA,EAAWC,YAAe,CAC9BC,OAAO,CAAD,6CAC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AOlG,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/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 'mastodon/selectors';\nimport Avatar from 'mastodon/components/avatar';\nimport DisplayName from 'mastodon/components/display_name';\nimport Permalink from 'mastodon/components/permalink';\nimport RelativeTimestamp from 'mastodon/components/relative_timestamp';\nimport IconButton from 'mastodon/components/icon_button';\nimport { FormattedMessage, injectIntl, defineMessages } from 'react-intl';\nimport { autoPlayGif, me, unfollowModal } from 'mastodon/initial_state';\nimport { shortNumberFormat } from 'mastodon/utils/numbers';\nimport { followAccount, unfollowAccount, blockAccount, unblockAccount, unmuteAccount } from 'mastodon/actions/accounts';\nimport { openModal } from 'mastodon/actions/modal';\nimport { initMuteModal } from 'mastodon/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});\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'>{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 'mastodon/components/column';\nimport ColumnHeader from 'mastodon/components/column_header';\nimport { addColumn, removeColumn, moveColumn, changeColumnParams } from 'mastodon/actions/columns';\nimport { fetchDirectory, expandDirectory } from 'mastodon/actions/directory';\nimport { List as ImmutableList } from 'immutable';\nimport AccountCard from './components/account_card';\nimport RadioButton from 'mastodon/components/radio_button';\nimport classNames from 'classnames';\nimport LoadMore from 'mastodon/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":""} |