mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-14 11:34:15 +00:00
1 line
19 KiB
Plaintext
1 line
19 KiB
Plaintext
{"version":3,"sources":["webpack:///app/javascript/tank/sources/git/git.pleroma.social/pleroma/mastofe/app/javascript/flavours/glitch/features/account_gallery/components/media_item.js","webpack:///app/javascript/tank/sources/git/git.pleroma.social/pleroma/mastofe/app/javascript/flavours/glitch/features/account_gallery/index.js"],"names":["MediaItem","visible","displayMedia","props","attachment","getIn","loaded","c","canvas","setState","e","hoverToPlay","target","play","pause","currentTime","button","ctrlKey","metaKey","preventDefault","state","onOpenMedia","componentDidMount","this","get","_decode","componentDidUpdate","prevProps","hash","pixels","decode","ctx","getContext","imageData","ImageData","putImageData","autoPlayGif","indexOf","render","displayWidth","width","Math","floor","height","status","title","thumbnail","className","id","x","y","src","alt","style","objectPosition","onLoad","handleImageLoad","autoPlay","isIOS","label","classNames","autoplay","aria-label","role","onMouseEnter","handleMouseEnter","onMouseLeave","handleMouseLeave","loop","muted","icon","href","onClick","handleClick","rel","ref","setCanvasRef","ImmutablePureComponent","ImmutablePropTypes","map","isRequired","PropTypes","number","func","LoadMoreMedia","onLoadMore","maxId","disabled","handleLoadMore","string","AccountGallery","connect","isAccount","params","accountId","attachments","getAccountGallery","isLoading","hasMore","column","scrollTop","size","last","undefined","scrollHeight","clientHeight","handleScrollToBottom","dispatch","expandAccountMediaTimeline","prevRouterProps","location","mastodonModalOpen","openModal","media","index","findIndex","offsetWidth","fetchAccount","componentWillReceiveProps","nextProps","multiColumn","loadOlder","handleLoadOlder","setColumnRef","handleHeaderClick","scrollKey","shouldUpdateScroll","onScroll","handleScroll","handleRef","handleOpenMedia","object","list","bool"],"mappings":"qWAUqBA,E,iNAQX,CACNC,QAA0B,aAAjBC,MAAgC,EAAKC,MAAMC,WAAWC,MAAM,CAAC,SAAU,eAAkC,aAAjBH,IACjGI,QAAQ,I,2CA2BK,SAAAC,GACb,EAAKC,OAASD,K,8CAGE,WAChB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8B,K,0BAER,CACjBgB,OAAQZ,IAAUkD,OAAOnD,WACzB2B,SAAU1B,IAAUE,KAAKH,WACzBe,YAAajB,IAAmBsD,KAAKpD,WACrCiB,UAAWhB,IAAUoD,KACrBnC,QAASjB,IAAUoD,KACnBzC,UAAWX,IAAUoD,KACrBb,YAAavC,IAAUoD,O","file":"flavours/glitch/async/account_gallery.js","sourcesContent":["import { decode } from 'blurhash';\nimport classNames from 'classnames';\nimport Icon from 'flavours/glitch/components/icon';\nimport { autoPlayGif, displayMedia } from 'flavours/glitch/util/initial_state';\nimport { isIOS } from 'flavours/glitch/util/is_mobile';\nimport PropTypes from 'prop-types';\nimport React from 'react';\nimport ImmutablePropTypes from 'react-immutable-proptypes';\nimport ImmutablePureComponent from 'react-immutable-pure-component';\n\nexport default class MediaItem extends ImmutablePureComponent {\n\n static propTypes = {\n attachment: ImmutablePropTypes.map.isRequired,\n displayWidth: PropTypes.number.isRequired,\n onOpenMedia: PropTypes.func.isRequired,\n };\n\n state = {\n visible: displayMedia !== 'hide_all' && !this.props.attachment.getIn(['status', 'sensitive']) || displayMedia === 'show_all',\n loaded: false,\n };\n\n componentDidMount () {\n if (this.props.attachment.get('blurhash')) {\n this._decode();\n }\n }\n\n componentDidUpdate (prevProps) {\n if (prevProps.attachment.get('blurhash') !== this.props.attachment.get('blurhash') && this.props.attachment.get('blurhash')) {\n this._decode();\n }\n }\n\n _decode () {\n const hash = this.props.attachment.get('blurhash');\n const pixels = decode(hash, 32, 32);\n\n if (pixels) {\n const ctx = this.canvas.getContext('2d');\n const imageData = new ImageData(pixels, 32, 32);\n\n ctx.putImageData(imageData, 0, 0);\n }\n }\n\n setCanvasRef = c => {\n this.canvas = c;\n }\n\n handleImageLoad = () => {\n this.setState({ loaded: true });\n }\n\n handleMouseEnter = e => {\n if (this.hoverToPlay()) {\n e.target.play();\n }\n }\n\n handleMouseLeave = e => {\n if (this.hoverToPlay()) {\n e.target.pause();\n e.target.currentTime = 0;\n }\n }\n\n hoverToPlay () {\n return !autoPlayGif && ['gifv', 'video'].indexOf(this.props.attachment.get('type')) !== -1;\n }\n\n handleClick = e => {\n if (e.button === 0 && !(e.ctrlKey || e.metaKey)) {\n e.preventDefault();\n\n if (this.state.visible) {\n this.props.onOpenMedia(this.props.attachment);\n } else {\n this.setState({ visible: true });\n }\n }\n }\n\n render () {\n const { attachment, displayWidth } = this.props;\n const { visible, loaded } = this.state;\n\n const width = `${Math.floor((displayWidth - 4) / 3) - 4}px`;\n const height = width;\n const status = attachment.get('status');\n const title = status.get('spoiler_text') || attachment.get('description');\n\n let thumbnail = '';\n\n if (attachment.get('type') === 'unknown') {\n // Skip\n } else if (attachment.get('type') === 'audio') {\n thumbnail = (\n <span className='account-gallery__item__icons'>\n <Icon id='music' />\n </span>\n );\n } else if (attachment.get('type') === 'image') {\n const focusX = attachment.getIn(['meta', 'focus', 'x']) || 0;\n const focusY = attachment.getIn(['meta', 'focus', 'y']) || 0;\n const x = ((focusX / 2) + .5) * 100;\n const y = ((focusY / -2) + .5) * 100;\n\n thumbnail = (\n <img\n src={attachment.get('preview_url')}\n alt={attachment.get('description')}\n title={attachment.get('description')}\n style={{ objectPosition: `${x}% ${y}%` }}\n onLoad={this.handleImageLoad}\n />\n );\n } else if (['gifv', 'video'].indexOf(attachment.get('type')) !== -1) {\n const autoPlay = !isIOS() && autoPlayGif;\n const label = attachment.get('type') === 'video' ? <Icon id='play' /> : 'GIF';\n\n thumbnail = (\n <div className={classNames('media-gallery__gifv', { autoplay: autoPlay })}>\n <video\n className='media-gallery__item-gifv-thumbnail'\n aria-label={attachment.get('description')}\n title={attachment.get('description')}\n role='application'\n src={attachment.get('url')}\n onMouseEnter={this.handleMouseEnter}\n onMouseLeave={this.handleMouseLeave}\n autoPlay={autoPlay}\n loop\n muted\n />\n\n <span className='media-gallery__gifv__label'>{label}</span>\n </div>\n );\n }\n\n const icon = (\n <span className='account-gallery__item__icons'>\n <Icon id='eye-slash' />\n </span>\n );\n\n return (\n <div className='account-gallery__item' style={{ width, height }}>\n <a className='media-gallery__item-thumbnail' href={status.get('url')} onClick={this.handleClick} title={title} target='_blank' rel='noopener noreferrer'>\n <canvas width={32} height={32} ref={this.setCanvasRef} className={classNames('media-gallery__preview', { 'media-gallery__preview--hidden': visible && loaded })} />\n {visible ? thumbnail : icon}\n </a>\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';\nimport { openModal } from 'flavours/glitch/actions/modal';\n\nconst mapStateToProps = (state, props) => ({\n isAccount: !!state.getIn(['accounts', props.params.accountId]),\n attachments: 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\nexport default @connect(mapStateToProps)\nclass AccountGallery extends ImmutablePureComponent {\n\n static propTypes = {\n params: PropTypes.object.isRequired,\n dispatch: PropTypes.func.isRequired,\n attachments: ImmutablePropTypes.list.isRequired,\n isLoading: PropTypes.bool,\n hasMore: PropTypes.bool,\n isAccount: PropTypes.bool,\n multiColumn: PropTypes.bool,\n };\n\n state = {\n width: 323,\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.attachments.size > 0 ? this.props.attachments.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 setColumnRef = c => {\n this.column = c;\n }\n\n handleOpenMedia = attachment => {\n if (attachment.get('type') === 'video') {\n this.props.dispatch(openModal('VIDEO', { media: attachment, status: attachment.get('status') }));\n } else if (attachment.get('type') === 'audio') {\n this.props.dispatch(openModal('AUDIO', { media: attachment, status: attachment.get('status') }));\n } else {\n const media = attachment.getIn(['status', 'media_attachments']);\n const index = media.findIndex(x => x.get('id') === attachment.get('id'));\n\n this.props.dispatch(openModal('MEDIA', { media, index, status: attachment.get('status') }));\n }\n }\n\n handleRef = c => {\n if (c) {\n this.setState({ width: c.offsetWidth });\n }\n }\n\n render () {\n const { attachments, isLoading, hasMore, isAccount, multiColumn } = this.props;\n const { width } = this.state;\n\n if (!isAccount) {\n return (\n <Column>\n <MissingIndicator />\n </Column>\n );\n }\n\n if (!attachments && isLoading) {\n return (\n <Column>\n <LoadingIndicator />\n </Column>\n );\n }\n\n let loadOlder = null;\n\n if (hasMore && !(isLoading && attachments.size === 0)) {\n loadOlder = <LoadMore visible={!isLoading} onClick={this.handleLoadOlder} />;\n }\n\n return (\n <Column ref={this.setColumnRef}>\n <ProfileColumnHeader onClick={this.handleHeaderClick} multiColumn={multiColumn} />\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' ref={this.handleRef}>\n {attachments.map((attachment, index) => attachment === null ? (\n <LoadMoreMedia key={'more:' + attachments.getIn(index + 1, 'id')} maxId={index > 0 ? attachments.getIn(index - 1, 'id') : null} onLoadMore={this.handleLoadMore} />\n ) : (\n <MediaItem key={attachment.get('id')} attachment={attachment} displayWidth={width} onOpenMedia={this.handleOpenMedia} />\n ))}\n\n {loadOlder}\n </div>\n\n {isLoading && attachments.size === 0 && (\n <div className='scrollable__append'>\n <LoadingIndicator />\n </div>\n )}\n </div>\n </ScrollContainer>\n </Column>\n );\n }\n\n}\n"],"sourceRoot":""} |