- {user.username}
+ {username}
{previewEnabled
&&
@@ -218,15 +218,14 @@ NewPost.propTypes = {
topicID: PropTypes.number.isRequired,
postIndex: PropTypes.number.isRequired,
avatarUrl: PropTypes.string,
- user: PropTypes.object.isRequired,
+ username: PropTypes.string.isRequired,
onCancelClick: PropTypes.func.isRequired,
dispatch: PropTypes.func.isRequired,
onPostCreated: PropTypes.func.isRequired
};
const mapStateToProps = state => ({
- orbitDB: state.orbitDB,
- user: state.user
+ username: state.user.username
});
export default connect(mapStateToProps)(NewPost);
diff --git a/app/src/components/NewTopicPreview.js b/app/src/containers/NewTopicPreview.js
similarity index 100%
rename from app/src/components/NewTopicPreview.js
rename to app/src/containers/NewTopicPreview.js
diff --git a/app/src/components/Post.js b/app/src/containers/Post.js
similarity index 98%
rename from app/src/components/Post.js
rename to app/src/containers/Post.js
index 264269b..3c440e3 100644
--- a/app/src/components/Post.js
+++ b/app/src/containers/Post.js
@@ -74,10 +74,10 @@ class Post extends Component {
}
async fetchPost(postID) {
- const { user, postData, orbitDB } = this.props;
+ const { address, postData, orbitDB } = this.props;
let orbitPostData;
- if (postData.value[1] === user.address) {
+ if (postData.value[1] === address) {
orbitPostData = orbitDB.postsDB.get(postID);
} else {
const fullAddress = `/orbitdb/${postData.value[0]}/posts`;
@@ -288,7 +288,7 @@ class Post extends Component {
Post.propTypes = {
getFocus: PropTypes.bool.isRequired,
- user: PropTypes.object.isRequired,
+ address: PropTypes.string.isRequired,
orbitDB: PropTypes.object.isRequired,
avatarUrl: PropTypes.string,
postIndex: PropTypes.number.isRequired,
@@ -302,7 +302,7 @@ const mapDispatchToProps = dispatch => bindActionCreators({
}, dispatch);
const mapStateToProps = state => ({
- user: state.user,
+ address: state.user.address,
orbitDB: state.orbit
});
diff --git a/app/src/components/PostList.js b/app/src/containers/PostList.js
similarity index 100%
rename from app/src/components/PostList.js
rename to app/src/containers/PostList.js
diff --git a/app/src/containers/ProfileContainer.js b/app/src/containers/ProfileContainer.js
index f7ca4f0..0c6da08 100644
--- a/app/src/containers/ProfileContainer.js
+++ b/app/src/containers/ProfileContainer.js
@@ -6,9 +6,9 @@ import { connect } from 'react-redux';
import { Tab } from 'semantic-ui-react';
import { drizzle } from '../index';
-import ProfileInformation from '../components/ProfileInformation';
-import TopicList from '../components/TopicList';
-import PostList from '../components/PostList';
+import ProfileInformation from './ProfileInformation';
+import TopicList from './TopicList';
+import PostList from './PostList';
import LoadingSpinner from '../components/LoadingSpinner';
import { setNavBarTitle } from '../redux/actions/userInterfaceActions';
@@ -214,8 +214,7 @@ const mapDispatchToProps = dispatch => bindActionCreators({
const mapStateToProps = state => ({
user: state.user,
drizzleStatus: state.drizzleStatus,
- contracts: state.contracts,
- orbitDB: state.orbitDB
+ contracts: state.contracts
});
export default connect(mapStateToProps, mapDispatchToProps)(ProfileContainer);
diff --git a/app/src/components/ProfileInformation.js b/app/src/containers/ProfileInformation.js
similarity index 97%
rename from app/src/components/ProfileInformation.js
rename to app/src/containers/ProfileInformation.js
index 6efae66..92267e3 100644
--- a/app/src/components/ProfileInformation.js
+++ b/app/src/containers/ProfileInformation.js
@@ -6,7 +6,7 @@ import { drizzle } from '../index';
import epochTimeConverter from '../helpers/EpochTimeConverter';
-import UsernameFormContainer from '../containers/UsernameFormContainer';
+import UsernameFormContainer from './UsernameFormContainer';
const callsInfo = [
{
@@ -189,8 +189,7 @@ ProfileInformation.propTypes = {
const mapStateToProps = state => ({
drizzleStatus: state.drizzleStatus,
- contracts: state.contracts,
- user: state.user
+ contracts: state.contracts
});
export default connect(mapStateToProps)(ProfileInformation);
diff --git a/app/src/containers/StartTopicContainer.js b/app/src/containers/StartTopicContainer.js
index 195e410..7e01e1d 100644
--- a/app/src/containers/StartTopicContainer.js
+++ b/app/src/containers/StartTopicContainer.js
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { Button, Form, Icon, TextArea } from 'semantic-ui-react';
-import NewTopicPreview from '../components/NewTopicPreview';
+import NewTopicPreview from './NewTopicPreview';
import { createTopic } from '../redux/actions/transactionsActions';
@@ -77,9 +77,9 @@ class StartTopicContainer extends Component {
previewDate, previewEnabled, topicSubjectInputEmptySubmit, topicSubjectInput,
topicMessageInputEmptySubmit, topicMessageInput
} = this.state;
- const { user, history } = this.props;
+ const { hasSignedUp, history } = this.props;
- if (!user.hasSignedUp) {
+ if (!hasSignedUp) {
history.push('/signup');
return (null);
}
@@ -156,12 +156,11 @@ class StartTopicContainer extends Component {
StartTopicContainer.propTypes = {
dispatch: PropTypes.func.isRequired,
history: PropTypes.object.isRequired,
- user: PropTypes.object.isRequired
+ hasSignedUp: PropTypes.bool.isRequired
};
const mapStateToProps = state => ({
- orbitDB: state.orbitDB,
- user: state.user
+ hasSignedUp: state.user.hasSignedUp
});
export default connect(mapStateToProps)(StartTopicContainer);
diff --git a/app/src/components/Topic.js b/app/src/containers/Topic.js
similarity index 100%
rename from app/src/components/Topic.js
rename to app/src/containers/Topic.js
diff --git a/app/src/containers/TopicContainer.js b/app/src/containers/TopicContainer.js
index 29c0fe9..ead4599 100644
--- a/app/src/containers/TopicContainer.js
+++ b/app/src/containers/TopicContainer.js
@@ -5,8 +5,8 @@ import { push } from 'connected-react-router';
import { connect } from 'react-redux';
import { drizzle } from '../index';
-import PostList from '../components/PostList';
-import NewPost from '../components/NewPost';
+import PostList from './PostList';
+import NewPost from './NewPost';
import FloatingButton from '../components/FloatingButton';
import { setNavBarTitle } from '../redux/actions/userInterfaceActions.js';
diff --git a/app/src/components/TopicList.js b/app/src/containers/TopicList.js
similarity index 100%
rename from app/src/components/TopicList.js
rename to app/src/containers/TopicList.js
diff --git a/app/src/router/routes.js b/app/src/router/routes.js
index a20d646..b923bba 100644
--- a/app/src/router/routes.js
+++ b/app/src/router/routes.js
@@ -1,7 +1,7 @@
import React from 'react';
import { Redirect, Route, Switch } from 'react-router-dom';
-import CoreLayoutContainer from '../containers/CoreLayoutContainer';
-import HomeContainer from '../containers/HomeContainer';
+import CoreLayoutContainer from '../components/CoreLayoutContainer';
+import HomeContainer from '../components/HomeContainer';
import SignUpContainer from '../containers/SignUpContainer';
import StartTopicContainer from '../containers/StartTopicContainer';
import TopicContainer from '../containers/TopicContainer';