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

View File

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