akkoma/priv/static/packs/flavours/glitch/async/account_gallery.js.map
2019-01-31 10:35:44 +01:00

1 line
12 KiB
Plaintext

{"version":3,"sources":["webpack:///app/javascript/seagate/sources/git/hacktivis.me/git/mastofe/app/javascript/flavours/glitch/features/account_gallery/components/media_item.js","webpack:///app/javascript/seagate/sources/git/hacktivis.me/git/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","size","last","undefined","e","_e$target","target","scrollTop","scrollHeight","clientHeight","handleScrollToBottom","dispatch","expandAccountMediaTimeline","preventDefault","prevRouterProps","_ref","location","mastodonModalOpen","componentDidMount","fetchAccount","componentWillReceiveProps","nextProps","_this3","_this$props","loadOlder","column","loading_indicator","handleLoadOlder","column_back_button","react_router_scroll_4_es","scrollKey","shouldUpdateScroll","onScroll","handleScroll","header_container","role","index","account_gallery_LoadMoreMedia","media_item_MediaItem","object","list","bool"],"mappings":"+PAMqBA,qMAMX,CACNC,QAA0B,aAAjBC,MAAgCC,EAAKC,MAAMC,MAAMC,MAAM,CAAC,SAAU,eAAkC,aAAjBJ,4DAGhF,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,CAA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["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 ColumnBackButton from 'flavours/glitch/components/column_back_button';\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 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 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>\n <ColumnBackButton />\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":""}