From 36f5b6cea87365d3a131cdb338d35f4eeabb76d7 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 4 Jun 2020 19:34:36 -0500 Subject: [PATCH] Delete unused container components --- app/soapbox/containers/compose_container.js | 41 --------- app/soapbox/containers/media_container.js | 92 -------------------- app/soapbox/containers/timeline_container.js | 58 ------------ 3 files changed, 191 deletions(-) delete mode 100644 app/soapbox/containers/compose_container.js delete mode 100644 app/soapbox/containers/media_container.js delete mode 100644 app/soapbox/containers/timeline_container.js diff --git a/app/soapbox/containers/compose_container.js b/app/soapbox/containers/compose_container.js deleted file mode 100644 index 928d12a21..000000000 --- a/app/soapbox/containers/compose_container.js +++ /dev/null @@ -1,41 +0,0 @@ -import React from 'react'; -import { Provider } from 'react-redux'; -import PropTypes from 'prop-types'; -import configureStore from '../store/configureStore'; -import { hydrateStore } from '../actions/store'; -import { IntlProvider, addLocaleData } from 'react-intl'; -import { getLocale } from '../locales'; -import Compose from '../features/standalone/compose'; -import initialState from '../initial_state'; -import { fetchCustomEmojis } from '../actions/custom_emojis'; - -const { localeData, messages } = getLocale(); -addLocaleData(localeData); - -const store = configureStore(); - -if (initialState) { - store.dispatch(hydrateStore(initialState)); -} - -store.dispatch(fetchCustomEmojis()); - -export default class TimelineContainer extends React.PureComponent { - - static propTypes = { - locale: PropTypes.string.isRequired, - }; - - render() { - const { locale } = this.props; - - return ( - - - - - - ); - } - -} diff --git a/app/soapbox/containers/media_container.js b/app/soapbox/containers/media_container.js deleted file mode 100644 index 5c6c248b1..000000000 --- a/app/soapbox/containers/media_container.js +++ /dev/null @@ -1,92 +0,0 @@ -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 '../components/media_gallery'; -import Video from '../features/video'; -import Card from '../features/status/components/card'; -import Poll from 'soapbox/components/poll'; -import ModalRoot from '../components/modal_root'; -import MediaModal from '../features/ui/components/media_modal'; -import { List as ImmutableList, fromJS } from 'immutable'; - -const { localeData, messages } = getLocale(); -addLocaleData(localeData); - -const MEDIA_COMPONENTS = { MediaGallery, Video, Card, Poll }; - -export default class MediaContainer extends PureComponent { - - static propTypes = { - locale: PropTypes.string.isRequired, - components: PropTypes.object.isRequired, - }; - - state = { - media: null, - index: null, - time: null, - }; - - handleOpenMedia = (media, index) => { - document.body.classList.add('with-modals--active'); - this.setState({ media, index }); - } - - handleOpenVideo = (video, time) => { - const media = ImmutableList([video]); - - document.body.classList.add('with-modals--active'); - this.setState({ media, time }); - } - - handleCloseMedia = () => { - document.body.classList.remove('with-modals--active'); - this.setState({ media: null, index: null, time: null }); - } - - render() { - const { locale, components } = this.props; - - return ( - - - {[].map.call(components, (component, i) => { - const componentName = component.getAttribute('data-component'); - const Component = MEDIA_COMPONENTS[componentName]; - const { media, card, poll, ...props } = JSON.parse(component.getAttribute('data-props')); - - Object.assign(props, { - ...(media ? { media: fromJS(media) } : {}), - ...(card ? { card: fromJS(card) } : {}), - ...(poll ? { poll: fromJS(poll) } : {}), - - ...(componentName === 'Video' ? { - onOpenVideo: this.handleOpenVideo, - } : { - onOpenMedia: this.handleOpenMedia, - }), - }); - - return ReactDOM.createPortal( - , - component, - ); - })} - - {this.state.media && ( - - )} - - - - ); - } - -} diff --git a/app/soapbox/containers/timeline_container.js b/app/soapbox/containers/timeline_container.js deleted file mode 100644 index 550d891d3..000000000 --- a/app/soapbox/containers/timeline_container.js +++ /dev/null @@ -1,58 +0,0 @@ -import React, { Fragment } from 'react'; -import ReactDOM from 'react-dom'; -import { Provider } from 'react-redux'; -import PropTypes from 'prop-types'; -import configureStore from '../store/configureStore'; -import { hydrateStore } from '../actions/store'; -import { IntlProvider, addLocaleData } from 'react-intl'; -import { getLocale } from '../locales'; -import PublicTimeline from '../features/standalone/public_timeline'; -import HashtagTimeline from '../features/standalone/hashtag_timeline'; -import ModalContainer from '../features/ui/containers/modal_container'; -import initialState from '../initial_state'; - -const { localeData, messages } = getLocale(); -addLocaleData(localeData); - -const store = configureStore(); - -if (initialState) { - store.dispatch(hydrateStore(initialState)); -} - -export default class TimelineContainer extends React.PureComponent { - - static propTypes = { - locale: PropTypes.string.isRequired, - hashtag: PropTypes.string, - local: PropTypes.bool, - }; - - render() { - const { locale, hashtag, local } = this.props; - - let timeline; - - if (hashtag) { - timeline = ; - } else { - timeline = ; - } - - return ( - - - - {timeline} - - {ReactDOM.createPortal( - , - document.getElementById('modal-container'), - )} - - - - ); - } - -}