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

1 line
12 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","medias","getAccountGallery","params","accountId","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","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,CAAC,OAAQ,QAA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a,OAAQf,IAAmBoE,KAAKlE,WAChCiB,UAAWT,IAAU2D,KACrBjD,QAASV,IAAU2D","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';\n\nconst mapStateToProps = (state, props) => ({\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 };\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 } = this.props;\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":""}