mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-30 17:11:40 +00:00
1 line
5.5 KiB
Plaintext
1 line
5.5 KiB
Plaintext
{"version":3,"sources":["webpack:///./app/javascript/mastodon/containers/media_container.js"],"names":["Object","_locales__WEBPACK_IMPORTED_MODULE_9__","localeData","messages","react_intl__WEBPACK_IMPORTED_MODULE_8__","MEDIA_COMPONENTS","MediaGallery","_components_media_gallery__WEBPACK_IMPORTED_MODULE_10__","Video","_features_video__WEBPACK_IMPORTED_MODULE_11__","Card","_features_status_components_card__WEBPACK_IMPORTED_MODULE_12__","MediaContainer","state","media","index","time","handleOpenMedia","document","body","classList","add","_this","setState","handleOpenVideo","video","immutable__WEBPACK_IMPORTED_MODULE_15__","handleCloseMedia","remove","render","_this2","this","_props","props","locale","components","babel_runtime_helpers_jsx__WEBPACK_IMPORTED_MODULE_2___default","react__WEBPACK_IMPORTED_MODULE_6__","map","call","component","i","componentName","getAttribute","Component","_JSON$parse","JSON","parse","card","babel_runtime_helpers_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_1___default","assign","onOpenVideo","onOpenMedia","react_dom__WEBPACK_IMPORTED_MODULE_7___default","a","createPortal","react__WEBPACK_IMPORTED_MODULE_6___default","createElement","babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default","key","_components_modal_root__WEBPACK_IMPORTED_MODULE_13__","onClose","_features_ui_components_media_modal__WEBPACK_IMPORTED_MODULE_14__"],"mappings":"iVAYiCA,OAAAC,EAAA,UAAAD,GAAzBE,eAAYC,aACpBH,OAAAI,EAAA,EAAAJ,CAAcE,GAEd,IAAMG,GAAqBC,aAAAC,EAAA,QAAcC,MAAAC,EAAA,QAAOC,KAAAC,EAAA,GAE3BC,6KAOnBC,OACEC,MAAO,KACPC,MAAO,KACPC,KAAM,QAGRC,gBAAkB,SAACH,EAAOC,GACxBG,SAASC,KAAKC,UAAUC,IAAI,uBAC5BC,EAAKC,UAAWT,QAAOC,aAGzBS,gBAAkB,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esContent":["import React, { PureComponent, Fragment } from 'react';\nimport ReactDOM from 'react-dom';\nimport PropTypes from 'prop-types';\nimport { IntlProvider, addLocaleData } from 'react-intl';\nimport { getLocale } from '../locales';\nimport MediaGallery from '../components/media_gallery';\nimport Video from '../features/video';\nimport Card from '../features/status/components/card';\nimport ModalRoot from '../components/modal_root';\nimport MediaModal from '../features/ui/components/media_modal';\nimport { List as ImmutableList, fromJS } from 'immutable';\n\nconst { localeData, messages } = getLocale();\naddLocaleData(localeData);\n\nconst MEDIA_COMPONENTS = { MediaGallery, Video, Card };\n\nexport default class MediaContainer extends PureComponent {\n\n static propTypes = {\n locale: PropTypes.string.isRequired,\n components: PropTypes.object.isRequired,\n };\n\n state = {\n media: null,\n index: null,\n time: null,\n };\n\n handleOpenMedia = (media, index) => {\n document.body.classList.add('with-modals--active');\n this.setState({ media, index });\n }\n\n handleOpenVideo = (video, time) => {\n const media = ImmutableList([video]);\n\n document.body.classList.add('with-modals--active');\n this.setState({ media, time });\n }\n\n handleCloseMedia = () => {\n document.body.classList.remove('with-modals--active');\n this.setState({ media: null, index: null, time: null });\n }\n\n render () {\n const { locale, components } = this.props;\n\n return (\n <IntlProvider locale={locale} messages={messages}>\n <Fragment>\n {[].map.call(components, (component, i) => {\n const componentName = component.getAttribute('data-component');\n const Component = MEDIA_COMPONENTS[componentName];\n const { media, card, ...props } = JSON.parse(component.getAttribute('data-props'));\n\n Object.assign(props, {\n ...(media ? { media: fromJS(media) } : {}),\n ...(card ? { card: fromJS(card) } : {}),\n\n ...(componentName === 'Video' ? {\n onOpenVideo: this.handleOpenVideo,\n } : {\n onOpenMedia: this.handleOpenMedia,\n }),\n });\n\n return ReactDOM.createPortal(\n <Component {...props} key={`media-${i}`} />,\n component,\n );\n })}\n <ModalRoot onClose={this.handleCloseMedia}>\n {this.state.media && (\n <MediaModal\n media={this.state.media}\n index={this.state.index || 0}\n time={this.state.time}\n onClose={this.handleCloseMedia}\n />\n )}\n </ModalRoot>\n </Fragment>\n </IntlProvider>\n );\n }\n\n}\n"],"sourceRoot":""} |