about summary refs log tree commit diff
path: root/app/javascript/themes/glitch/containers
diff options
context:
space:
mode:
authorkibigo! <marrus-sh@users.noreply.github.com>2017-12-03 23:26:40 -0800
committerkibigo! <marrus-sh@users.noreply.github.com>2017-12-03 23:26:40 -0800
commitbc4fa6b198557a7f3989eb0865e2c77ac7451d29 (patch)
treea18543e1e0555e88b97cad60adc6d2abe0bffb00 /app/javascript/themes/glitch/containers
parentd216547382cf1f3419de31e1ee06272e816ea339 (diff)
Rename themes -> flavours ? ?
Diffstat (limited to 'app/javascript/themes/glitch/containers')
-rw-r--r--app/javascript/themes/glitch/containers/account_container.js72
-rw-r--r--app/javascript/themes/glitch/containers/card_container.js18
-rw-r--r--app/javascript/themes/glitch/containers/compose_container.js38
-rw-r--r--app/javascript/themes/glitch/containers/dropdown_menu_container.js16
-rw-r--r--app/javascript/themes/glitch/containers/intersection_observer_article_container.js17
-rw-r--r--app/javascript/themes/glitch/containers/mastodon.js70
-rw-r--r--app/javascript/themes/glitch/containers/media_gallery_container.js34
-rw-r--r--app/javascript/themes/glitch/containers/notification_purge_buttons_container.js49
-rw-r--r--app/javascript/themes/glitch/containers/status_container.js150
-rw-r--r--app/javascript/themes/glitch/containers/timeline_container.js48
-rw-r--r--app/javascript/themes/glitch/containers/video_container.js26
11 files changed, 0 insertions, 538 deletions
diff --git a/app/javascript/themes/glitch/containers/account_container.js b/app/javascript/themes/glitch/containers/account_container.js
deleted file mode 100644
index c1ce49987..000000000
--- a/app/javascript/themes/glitch/containers/account_container.js
+++ /dev/null
@@ -1,72 +0,0 @@
-import React from 'react';
-import { connect } from 'react-redux';
-import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
-import { makeGetAccount } from 'themes/glitch/selectors';
-import Account from 'themes/glitch/components/account';
-import {
-  followAccount,
-  unfollowAccount,
-  blockAccount,
-  unblockAccount,
-  muteAccount,
-  unmuteAccount,
-} from 'themes/glitch/actions/accounts';
-import { openModal } from 'themes/glitch/actions/modal';
-import { initMuteModal } from 'themes/glitch/actions/mutes';
-import { unfollowModal } from 'themes/glitch/util/initial_state';
-
-const messages = defineMessages({
-  unfollowConfirm: { id: 'confirmations.unfollow.confirm', defaultMessage: 'Unfollow' },
-});
-
-const makeMapStateToProps = () => {
-  const getAccount = makeGetAccount();
-
-  const mapStateToProps = (state, props) => ({
-    account: getAccount(state, props.id),
-  });
-
-  return mapStateToProps;
-};
-
-const mapDispatchToProps = (dispatch, { intl }) => ({
-
-  onFollow (account) {
-    if (account.getIn(['relationship', 'following']) || account.getIn(['relationship', 'requested'])) {
-      if (unfollowModal) {
-        dispatch(openModal('CONFIRM', {
-          message: <FormattedMessage id='confirmations.unfollow.message' defaultMessage='Are you sure you want to unfollow {name}?' values={{ name: <strong>@{account.get('acct')}</strong> }} />,
-          confirm: intl.formatMessage(messages.unfollowConfirm),
-          onConfirm: () => dispatch(unfollowAccount(account.get('id'))),
-        }));
-      } else {
-        dispatch(unfollowAccount(account.get('id')));
-      }
-    } else {
-      dispatch(followAccount(account.get('id')));
-    }
-  },
-
-  onBlock (account) {
-    if (account.getIn(['relationship', 'blocking'])) {
-      dispatch(unblockAccount(account.get('id')));
-    } else {
-      dispatch(blockAccount(account.get('id')));
-    }
-  },
-
-  onMute (account) {
-    if (account.getIn(['relationship', 'muting'])) {
-      dispatch(unmuteAccount(account.get('id')));
-    } else {
-      dispatch(initMuteModal(account));
-    }
-  },
-
-
-  onMuteNotifications (account, notifications) {
-    dispatch(muteAccount(account.get('id'), notifications));
-  },
-});
-
-export default injectIntl(connect(makeMapStateToProps, mapDispatchToProps)(Account));
diff --git a/app/javascript/themes/glitch/containers/card_container.js b/app/javascript/themes/glitch/containers/card_container.js
deleted file mode 100644
index 8285437bb..000000000
--- a/app/javascript/themes/glitch/containers/card_container.js
+++ /dev/null
@@ -1,18 +0,0 @@
-import React from 'react';
-import PropTypes from 'prop-types';
-import Card from 'themes/glitch/features/status/components/card';
-import { fromJS } from 'immutable';
-
-export default class CardContainer extends React.PureComponent {
-
-  static propTypes = {
-    locale: PropTypes.string,
-    card: PropTypes.array.isRequired,
-  };
-
-  render () {
-    const { card, ...props } = this.props;
-    return <Card card={fromJS(card)} {...props} />;
-  }
-
-}
diff --git a/app/javascript/themes/glitch/containers/compose_container.js b/app/javascript/themes/glitch/containers/compose_container.js
deleted file mode 100644
index 82980ee36..000000000
--- a/app/javascript/themes/glitch/containers/compose_container.js
+++ /dev/null
@@ -1,38 +0,0 @@
-import React from 'react';
-import { Provider } from 'react-redux';
-import PropTypes from 'prop-types';
-import configureStore from 'themes/glitch/store/configureStore';
-import { hydrateStore } from 'themes/glitch/actions/store';
-import { IntlProvider, addLocaleData } from 'react-intl';
-import { getLocale } from 'mastodon/locales';
-import Compose from 'themes/glitch/features/standalone/compose';
-import initialState from 'themes/glitch/util/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,
-  };
-
-  render () {
-    const { locale } = this.props;
-
-    return (
-      <IntlProvider locale={locale} messages={messages}>
-        <Provider store={store}>
-          <Compose />
-        </Provider>
-      </IntlProvider>
-    );
-  }
-
-}
diff --git a/app/javascript/themes/glitch/containers/dropdown_menu_container.js b/app/javascript/themes/glitch/containers/dropdown_menu_container.js
deleted file mode 100644
index 15e8da2e3..000000000
--- a/app/javascript/themes/glitch/containers/dropdown_menu_container.js
+++ /dev/null
@@ -1,16 +0,0 @@
-import { openModal, closeModal } from 'themes/glitch/actions/modal';
-import { connect } from 'react-redux';
-import DropdownMenu from 'themes/glitch/components/dropdown_menu';
-import { isUserTouching } from 'themes/glitch/util/is_mobile';
-
-const mapStateToProps = state => ({
-  isModalOpen: state.get('modal').modalType === 'ACTIONS',
-});
-
-const mapDispatchToProps = dispatch => ({
-  isUserTouching,
-  onModalOpen: props => dispatch(openModal('ACTIONS', props)),
-  onModalClose: () => dispatch(closeModal()),
-});
-
-export default connect(mapStateToProps, mapDispatchToProps)(DropdownMenu);
diff --git a/app/javascript/themes/glitch/containers/intersection_observer_article_container.js b/app/javascript/themes/glitch/containers/intersection_observer_article_container.js
deleted file mode 100644
index 6ede64738..000000000
--- a/app/javascript/themes/glitch/containers/intersection_observer_article_container.js
+++ /dev/null
@@ -1,17 +0,0 @@
-import { connect } from 'react-redux';
-import IntersectionObserverArticle from 'themes/glitch/components/intersection_observer_article';
-import { setHeight } from 'themes/glitch/actions/height_cache';
-
-const makeMapStateToProps = (state, props) => ({
-  cachedHeight: state.getIn(['height_cache', props.saveHeightKey, props.id]),
-});
-
-const mapDispatchToProps = (dispatch) => ({
-
-  onHeightChange (key, id, height) {
-    dispatch(setHeight(key, id, height));
-  },
-
-});
-
-export default connect(makeMapStateToProps, mapDispatchToProps)(IntersectionObserverArticle);
diff --git a/app/javascript/themes/glitch/containers/mastodon.js b/app/javascript/themes/glitch/containers/mastodon.js
deleted file mode 100644
index 755b5564a..000000000
--- a/app/javascript/themes/glitch/containers/mastodon.js
+++ /dev/null
@@ -1,70 +0,0 @@
-import React from 'react';
-import { Provider } from 'react-redux';
-import PropTypes from 'prop-types';
-import configureStore from 'themes/glitch/store/configureStore';
-import { showOnboardingOnce } from 'themes/glitch/actions/onboarding';
-import { BrowserRouter, Route } from 'react-router-dom';
-import { ScrollContext } from 'react-router-scroll-4';
-import UI from 'themes/glitch/features/ui';
-import { hydrateStore } from 'themes/glitch/actions/store';
-import { connectUserStream } from 'themes/glitch/actions/streaming';
-import { IntlProvider, addLocaleData } from 'react-intl';
-import { getLocale } from 'locales';
-import initialState from 'themes/glitch/util/initial_state';
-
-const { localeData, messages } = getLocale();
-addLocaleData(localeData);
-
-export const store = configureStore();
-const hydrateAction = hydrateStore(initialState);
-store.dispatch(hydrateAction);
-
-export default class Mastodon extends React.PureComponent {
-
-  static propTypes = {
-    locale: PropTypes.string.isRequired,
-  };
-
-  componentDidMount() {
-    this.disconnect = store.dispatch(connectUserStream());
-
-    // Desktop notifications
-    // Ask after 1 minute
-    if (typeof window.Notification !== 'undefined' && Notification.permission === 'default') {
-      window.setTimeout(() => Notification.requestPermission(), 60 * 1000);
-    }
-
-    // Protocol handler
-    // Ask after 5 minutes
-    if (typeof navigator.registerProtocolHandler !== 'undefined') {
-      const handlerUrl = window.location.protocol + '//' + window.location.host + '/intent?uri=%s';
-      window.setTimeout(() => navigator.registerProtocolHandler('web+mastodon', handlerUrl, 'Mastodon'), 5 * 60 * 1000);
-    }
-
-    store.dispatch(showOnboardingOnce());
-  }
-
-  componentWillUnmount () {
-    if (this.disconnect) {
-      this.disconnect();
-      this.disconnect = null;
-    }
-  }
-
-  render () {
-    const { locale } = this.props;
-
-    return (
-      <IntlProvider locale={locale} messages={messages}>
-        <Provider store={store}>
-          <BrowserRouter basename='/web'>
-            <ScrollContext>
-              <Route path='/' component={UI} />
-            </ScrollContext>
-          </BrowserRouter>
-        </Provider>
-      </IntlProvider>
-    );
-  }
-
-}
diff --git a/app/javascript/themes/glitch/containers/media_gallery_container.js b/app/javascript/themes/glitch/containers/media_gallery_container.js
deleted file mode 100644
index 86965f73b..000000000
--- a/app/javascript/themes/glitch/containers/media_gallery_container.js
+++ /dev/null
@@ -1,34 +0,0 @@
-import React from 'react';
-import PropTypes from 'prop-types';
-import { IntlProvider, addLocaleData } from 'react-intl';
-import { getLocale } from 'mastodon/locales';
-import MediaGallery from 'themes/glitch/components/media_gallery';
-import { fromJS } from 'immutable';
-
-const { localeData, messages } = getLocale();
-addLocaleData(localeData);
-
-export default class MediaGalleryContainer extends React.PureComponent {
-
-  static propTypes = {
-    locale: PropTypes.string.isRequired,
-    media: PropTypes.array.isRequired,
-  };
-
-  handleOpenMedia = () => {}
-
-  render () {
-    const { locale, media, ...props } = this.props;
-
-    return (
-      <IntlProvider locale={locale} messages={messages}>
-        <MediaGallery
-          {...props}
-          media={fromJS(media)}
-          onOpenMedia={this.handleOpenMedia}
-        />
-      </IntlProvider>
-    );
-  }
-
-}
diff --git a/app/javascript/themes/glitch/containers/notification_purge_buttons_container.js b/app/javascript/themes/glitch/containers/notification_purge_buttons_container.js
deleted file mode 100644
index ee4cb84cd..000000000
--- a/app/javascript/themes/glitch/containers/notification_purge_buttons_container.js
+++ /dev/null
@@ -1,49 +0,0 @@
-//  Package imports.
-import { connect } from 'react-redux';
-import { defineMessages, injectIntl } from 'react-intl';
-
-//  Our imports.
-import NotificationPurgeButtons from 'themes/glitch/components/notification_purge_buttons';
-import {
-  deleteMarkedNotifications,
-  enterNotificationClearingMode,
-  markAllNotifications,
-} from 'themes/glitch/actions/notifications';
-import { openModal } from 'themes/glitch/actions/modal';
-
-const messages = defineMessages({
-  clearMessage: { id: 'notifications.marked_clear_confirmation', defaultMessage: 'Are you sure you want to permanently clear all selected notifications?' },
-  clearConfirm: { id: 'notifications.marked_clear', defaultMessage: 'Clear selected notifications' },
-});
-
-const mapDispatchToProps = (dispatch, { intl }) => ({
-  onEnterCleaningMode(yes) {
-    dispatch(enterNotificationClearingMode(yes));
-  },
-
-  onDeleteMarked() {
-    dispatch(openModal('CONFIRM', {
-      message: intl.formatMessage(messages.clearMessage),
-      confirm: intl.formatMessage(messages.clearConfirm),
-      onConfirm: () => dispatch(deleteMarkedNotifications()),
-    }));
-  },
-
-  onMarkAll() {
-    dispatch(markAllNotifications(true));
-  },
-
-  onMarkNone() {
-    dispatch(markAllNotifications(false));
-  },
-
-  onInvert() {
-    dispatch(markAllNotifications(null));
-  },
-});
-
-const mapStateToProps = state => ({
-  markNewForDelete: state.getIn(['notifications', 'markNewForDelete']),
-});
-
-export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(NotificationPurgeButtons));
diff --git a/app/javascript/themes/glitch/containers/status_container.js b/app/javascript/themes/glitch/containers/status_container.js
deleted file mode 100644
index 14906723a..000000000
--- a/app/javascript/themes/glitch/containers/status_container.js
+++ /dev/null
@@ -1,150 +0,0 @@
-import React from 'react';
-import { connect } from 'react-redux';
-import Status from 'themes/glitch/components/status';
-import { makeGetStatus } from 'themes/glitch/selectors';
-import {
-  replyCompose,
-  mentionCompose,
-} from 'themes/glitch/actions/compose';
-import {
-  reblog,
-  favourite,
-  unreblog,
-  unfavourite,
-  pin,
-  unpin,
-} from 'themes/glitch/actions/interactions';
-import { blockAccount } from 'themes/glitch/actions/accounts';
-import { muteStatus, unmuteStatus, deleteStatus } from 'themes/glitch/actions/statuses';
-import { initMuteModal } from 'themes/glitch/actions/mutes';
-import { initReport } from 'themes/glitch/actions/reports';
-import { openModal } from 'themes/glitch/actions/modal';
-import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
-import { boostModal, deleteModal } from 'themes/glitch/util/initial_state';
-
-const messages = defineMessages({
-  deleteConfirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' },
-  deleteMessage: { id: 'confirmations.delete.message', defaultMessage: 'Are you sure you want to delete this status?' },
-  blockConfirm: { id: 'confirmations.block.confirm', defaultMessage: 'Block' },
-});
-
-const makeMapStateToProps = () => {
-  const getStatus = makeGetStatus();
-
-  const mapStateToProps = (state, props) => {
-
-    let status = getStatus(state, props.id);
-    let reblogStatus = status ? status.get('reblog', null) : null;
-    let account = undefined;
-    let prepend = undefined;
-
-    if (reblogStatus !== null && typeof reblogStatus === 'object') {
-      account = status.get('account');
-      status = reblogStatus;
-      prepend = 'reblogged_by';
-    }
-
-    return {
-      status      : status,
-      account     : account || props.account,
-      settings    : state.get('local_settings'),
-      prepend     : prepend || props.prepend,
-    };
-  };
-
-  return mapStateToProps;
-};
-
-const mapDispatchToProps = (dispatch, { intl }) => ({
-
-  onReply (status, router) {
-    dispatch(replyCompose(status, router));
-  },
-
-  onModalReblog (status) {
-    dispatch(reblog(status));
-  },
-
-  onReblog (status, e) {
-    if (status.get('reblogged')) {
-      dispatch(unreblog(status));
-    } else {
-      if (e.shiftKey || !boostModal) {
-        this.onModalReblog(status);
-      } else {
-        dispatch(openModal('BOOST', { status, onReblog: this.onModalReblog }));
-      }
-    }
-  },
-
-  onFavourite (status) {
-    if (status.get('favourited')) {
-      dispatch(unfavourite(status));
-    } else {
-      dispatch(favourite(status));
-    }
-  },
-
-  onPin (status) {
-    if (status.get('pinned')) {
-      dispatch(unpin(status));
-    } else {
-      dispatch(pin(status));
-    }
-  },
-
-  onEmbed (status) {
-    dispatch(openModal('EMBED', { url: status.get('url') }));
-  },
-
-  onDelete (status) {
-    if (!deleteModal) {
-      dispatch(deleteStatus(status.get('id')));
-    } else {
-      dispatch(openModal('CONFIRM', {
-        message: intl.formatMessage(messages.deleteMessage),
-        confirm: intl.formatMessage(messages.deleteConfirm),
-        onConfirm: () => dispatch(deleteStatus(status.get('id'))),
-      }));
-    }
-  },
-
-  onMention (account, router) {
-    dispatch(mentionCompose(account, router));
-  },
-
-  onOpenMedia (media, index) {
-    dispatch(openModal('MEDIA', { media, index }));
-  },
-
-  onOpenVideo (media, time) {
-    dispatch(openModal('VIDEO', { media, time }));
-  },
-
-  onBlock (account) {
-    dispatch(openModal('CONFIRM', {
-      message: <FormattedMessage id='confirmations.block.message' defaultMessage='Are you sure you want to block {name}?' values={{ name: <strong>@{account.get('acct')}</strong> }} />,
-      confirm: intl.formatMessage(messages.blockConfirm),
-      onConfirm: () => dispatch(blockAccount(account.get('id'))),
-    }));
-  },
-
-  onReport (status) {
-    dispatch(initReport(status.get('account'), status));
-  },
-
-  onMute (account) {
-    dispatch(initMuteModal(account));
-  },
-
-  onMuteConversation (status) {
-    if (status.get('muted')) {
-      dispatch(unmuteStatus(status.get('id')));
-    } else {
-      dispatch(muteStatus(status.get('id')));
-    }
-  },
-
-});
-
-export default injectIntl(connect(makeMapStateToProps, mapDispatchToProps)(Status));
diff --git a/app/javascript/themes/glitch/containers/timeline_container.js b/app/javascript/themes/glitch/containers/timeline_container.js
deleted file mode 100644
index a75f8808d..000000000
--- a/app/javascript/themes/glitch/containers/timeline_container.js
+++ /dev/null
@@ -1,48 +0,0 @@
-import React from 'react';
-import { Provider } from 'react-redux';
-import PropTypes from 'prop-types';
-import configureStore from 'themes/glitch/store/configureStore';
-import { hydrateStore } from 'themes/glitch/actions/store';
-import { IntlProvider, addLocaleData } from 'react-intl';
-import { getLocale } from 'mastodon/locales';
-import PublicTimeline from 'themes/glitch/features/standalone/public_timeline';
-import HashtagTimeline from 'themes/glitch/features/standalone/hashtag_timeline';
-import initialState from 'themes/glitch/util/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,
-  };
-
-  render () {
-    const { locale, hashtag } = this.props;
-
-    let timeline;
-
-    if (hashtag) {
-      timeline = <HashtagTimeline hashtag={hashtag} />;
-    } else {
-      timeline = <PublicTimeline />;
-    }
-
-    return (
-      <IntlProvider locale={locale} messages={messages}>
-        <Provider store={store}>
-          {timeline}
-        </Provider>
-      </IntlProvider>
-    );
-  }
-
-}
diff --git a/app/javascript/themes/glitch/containers/video_container.js b/app/javascript/themes/glitch/containers/video_container.js
deleted file mode 100644
index 2b0e98666..000000000
--- a/app/javascript/themes/glitch/containers/video_container.js
+++ /dev/null
@@ -1,26 +0,0 @@
-import React from 'react';
-import PropTypes from 'prop-types';
-import { IntlProvider, addLocaleData } from 'react-intl';
-import { getLocale } from 'mastodon/locales';
-import Video from 'themes/glitch/features/video';
-
-const { localeData, messages } = getLocale();
-addLocaleData(localeData);
-
-export default class VideoContainer extends React.PureComponent {
-
-  static propTypes = {
-    locale: PropTypes.string.isRequired,
-  };
-
-  render () {
-    const { locale, ...props } = this.props;
-
-    return (
-      <IntlProvider locale={locale} messages={messages}>
-        <Video {...props} />
-      </IntlProvider>
-    );
-  }
-
-}