testing public.js changes

This commit is contained in:
mgabdev 2020-05-13 00:15:16 -04:00
parent 5f9603d683
commit aba461b964
2 changed files with 18 additions and 30 deletions

View File

@ -1,19 +1,18 @@
import { Fragment } from 'react' import React, { PureComponent, Fragment } from 'react';
import ReactDOM from 'react-dom' import ReactDOM from 'react-dom';
import { List as ImmutableList, fromJS } from 'immutable' import PropTypes from 'prop-types';
import { IntlProvider, addLocaleData } from 'react-intl' import { IntlProvider, addLocaleData } from 'react-intl';
import { getLocale } from '../locales' import { getLocale } from '../locales';
import Video from '../components/video' import MediaGallery from 'gabsocial/components/media_gallery';
import StatusCard from '../components/status_card' import Video from 'gabsocial/components/video';
import Poll from 'gabsocial/components/poll' import Card from 'gabsocial/components/status_card';
import MediaGallery from '../components/media_gallery' import Poll from 'gabsocial/components/poll';
import ModalRoot from '../components/modal/modal_root' import { List as ImmutableList, fromJS } from 'immutable';
import MediaModal from '../components/modal/media_modal'
const { localeData, messages } = getLocale(); const { localeData, messages } = getLocale();
addLocaleData(localeData); addLocaleData(localeData);
const MEDIA_COMPONENTS = { MediaGallery, Video, StatusCard, Poll }; const MEDIA_COMPONENTS = { MediaGallery, Video, Card, Poll };
export default class MediaContainer extends PureComponent { export default class MediaContainer extends PureComponent {
@ -29,19 +28,19 @@ export default class MediaContainer extends PureComponent {
}; };
handleOpenMedia = (media, index) => { handleOpenMedia = (media, index) => {
document.body.classList.add(_s.overflowYHidden); document.body.classList.add('with-modals--active');
this.setState({ media, index }); this.setState({ media, index });
} }
handleOpenVideo = (video, time) => { handleOpenVideo = (video, time) => {
const media = ImmutableList([video]); const media = ImmutableList([video]);
document.body.classList.add(_s.overflowYHidden); document.body.classList.add('with-modals--active');
this.setState({ media, time }); this.setState({ media, time });
} }
handleCloseMedia = () => { handleCloseMedia = () => {
document.body.classList.remove(_s.overflowYHidden); document.body.classList.remove('with-modals--active');
this.setState({ media: null, index: null, time: null }); this.setState({ media: null, index: null, time: null });
} }
@ -73,16 +72,6 @@ export default class MediaContainer extends PureComponent {
component, component,
); );
})} })}
<ModalRoot onClose={this.handleCloseMedia}>
{this.state.media && (
<MediaModal
media={this.state.media}
index={this.state.index || 0}
time={this.state.time}
onClose={this.handleCloseMedia}
/>
)}
</ModalRoot>
</Fragment> </Fragment>
</IntlProvider> </IntlProvider>
); );

View File

@ -90,7 +90,6 @@ function main ( ) {
component.removeChild(child); component.removeChild(child);
}); });
}); });
const content = document.createElement('div'); const content = document.createElement('div');
ReactDOM.render(<MediaContainer locale={locale} components={reactComponents} />, content); ReactDOM.render(<MediaContainer locale={locale} components={reactComponents} />, content);
@ -98,7 +97,7 @@ function main ( ) {
scrollToDetailedStatus(); scrollToDetailedStatus();
}) })
.catch(error => { .catch(error => {
console.error(error); console.error("hello larry-1", error);
scrollToDetailedStatus(); scrollToDetailedStatus();
}); });
} else { } else {
@ -228,7 +227,7 @@ function main ( ) {
}, 700); }, 700);
} }
} catch (err) { } catch (err) {
console.error(err); console.error("hello larry-2", err);
} }
input.readonly = oldReadOnly; input.readonly = oldReadOnly;
@ -236,5 +235,5 @@ function main ( ) {
} }
loadPolyfills().then(main).catch(error => { loadPolyfills().then(main).catch(error => {
console.error(error); console.error("hello larry-3", error);
}); });