honkoma/priv/static/packs/flavours/glitch/async/account_gallery.js.map

1 line
13 KiB
Plaintext

{"version":3,"sources":["webpack:///app/javascript/builds/pleroma/mastofe/app/javascript/flavours/glitch/features/account_gallery/components/media_item.js","webpack:///app/javascript/builds/pleroma/mastofe/app/javascript/flavours/glitch/features/account_gallery/index.js"],"names":["MediaItem","visible","displayMedia","_this","props","media","getIn","state","setState","render","label","icon","title","this","status","get","x","y","style","Object","jsx","className","backgroundImage","backgroundPosition","permalink","to","href","onInterceptClick","handleClick","ImmutablePureComponent","ImmutablePropTypes","map","isRequired","LoadMoreMedia","onLoadMore","maxId","load_more","disabled","onClick","handleLoadMore","PropTypes","string","func","AccountGallery","connect","isAccount","params","accountId","medias","getAccountGallery","isLoading","hasMore","_this2","column","scrollTop","size","last","undefined","e","_e$target","target","scrollHeight","clientHeight","handleScrollToBottom","dispatch","expandAccountMediaTimeline","preventDefault","prevRouterProps","_ref","location","mastodonModalOpen","c","componentDidMount","fetchAccount","componentWillReceiveProps","nextProps","_this3","_this$props","missing_indicator","loadOlder","loading_indicator","handleLoadOlder","react_default","a","createElement","ref","setRef","profile_column_header","handleHeaderClick","react_router_scroll_4_es","scrollKey","shouldUpdateScroll","onScroll","handleScroll","header_container","role","index","account_gallery_LoadMoreMedia","media_item_MediaItem","object","list","bool"],"mappings":"wQAMqBA,wLAMX,CACNC,QAA0B,aAAjBC,MAAgCC,EAAKC,MAAMC,MAAMC,MAAM,CAAC,SAAU,eAAkC,aAAjBJ,+CAGhF,WACZ,OAAKC,EAAKI,MAAMN,UACdE,EAAKK,SAAS,CAAEP,SAAS,KAClB,2CAMXQ,OAAA,WAAU,IAUJC,EAAOC,EAAMC,EATTP,EAAUQ,KAAKT,MAAfC,MACAJ,EAAYY,KAAKN,MAAjBN,QACFa,EAAST,EAAMU,IAAI,UAGnBC,EAA2B,KAFlBX,EAAMC,MAAM,CAAC,OAAQ,QAAS,MAEvB,EAAK,IACrBW,EAA2B,KAFlBZ,EAAMC,MAAM,CA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hBF,EAAOO,MACnBpC,OAAAC,EAAA,EAAAD,CAAA,OAAKE,UAAU,2BAAf,EACEF,OAAAC,EAAA,EAAAD,CAAC6D,EAAA,EAAD,aA/G4BnD,+BAEvB,CACjBiB,OAAQN,IAAU2D,OAAOnE,WACzBgC,SAAUxB,IAAUE,KAAKV,WACzBgB,OAAQlB,IAAmBsE,KAAKpE,WAChCkB,UAAWV,IAAU6D,KACrBlD,QAASX,IAAU6D,KACnBxD,UAAWL,IAAU6D","file":"flavours/glitch/async/account_gallery.js","sourcesContent":["import React from 'react';\nimport ImmutablePropTypes from 'react-immutable-proptypes';\nimport ImmutablePureComponent from 'react-immutable-pure-component';\nimport Permalink from 'flavours/glitch/components/permalink';\nimport { displayMedia } from 'flavours/glitch/util/initial_state';\n\nexport default class MediaItem extends ImmutablePureComponent {\n\n static propTypes = {\n media: ImmutablePropTypes.map.isRequired,\n };\n\n state = {\n visible: displayMedia !== 'hide_all' && !this.props.media.getIn(['status', 'sensitive']) || displayMedia === 'show_all',\n };\n\n handleClick = () => {\n if (!this.state.visible) {\n this.setState({ visible: true });\n return true;\n }\n\n return false;\n }\n\n render () {\n const { media } = this.props;\n const { visible } = this.state;\n const status = media.get('status');\n const focusX = media.getIn(['meta', 'focus', 'x']);\n const focusY = media.getIn(['meta', 'focus', 'y']);\n const x = ((focusX / 2) + .5) * 100;\n const y = ((focusY / -2) + .5) * 100;\n const style = {};\n\n let label, icon, title;\n\n if (media.get('type') === 'gifv') {\n label = <span className='media-gallery__gifv__label'>GIF</span>;\n }\n\n if (visible) {\n style.backgroundImage = `url(${media.get('preview_url')})`;\n style.backgroundPosition = `${x}% ${y}%`;\n title = media.get('description');\n } else {\n icon = (\n <span className='account-gallery__item__icons'>\n <i className='fa fa-eye-slash' />\n </span>\n );\n title = status.get('spoiler_text') || media.get('description');\n }\n\n return (\n <div className='account-gallery__item'>\n <Permalink\n to={`/statuses/${status.get('id')}`}\n href={status.get('url')}\n style={style}\n title={title}\n onInterceptClick={this.handleClick}\n >\n {icon}\n {label}\n </Permalink>\n </div>\n );\n }\n\n}\n","import React from 'react';\nimport { connect } from 'react-redux';\nimport ImmutablePropTypes from 'react-immutable-proptypes';\nimport PropTypes from 'prop-types';\nimport { fetchAccount } from 'flavours/glitch/actions/accounts';\nimport { expandAccountMediaTimeline } from 'flavours/glitch/actions/timelines';\nimport LoadingIndicator from 'flavours/glitch/components/loading_indicator';\nimport Column from 'flavours/glitch/features/ui/components/column';\nimport ProfileColumnHeader from 'flavours/glitch/features/account/components/profile_column_header';\nimport ImmutablePureComponent from 'react-immutable-pure-component';\nimport { getAccountGallery } from 'flavours/glitch/selectors';\nimport MediaItem from './components/media_item';\nimport HeaderContainer from 'flavours/glitch/features/account_timeline/containers/header_container';\nimport { ScrollContainer } from 'react-router-scroll-4';\nimport LoadMore from 'flavours/glitch/components/load_more';\nimport MissingIndicator from 'flavours/glitch/components/missing_indicator';\n\nconst mapStateToProps = (state, props) => ({\n isAccount: !!state.getIn(['accounts', props.params.accountId]),\n medias: getAccountGallery(state, props.params.accountId),\n isLoading: state.getIn(['timelines', `account:${props.params.accountId}:media`, 'isLoading']),\n hasMore: state.getIn(['timelines', `account:${props.params.accountId}:media`, 'hasMore']),\n});\n\nclass LoadMoreMedia extends ImmutablePureComponent {\n\n static propTypes = {\n maxId: PropTypes.string,\n onLoadMore: PropTypes.func.isRequired,\n };\n\n handleLoadMore = () => {\n this.props.onLoadMore(this.props.maxId);\n }\n\n render () {\n return (\n <LoadMore\n disabled={this.props.disabled}\n onClick={this.handleLoadMore}\n />\n );\n }\n\n}\n\n@connect(mapStateToProps)\nexport default class AccountGallery extends ImmutablePureComponent {\n\n static propTypes = {\n params: PropTypes.object.isRequired,\n dispatch: PropTypes.func.isRequired,\n medias: ImmutablePropTypes.list.isRequired,\n isLoading: PropTypes.bool,\n hasMore: PropTypes.bool,\n isAccount: PropTypes.bool,\n };\n\n componentDidMount () {\n this.props.dispatch(fetchAccount(this.props.params.accountId));\n this.props.dispatch(expandAccountMediaTimeline(this.props.params.accountId));\n }\n\n componentWillReceiveProps (nextProps) {\n if (nextProps.params.accountId !== this.props.params.accountId && nextProps.params.accountId) {\n this.props.dispatch(fetchAccount(nextProps.params.accountId));\n this.props.dispatch(expandAccountMediaTimeline(this.props.params.accountId));\n }\n }\n\n handleHeaderClick = () => {\n this.column.scrollTop();\n }\n\n handleScrollToBottom = () => {\n if (this.props.hasMore) {\n this.handleLoadMore(this.props.medias.size > 0 ? this.props.medias.last().getIn(['status', 'id']) : undefined);\n }\n }\n\n handleScroll = (e) => {\n const { scrollTop, scrollHeight, clientHeight } = e.target;\n const offset = scrollHeight - scrollTop - clientHeight;\n\n if (150 > offset && !this.props.isLoading) {\n this.handleScrollToBottom();\n }\n }\n\n handleLoadMore = maxId => {\n this.props.dispatch(expandAccountMediaTimeline(this.props.params.accountId, { maxId }));\n };\n\n handleLoadOlder = (e) => {\n e.preventDefault();\n this.handleScrollToBottom();\n }\n\n shouldUpdateScroll = (prevRouterProps, { location }) => {\n if ((((prevRouterProps || {}).location || {}).state || {}).mastodonModalOpen) return false;\n return !(location.state && location.state.mastodonModalOpen);\n }\n\n setRef = c => {\n this.column = c;\n }\n\n render () {\n const { medias, isLoading, hasMore, isAccount } = this.props;\n\n if (!isAccount) {\n return (\n <Column>\n <MissingIndicator />\n </Column>\n );\n }\n\n let loadOlder = null;\n\n if (!medias && isLoading) {\n return (\n <Column>\n <LoadingIndicator />\n </Column>\n );\n }\n\n if (hasMore && !(isLoading && medias.size === 0)) {\n loadOlder = <LoadMore visible={!isLoading} onClick={this.handleLoadOlder} />;\n }\n\n return (\n <Column ref={this.setRef}>\n <ProfileColumnHeader onClick={this.handleHeaderClick} />\n\n <ScrollContainer scrollKey='account_gallery' shouldUpdateScroll={this.shouldUpdateScroll}>\n <div className='scrollable scrollable--flex' onScroll={this.handleScroll}>\n <HeaderContainer accountId={this.props.params.accountId} />\n\n <div role='feed' className='account-gallery__container'>\n {medias.map((media, index) => media === null ? (\n <LoadMoreMedia\n key={'more:' + medias.getIn(index + 1, 'id')}\n maxId={index > 0 ? medias.getIn(index - 1, 'id') : null}\n onLoadMore={this.handleLoadMore}\n />\n ) : (\n <MediaItem\n key={media.get('id')}\n media={media}\n />\n ))}\n {loadOlder}\n </div>\n\n {isLoading && medias.size === 0 && (\n <div className='scrollable__append'>\n <LoadingIndicator />\n </div>\n )}\n </div>\n </ScrollContainer>\n </Column>\n );\n }\n\n}\n"],"sourceRoot":""}