+
);
diff --git a/src/components/Topic.js b/src/components/Topic.js
index befb9a1..7e5432c 100644
--- a/src/components/Topic.js
+++ b/src/components/Topic.js
@@ -1,5 +1,4 @@
import React, { Component } from 'react';
-import { Link } from 'react-router';
import { drizzleConnect } from 'drizzle-react';
import PropTypes from 'prop-types';
diff --git a/src/containers/BoardContainer.js b/src/containers/BoardContainer.js
index cb625e5..ba040f5 100644
--- a/src/containers/BoardContainer.js
+++ b/src/containers/BoardContainer.js
@@ -1,7 +1,9 @@
-import { drizzleConnect } from 'drizzle-react';
import React, { Component } from 'react';
+import { drizzleConnect } from 'drizzle-react';
import PropTypes from 'prop-types';
+import { Header } from 'semantic-ui-react';
+
import WithBlockchainData from '../components/WithBlockchainData';
import TopicList from '../components/TopicList';
import FloatingButton from '../components/FloatingButton';
@@ -24,16 +26,43 @@ class Board extends Component {
boardContents = (
);
- } else {
+ } else if (this.props.blockchainData[0].returnData !== '0'){
this.topicIDs = [];
for (var i = 0; i < this.props.blockchainData[0].returnData; i++) {
this.topicIDs.push(i);
}
boardContents = ([
,
-
+ this.props.user.hasSignedUp &&
+
]);
+ } else {
+ if (!this.props.user.hasSignedUp){
+ boardContents = (
+
+
+ There are no topics yet!
+
+
+ Sign up to be the first post.
+
+
+ );
+ } else {
+ boardContents = (
+
+
+ There are no topics yet!
+
+
+ Click the add button at the bottom of the page to be the first to post.
+
+
+
+ );
+ }
}
return (
diff --git a/src/containers/HomeContainer.js b/src/containers/HomeContainer.js
index 38e48a9..71e1df8 100644
--- a/src/containers/HomeContainer.js
+++ b/src/containers/HomeContainer.js
@@ -1,16 +1,26 @@
import { drizzleConnect } from 'drizzle-react';
import React, { Component } from 'react';
-import SignUpContainer from './SignUpContainer';
+
import BoardContainer from './BoardContainer';
class Home extends Component {
render() {
- //This must change to routes and redirects
- const view = this.props.user.hasSignedUp
- ? (
) //This may become multiple boards
- : (
);
+ //We can add a modal to tell the user to sign up
+
+ /*var modal = this.props.user.hasSignedUp && (
+
+ Select a Photo
+
+
+
+
+ We've found the following gravatar image associated with your e-mail address.
+ Is it okay to use this photo?
+
+
+ );*/
- return (view);
+ return (
);
}
}
diff --git a/src/containers/LoadingContainer.js b/src/containers/LoadingContainer.js
index d1909c7..d07afc7 100644
--- a/src/containers/LoadingContainer.js
+++ b/src/containers/LoadingContainer.js
@@ -1,13 +1,9 @@
-import { drizzleConnect } from 'drizzle-react'
-import React, { Children, Component } from 'react'
-import PropTypes from 'prop-types'
+import { drizzleConnect } from 'drizzle-react';
+import React, { Children, Component } from 'react';
+import PropTypes from 'prop-types';
import ipfs_logo from './../resources/ipfs_logo.png';
-/*
- * Create component.
- */
-
class LoadingContainer extends Component {
render() {
if (this.props.web3.status === 'failed')
@@ -80,10 +76,6 @@ LoadingContainer.contextTypes = {
drizzle: PropTypes.object
};
-/*
- * Export connected component.
- */
-
const mapStateToProps = state => {
return {
accounts: state.accounts,
diff --git a/src/containers/PrivateRouteContainer.js b/src/containers/PrivateRouteContainer.js
deleted file mode 100644
index 7895b43..0000000
--- a/src/containers/PrivateRouteContainer.js
+++ /dev/null
@@ -1,25 +0,0 @@
-import React from 'react';
-import { drizzleConnect } from 'drizzle-react';
-import { Route } from "react-router";
-import { Redirect } from "react-router-dom";
-
-const PrivateRoute = (props) => {
- return (
- props.user.hasSignedUp
- ?
- :
- );
-};
-
-const mapStateToProps = state => {
- return {
- user: state.user
- }
-};
-
-const PrivateRouteContainer = drizzleConnect(PrivateRoute, mapStateToProps);
-
-export default PrivateRouteContainer;
\ No newline at end of file
diff --git a/src/containers/ProfileContainer.js b/src/containers/ProfileContainer.js
index ff60493..3399531 100644
--- a/src/containers/ProfileContainer.js
+++ b/src/containers/ProfileContainer.js
@@ -1,6 +1,5 @@
import { drizzleConnect } from 'drizzle-react';
import React, { Component } from 'react';
-import ReactDOM from 'react-dom';
import PropTypes from 'prop-types';
import { Tab } from 'semantic-ui-react'
@@ -25,6 +24,11 @@ class Profile extends Component {
}
render() {
+ if (!this.props.user.hasSignedUp) {
+ this.context.router.push("/signup");
+ return(null);
+ }
+
this.propsToView();
var infoTab =
(
{
diff --git a/src/containers/SignUpContainer.js b/src/containers/SignUpContainer.js
index 806ef9b..c4ec30f 100644
--- a/src/containers/SignUpContainer.js
+++ b/src/containers/SignUpContainer.js
@@ -2,18 +2,29 @@ import { drizzleConnect } from 'drizzle-react';
import React, { Component } from 'react';
import UsernameFormContainer from './UsernameFormContainer';
+import { Header } from 'semantic-ui-react';
+
class SignUp extends Component {
render() {
return (
-
-
-
Sign Up
-
- Account address: {this.props.user.address}
-
-
-
-
+ this.props.user.hasSignedUp
+ ?(
+
+ There is already an account for this addresss.
+
+
+ If you want to create another account please change your address.
+
+
)
+ :(
+
+
Sign Up
+
+ Account address: {this.props.user.address}
+
+
+
+
)
);
}
}
diff --git a/src/containers/StartTopicContainer.js b/src/containers/StartTopicContainer.js
index 12cb42c..3e67f49 100644
--- a/src/containers/StartTopicContainer.js
+++ b/src/containers/StartTopicContainer.js
@@ -89,6 +89,11 @@ class StartTopic extends Component {
}
render() {
+ if (!this.props.user.hasSignedUp) {
+ this.context.router.push("/signup");
+ return(null);
+ }
+
var previewEditText = this.state.previewEnabled ? "Edit" : "Preview";
return (
@@ -296,7 +301,8 @@ class StartTopic extends Component {
}
StartTopic.contextTypes = {
- drizzle: PropTypes.object
+ drizzle: PropTypes.object,
+ router: PropTypes.object
};
const mapStateToProps = state => {
diff --git a/src/containers/TopicContainer.js b/src/containers/TopicContainer.js
index aa2234e..88001ee 100644
--- a/src/containers/TopicContainer.js
+++ b/src/containers/TopicContainer.js
@@ -75,7 +75,7 @@ class Topic extends Component {
onPostCreated={() => {this.postCreated()}}
/>
}
- {!this.state.posting &&
+ {this.props.user.hasSignedUp && !this.state.posting &&
}
)
diff --git a/src/containers/UsernameFormContainer.js b/src/containers/UsernameFormContainer.js
index ae2b5a7..d38eee8 100644
--- a/src/containers/UsernameFormContainer.js
+++ b/src/containers/UsernameFormContainer.js
@@ -1,9 +1,9 @@
-import React, { Component } from 'react'
-import { drizzleConnect } from 'drizzle-react'
-import PropTypes from 'prop-types'
+import React, { Component } from 'react';
+import { drizzleConnect } from 'drizzle-react';
+import PropTypes from 'prop-types';
-import { Button, Message, Form, Dimmer, Loader, Header } from 'semantic-ui-react'
-import { createDatabases } from './../util/orbit'
+import { Button, Message, Form, Dimmer, Loader, Header } from 'semantic-ui-react';
+import { createDatabases } from './../util/orbit';
const contract = "Forum";
const signUpMethod = "signUp";
diff --git a/src/index.js b/src/index.js
index b551365..972ba1c 100644
--- a/src/index.js
+++ b/src/index.js
@@ -1,6 +1,6 @@
import React from 'react';
import { render } from 'react-dom';
-import { Router, IndexRoute, browserHistory } from 'react-router';
+import { Router, IndexRedirect, browserHistory } from 'react-router';
import { Route } from 'react-router-dom';
import { syncHistoryWithStore } from 'react-router-redux';
import { DrizzleProvider } from 'drizzle-react';
@@ -10,8 +10,7 @@ import CoreLayout from './layouts/CoreLayout/CoreLayout';
// Containers
import LoadingContainer from './containers/LoadingContainer';
-import PrivateRouteContainer from './containers/PrivateRouteContainer';
-
+import SignUpContainer from './containers/SignUpContainer';
import HomeContainer from './containers/HomeContainer';
import TopicContainer from './containers/TopicContainer';
import StartTopicContainer from './containers/StartTopicContainer';
@@ -31,7 +30,11 @@ render((
-
+
+
+
),
document.getElementById('root')
-);
-
-/*
-
- */
\ No newline at end of file
+);
\ No newline at end of file
diff --git a/src/layouts/CoreLayout/CoreLayout.js b/src/layouts/CoreLayout/CoreLayout.js
index bcf16c1..41127e2 100644
--- a/src/layouts/CoreLayout/CoreLayout.js
+++ b/src/layouts/CoreLayout/CoreLayout.js
@@ -6,7 +6,6 @@ import '../../assets/fonts/fontawesome-free-5.0.13/fontawesome-all.js';
import '../../assets/css/App.css';
import '../../assets/css/loading-container.css';
import '../../assets/css/sign-up-container.css';
-import '../../assets/css/navbar.css';
import '../../assets/css/board-container.css';
import '../../assets/css/start-topic-container.css';