about summary refs log tree commit diff
path: root/app/assets/javascripts/components/containers
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-09-19 23:25:59 +0200
committerEugen Rochko <eugen@zeonfederated.com>2016-09-19 23:26:21 +0200
commit337462aa5e68014aa15788e4513e190b2e434d7e (patch)
treea760e80e2bc9b1fef55f118ddeb8603b20155a61 /app/assets/javascripts/components/containers
parentf820edb463109e313e836d8e2f210927a0eba7d1 (diff)
Re-organizing components to be more modular, adding loading bars
Diffstat (limited to 'app/assets/javascripts/components/containers')
-rw-r--r--app/assets/javascripts/components/containers/compose_form_container.jsx42
-rw-r--r--app/assets/javascripts/components/containers/follow_form_container.jsx24
-rw-r--r--app/assets/javascripts/components/containers/mastodon.jsx (renamed from app/assets/javascripts/components/containers/root.jsx)8
-rw-r--r--app/assets/javascripts/components/containers/navigation_container.jsx8
-rw-r--r--app/assets/javascripts/components/containers/notifications_container.jsx25
-rw-r--r--app/assets/javascripts/components/containers/status_list_container.jsx29
-rw-r--r--app/assets/javascripts/components/containers/upload_form_container.jsx25
7 files changed, 4 insertions, 157 deletions
diff --git a/app/assets/javascripts/components/containers/compose_form_container.jsx b/app/assets/javascripts/components/containers/compose_form_container.jsx
deleted file mode 100644
index d49217a90..000000000
--- a/app/assets/javascripts/components/containers/compose_form_container.jsx
+++ /dev/null
@@ -1,42 +0,0 @@
-import { connect }                                          from 'react-redux';
-import ComposeForm                                          from '../components/compose_form';
-import { changeCompose, submitCompose, cancelReplyCompose } from '../actions/compose';
-
-function selectStatus(state) {
-  let statusId = state.getIn(['compose', 'in_reply_to'], null);
-
-  if (statusId === null) {
-    return null;
-  }
-
-  let status = state.getIn(['timelines', 'statuses', statusId]);
-  status = status.set('account', state.getIn(['timelines', 'accounts', status.get('account')]));
-
-  return status;
-};
-
-const mapStateToProps = function (state, props) {
-  return {
-    text: state.getIn(['compose', 'text']),
-    is_submitting: state.getIn(['compose', 'is_submitting']),
-    in_reply_to: selectStatus(state)
-  };
-};
-
-const mapDispatchToProps = function (dispatch) {
-  return {
-    onChange: function (text) {
-      dispatch(changeCompose(text));
-    },
-
-    onSubmit: function () {
-      dispatch(submitCompose());
-    },
-
-    onCancelReply: function () {
-      dispatch(cancelReplyCompose());
-    }
-  }
-};
-
-export default connect(mapStateToProps, mapDispatchToProps)(ComposeForm);
diff --git a/app/assets/javascripts/components/containers/follow_form_container.jsx b/app/assets/javascripts/components/containers/follow_form_container.jsx
deleted file mode 100644
index b5f787aba..000000000
--- a/app/assets/javascripts/components/containers/follow_form_container.jsx
+++ /dev/null
@@ -1,24 +0,0 @@
-import { connect }                    from 'react-redux';
-import FollowForm                     from '../components/follow_form';
-import { changeFollow, submitFollow } from '../actions/follow';
-
-const mapStateToProps = function (state, props) {
-  return {
-    text: state.getIn(['follow', 'text']),
-    is_submitting: state.getIn(['follow', 'is_submitting'])
-  };
-};
-
-const mapDispatchToProps = function (dispatch) {
-  return {
-    onChange: function (text) {
-      dispatch(changeFollow(text));
-    },
-
-    onSubmit: function () {
-      dispatch(submitFollow());
-    }
-  }
-};
-
-export default connect(mapStateToProps, mapDispatchToProps)(FollowForm);
diff --git a/app/assets/javascripts/components/containers/root.jsx b/app/assets/javascripts/components/containers/mastodon.jsx
index e30330beb..ba6e568ac 100644
--- a/app/assets/javascripts/components/containers/root.jsx
+++ b/app/assets/javascripts/components/containers/mastodon.jsx
@@ -1,6 +1,5 @@
 import { Provider }                                                          from 'react-redux';
 import configureStore                                                        from '../store/configureStore';
-import Frontend                                                              from '../components/frontend';
 import { setTimeline, updateTimeline, deleteFromTimelines, refreshTimeline } from '../actions/timelines';
 import { setAccessToken }                                                    from '../actions/meta';
 import { setAccountSelf }                                                    from '../actions/accounts';
@@ -10,10 +9,11 @@ import Account                                                               fro
 import Settings                                                              from '../features/settings';
 import Status                                                                from '../features/status';
 import Subscriptions                                                         from '../features/subscriptions';
+import UI                                                                    from '../features/ui';
 
 const store = configureStore();
 
-const Root = React.createClass({
+const Mastodon = React.createClass({
 
   propTypes: {
     token: React.PropTypes.string.isRequired,
@@ -58,7 +58,7 @@ const Root = React.createClass({
     return (
       <Provider store={store}>
         <Router history={hashHistory}>
-          <Route path='/' component={Frontend}>
+          <Route path='/' component={UI}>
             <Route path='/settings' component={Settings} />
             <Route path='/subscriptions' component={Subscriptions} />
             <Route path='/statuses/:statusId' component={Status} />
@@ -71,4 +71,4 @@ const Root = React.createClass({
 
 });
 
-export default Root;
+export default Mastodon;
diff --git a/app/assets/javascripts/components/containers/navigation_container.jsx b/app/assets/javascripts/components/containers/navigation_container.jsx
deleted file mode 100644
index 4aeea4c37..000000000
--- a/app/assets/javascripts/components/containers/navigation_container.jsx
+++ /dev/null
@@ -1,8 +0,0 @@
-import { connect }   from 'react-redux';
-import NavigationBar from '../components/navigation_bar';
-
-const mapStateToProps = (state, props) => ({
-  account: state.getIn(['timelines', 'accounts', state.getIn(['timelines', 'me'])])
-});
-
-export default connect(mapStateToProps)(NavigationBar);
diff --git a/app/assets/javascripts/components/containers/notifications_container.jsx b/app/assets/javascripts/components/containers/notifications_container.jsx
deleted file mode 100644
index 68173b34e..000000000
--- a/app/assets/javascripts/components/containers/notifications_container.jsx
+++ /dev/null
@@ -1,25 +0,0 @@
-import { connect }             from 'react-redux';
-import { NotificationStack }   from 'react-notification';
-import { dismissNotification } from '../actions/notifications';
-
-const mapStateToProps = (state, props) => {
-  return {
-    notifications: state.get('notifications').map((item, i) => ({
-      message: item.get('message'),
-      title: item.get('title'),
-      key: i,
-      action: 'Dismiss',
-      dismissAfter: 5000
-    })).toJS()
-  };
-};
-
-const mapDispatchToProps = (dispatch) => {
-  return {
-    onDismiss: notifiction => {
-      dispatch(dismissNotification(notifiction));
-    }
-  };
-};
-
-export default connect(mapStateToProps, mapDispatchToProps)(NotificationStack);
diff --git a/app/assets/javascripts/components/containers/status_list_container.jsx b/app/assets/javascripts/components/containers/status_list_container.jsx
deleted file mode 100644
index a4fba95e1..000000000
--- a/app/assets/javascripts/components/containers/status_list_container.jsx
+++ /dev/null
@@ -1,29 +0,0 @@
-import { connect }           from 'react-redux';
-import StatusList            from '../components/status_list';
-import { replyCompose }      from '../actions/compose';
-import { reblog, favourite } from '../actions/interactions';
-import { selectStatus }      from '../reducers/timelines';
-
-const mapStateToProps = function (state, props) {
-  return {
-    statuses: state.getIn(['timelines', props.type]).map(id => selectStatus(state, id))
-  };
-};
-
-const mapDispatchToProps = function (dispatch) {
-  return {
-    onReply: function (status) {
-      dispatch(replyCompose(status));
-    },
-
-    onFavourite: function (status) {
-      dispatch(favourite(status));
-    },
-
-    onReblog: function (status) {
-      dispatch(reblog(status));
-    }
-  };
-};
-
-export default connect(mapStateToProps, mapDispatchToProps)(StatusList);
diff --git a/app/assets/javascripts/components/containers/upload_form_container.jsx b/app/assets/javascripts/components/containers/upload_form_container.jsx
deleted file mode 100644
index b168e8187..000000000
--- a/app/assets/javascripts/components/containers/upload_form_container.jsx
+++ /dev/null
@@ -1,25 +0,0 @@
-import { connect }                          from 'react-redux';
-import UploadForm                           from '../components/upload_form';
-import { uploadCompose, undoUploadCompose } from '../actions/compose';
-
-const mapStateToProps = function (state, props) {
-  return {
-    media: state.getIn(['compose', 'media_attachments']),
-    progress: state.getIn(['compose', 'progress']),
-    is_uploading: state.getIn(['compose', 'is_uploading'])
-  };
-};
-
-const mapDispatchToProps = function (dispatch) {
-  return {
-    onSelectFile: function (files) {
-      dispatch(uploadCompose(files));
-    },
-
-    onRemoveFile: function (media_id) {
-      dispatch(undoUploadCompose(media_id));
-    }
-  }
-};
-
-export default connect(mapStateToProps, mapDispatchToProps)(UploadForm);