mirror of https://gitlab.com/ecentrics/concordia
Ezerous
6 years ago
56 changed files with 12421 additions and 4324 deletions
@ -0,0 +1,15 @@ |
|||||
|
{ |
||||
|
"rules": { |
||||
|
"comma-dangle": ["error", "never"], |
||||
|
"no-console": "off", |
||||
|
"no-unused-vars": "warn", |
||||
|
"object-curly-newline": ["error", { |
||||
|
"ObjectExpression": "always", |
||||
|
"ObjectPattern": { "multiline": true }, |
||||
|
"ImportDeclaration": "never", |
||||
|
"ExportDeclaration": "never" |
||||
|
}], |
||||
|
"object-curly-spacing": ["error", "always"] |
||||
|
}, |
||||
|
"extends": "airbnb" |
||||
|
} |
@ -0,0 +1 @@ |
|||||
|
# node_modules in the project root is ignored by default |
@ -0,0 +1,3 @@ |
|||||
|
{ |
||||
|
"extends": "plugin:react/recommended" |
||||
|
} |
@ -0,0 +1 @@ |
|||||
|
node_modules/* |
File diff suppressed because one or more lines are too long
@ -1,14 +1,12 @@ |
|||||
import React from 'react'; |
import React from 'react'; |
||||
import { Button, Icon } from 'semantic-ui-react' |
import { Button, Icon } from 'semantic-ui-react'; |
||||
|
|
||||
const FloatingButton = (props) => { |
const FloatingButton = props => ( |
||||
return ( |
|
||||
<div className="action-button" onClick={props.onClick}> |
<div className="action-button" onClick={props.onClick}> |
||||
<Button icon color='teal' size='large'> |
<Button icon color="teal" size="large"> |
||||
<Icon name='add'/> |
<Icon name="add" /> |
||||
</Button> |
</Button> |
||||
</div> |
</div> |
||||
); |
); |
||||
}; |
|
||||
|
|
||||
export default FloatingButton; |
export default FloatingButton; |
@ -1,16 +1,17 @@ |
|||||
import React from 'react'; |
import React from 'react'; |
||||
|
|
||||
const LoadingSpinner = (props) => { |
const LoadingSpinner = props => ( |
||||
return( |
|
||||
<div className="vertical-center-children"> |
<div className="vertical-center-children"> |
||||
<div className={"center-in-parent " + (props.className ? props.className : "")} |
<div |
||||
style={props.style ? props.style : []}> |
className={`center-in-parent ${ |
||||
|
props.className ? props.className : ''}`}
|
||||
|
style={props.style ? props.style : []} |
||||
|
> |
||||
<p> |
<p> |
||||
<i className="fas fa-spinner fa-3x fa-spin"></i> |
<i className="fas fa-spinner fa-3x fa-spin" /> |
||||
</p> |
</p> |
||||
</div> |
</div> |
||||
</div> |
</div> |
||||
); |
); |
||||
} |
|
||||
|
|
||||
export default LoadingSpinner; |
export default LoadingSpinner; |
@ -1,12 +1,13 @@ |
|||||
import React from 'react'; |
import React from 'react'; |
||||
import pageNotFound from '../assets/images/PageNotFound.jpg'; |
import pageNotFound from '../assets/images/PageNotFound.jpg'; |
||||
|
|
||||
const NotFound = () => { |
const NotFound = () => ( |
||||
return ( |
<div style={{ |
||||
<div style={{textAlign: "center"}}> |
textAlign: 'center' |
||||
<img src={pageNotFound} alt="Page not found!"/> |
}} |
||||
|
> |
||||
|
<img src={pageNotFound} alt="Page not found!" /> |
||||
</div> |
</div> |
||||
); |
); |
||||
}; |
|
||||
|
|
||||
export default NotFound; |
export default NotFound; |
@ -1,43 +1,46 @@ |
|||||
import React, { Component } from 'react'; |
import React, { Component } from 'react'; |
||||
|
|
||||
import { Header } from 'semantic-ui-react'; |
import { Header } from 'semantic-ui-react'; |
||||
import {connect} from "react-redux"; |
import { connect } from 'react-redux'; |
||||
import UsernameFormContainer from './UsernameFormContainer'; |
import UsernameFormContainer from './UsernameFormContainer'; |
||||
|
|
||||
class SignUpContainer extends Component { |
class SignUpContainer extends Component { |
||||
componentDidUpdate(prevProps) { |
componentDidUpdate(prevProps) { |
||||
if (this.props.user.hasSignedUp && !prevProps.user.hasSignedUp) |
if (this.props.user.hasSignedUp && !prevProps.user.hasSignedUp) this.props.history.push('/'); |
||||
this.props.history.push("/"); |
|
||||
} |
} |
||||
|
|
||||
render() { |
render() { |
||||
return ( |
return ( |
||||
this.props.user.hasSignedUp |
this.props.user.hasSignedUp |
||||
?(<div className="vertical-center-in-parent"> |
? ( |
||||
<Header color='teal' textAlign='center' as='h2'> |
<div className="vertical-center-in-parent"> |
||||
|
<Header color="teal" textAlign="center" as="h2"> |
||||
There is already an account for this addresss. |
There is already an account for this addresss. |
||||
</Header> |
</Header> |
||||
<Header color='teal' textAlign='center' as='h4'> |
<Header color="teal" textAlign="center" as="h4"> |
||||
If you want to create another account please change your address. |
If you want to create another account please change your address. |
||||
</Header> |
</Header> |
||||
</div>) |
</div> |
||||
:(<div className="sign-up-container"> |
) |
||||
|
: ( |
||||
|
<div className="sign-up-container"> |
||||
<div> |
<div> |
||||
<h1>Sign Up</h1> |
<h1>Sign Up</h1> |
||||
<p className="no-margin"> |
<p className="no-margin"> |
||||
<strong>Account address:</strong> {this.props.user.address} |
<strong>Account address:</strong> |
||||
|
{' '} |
||||
|
{this.props.user.address} |
||||
</p> |
</p> |
||||
<UsernameFormContainer /> |
<UsernameFormContainer /> |
||||
</div> |
</div> |
||||
</div>) |
</div> |
||||
|
) |
||||
); |
); |
||||
} |
} |
||||
} |
} |
||||
|
|
||||
const mapStateToProps = state => { |
const mapStateToProps = state => ({ |
||||
return { |
|
||||
user: state.user |
user: state.user |
||||
} |
}); |
||||
}; |
|
||||
|
|
||||
export default connect(mapStateToProps)(SignUpContainer); |
export default connect(mapStateToProps)(SignUpContainer); |
||||
|
@ -1,12 +1,12 @@ |
|||||
const epochTimeConverter = (timestamp) => { |
const epochTimeConverter = (timestamp) => { |
||||
var timestampDate = new Date(0); |
const timestampDate = new Date(0); |
||||
timestampDate.setUTCSeconds(timestamp); |
timestampDate.setUTCSeconds(timestamp); |
||||
return ((timestampDate.getMonth() + 1) + " " |
return (`${timestampDate.getMonth() + 1} ${ |
||||
+ timestampDate.getDate() + ", " |
timestampDate.getDate()}, ${ |
||||
+ timestampDate.getFullYear() + ", " |
timestampDate.getFullYear()}, ${ |
||||
+ timestampDate.getHours() + ":" |
timestampDate.getHours()}:${ |
||||
+ timestampDate.getMinutes() + ":" |
timestampDate.getMinutes()}:${ |
||||
+ timestampDate.getSeconds()) |
timestampDate.getSeconds()}`);
|
||||
} |
}; |
||||
|
|
||||
export default epochTimeConverter; |
export default epochTimeConverter; |
@ -1,14 +1,14 @@ |
|||||
import { combineReducers } from 'redux'; |
import { combineReducers } from 'redux'; |
||||
import { drizzleReducers } from 'drizzle'; |
import { drizzleReducers } from 'drizzle'; |
||||
import { connectRouter } from 'connected-react-router' |
import { connectRouter } from 'connected-react-router'; |
||||
import userReducer from './userReducer'; |
import userReducer from './userReducer'; |
||||
import orbitReducer from './orbitReducer'; |
import orbitReducer from './orbitReducer'; |
||||
import userInterfaceReducer from './userInterfaceReducer'; |
import userInterfaceReducer from './userInterfaceReducer'; |
||||
|
|
||||
export default (history) => combineReducers({ |
export default history => combineReducers({ |
||||
router: connectRouter(history), |
router: connectRouter(history), |
||||
user: userReducer, |
user: userReducer, |
||||
orbit: orbitReducer, |
orbit: orbitReducer, |
||||
interface: userInterfaceReducer, |
interface: userInterfaceReducer, |
||||
...drizzleReducers |
...drizzleReducers |
||||
}) |
}); |
||||
|
@ -1,38 +1,37 @@ |
|||||
import { getContractInstance, getWeb3 } from "../../utils/drizzleUtils"; |
import { call, put, select, takeLatest } from 'redux-saga/effects'; |
||||
import { call, put, takeLatest, select } from 'redux-saga/effects' |
import { getContractInstance, getWeb3 } from '../../utils/drizzleUtils'; |
||||
|
|
||||
import Forum from '../../contracts/Forum'; |
import Forum from '../../contracts/Forum'; |
||||
import { DRIZZLE_UTILS_SAGA_INITIALIZED } from "../actions/drizzleUtilsActions"; |
import { DRIZZLE_UTILS_SAGA_INITIALIZED } from '../actions/drizzleUtilsActions'; |
||||
|
|
||||
|
const accounts = state => state.accounts; |
||||
const accounts = (state) => state.accounts; |
let initFlag; let web3; let |
||||
let initFlag, web3, contract; |
contract; |
||||
|
|
||||
function* init() { |
function* init() { |
||||
if(!initFlag) { |
if (!initFlag) { |
||||
web3 = yield call(getWeb3); |
web3 = yield call(getWeb3); |
||||
contract = yield call(getContractInstance,{ |
contract = yield call(getContractInstance, { |
||||
web3: web3, |
web3, artifact: Forum |
||||
artifact: Forum |
}); |
||||
|
initFlag = true; |
||||
|
yield put({ |
||||
|
type: DRIZZLE_UTILS_SAGA_INITIALIZED, ...[] |
||||
}); |
}); |
||||
initFlag=true; |
} else console.warn('Attempted to reinitialize drizzleUtilsSaga!'); |
||||
yield put({type: DRIZZLE_UTILS_SAGA_INITIALIZED, ...[]}); |
|
||||
} |
|
||||
else |
|
||||
console.warn("Attempted to reinitialize drizzleUtilsSaga!"); |
|
||||
} |
} |
||||
|
|
||||
// If the method below proves to be problematic/ineffective (i.e. getting current account
|
// If the method below proves to be problematic/ineffective (i.e. getting current account
|
||||
// from state), consider getting it from @drizzle-utils/get-accounts instead
|
// from state), consider getting it from @drizzle-utils/get-accounts instead
|
||||
// with (yield call(getAccounts, {web3}))[0];
|
// with (yield call(getAccounts, {web3}))[0];
|
||||
function* getCurrentAccount(){ |
function* getCurrentAccount() { |
||||
return (yield select(accounts))[0]; |
return (yield select(accounts))[0]; |
||||
} |
} |
||||
|
|
||||
function* drizzleUtilsSaga() { |
function* drizzleUtilsSaga() { |
||||
yield takeLatest("DRIZZLE_INITIALIZED", init); |
yield takeLatest('DRIZZLE_INITIALIZED', init); |
||||
} |
} |
||||
|
|
||||
export { web3, contract, getCurrentAccount } |
export { web3, contract, getCurrentAccount }; |
||||
|
|
||||
export default drizzleUtilsSaga; |
export default drizzleUtilsSaga; |
||||
|
@ -1,13 +1,18 @@ |
|||||
import { all, fork } from 'redux-saga/effects' |
import { all, fork } from 'redux-saga/effects'; |
||||
import { drizzleSagas } from 'drizzle' |
import { drizzleSagas } from 'drizzle'; |
||||
import drizzleUtilsSaga from './drizzleUtilsSaga' |
import drizzleUtilsSaga from './drizzleUtilsSaga'; |
||||
import userSaga from './userSaga'; |
import userSaga from './userSaga'; |
||||
import orbitSaga from "./orbitSaga"; |
import orbitSaga from './orbitSaga'; |
||||
import transactionsSaga from "./transactionsSaga"; |
import transactionsSaga from './transactionsSaga'; |
||||
|
|
||||
export default function* root() { |
export default function* root() { |
||||
let sagas = [...drizzleSagas, drizzleUtilsSaga, orbitSaga, userSaga, transactionsSaga]; |
const sagas = [ |
||||
|
...drizzleSagas, |
||||
|
drizzleUtilsSaga, |
||||
|
orbitSaga, |
||||
|
userSaga, |
||||
|
transactionsSaga]; |
||||
yield all( |
yield all( |
||||
sagas.map(saga => fork(saga)) |
sagas.map(saga => fork(saga)), |
||||
) |
); |
||||
} |
} |
@ -1,73 +1,81 @@ |
|||||
import {call, select, take, takeEvery} from 'redux-saga/effects' |
import { call, select, take, takeEvery } from 'redux-saga/effects'; |
||||
|
|
||||
import { drizzle } from '../../index' |
import { drizzle } from '../../index'; |
||||
import { orbitSagaPut } from '../../utils/orbitUtils' |
import { orbitSagaPut } from '../../utils/orbitUtils'; |
||||
import { DRIZZLE_UTILS_SAGA_INITIALIZED } from '../actions/drizzleUtilsActions'; |
import { DRIZZLE_UTILS_SAGA_INITIALIZED } from '../actions/drizzleUtilsActions'; |
||||
|
|
||||
let transactionsHistory = Object.create(null); |
const transactionsHistory = Object.create(null); |
||||
|
|
||||
function* initTransaction(action) { |
function* initTransaction(action) { |
||||
var dataKey = drizzle.contracts[action.transactionDescriptor.contract] |
const dataKey = drizzle.contracts[action.transactionDescriptor.contract].methods[action.transactionDescriptor.method].cacheSend( |
||||
.methods[action.transactionDescriptor['method']] |
...(action.transactionDescriptor.params), |
||||
.cacheSend(...(action.transactionDescriptor.params)); |
); |
||||
|
|
||||
transactionsHistory[dataKey] = action; |
transactionsHistory[dataKey] = action; |
||||
transactionsHistory[dataKey].state = 'initialized'; |
transactionsHistory[dataKey].state = 'initialized'; |
||||
} |
} |
||||
|
|
||||
function* handleEvent(action) { |
function* handleEvent(action) { |
||||
var transactionStack = yield select((state) => state.transactionStack); |
const transactionStack = yield select(state => state.transactionStack); |
||||
var dataKey = transactionStack.indexOf(action.event.transactionHash); |
const dataKey = transactionStack.indexOf(action.event.transactionHash); |
||||
|
|
||||
switch(action.event.event) { |
switch (action.event.event) { |
||||
case 'TopicCreated': |
case 'TopicCreated': |
||||
if (dataKey !== -1 && |
if (dataKey !== -1 |
||||
transactionsHistory[dataKey] && |
&& transactionsHistory[dataKey] |
||||
transactionsHistory[dataKey].state === 'initialized') { |
&& transactionsHistory[dataKey].state === 'initialized') { |
||||
transactionsHistory[dataKey].state = 'success'; |
transactionsHistory[dataKey].state = 'success'; |
||||
//Gets orbit
|
// Gets orbit
|
||||
const orbit = yield select((state) => state.orbit); |
const orbit = yield select(state => state.orbit); |
||||
//And saves the topic
|
// And saves the topic
|
||||
yield call(orbitSagaPut, orbit.topicsDB, action.event.returnValues.topicID, |
yield call(orbitSagaPut, orbit.topicsDB, |
||||
{ subject: transactionsHistory[dataKey].userInputs.topicSubject }); |
action.event.returnValues.topicID, |
||||
yield call(orbitSagaPut, orbit.postsDB, action.event.returnValues.postID, |
{ |
||||
{ subject: transactionsHistory[dataKey].userInputs.topicSubject, |
subject: transactionsHistory[dataKey].userInputs.topicSubject |
||||
content: transactionsHistory[dataKey].userInputs.topicMessage }); |
}); |
||||
|
yield call(orbitSagaPut, orbit.postsDB, |
||||
|
action.event.returnValues.postID, |
||||
|
{ |
||||
|
subject: transactionsHistory[dataKey].userInputs.topicSubject, |
||||
|
content: transactionsHistory[dataKey].userInputs.topicMessage |
||||
|
}); |
||||
} |
} |
||||
break; |
break; |
||||
case 'PostCreated': |
case 'PostCreated': |
||||
if (dataKey !== -1 && |
if (dataKey !== -1 |
||||
transactionsHistory[dataKey] && |
&& transactionsHistory[dataKey] |
||||
transactionsHistory[dataKey].state === 'initialized') { |
&& transactionsHistory[dataKey].state === 'initialized') { |
||||
transactionsHistory[dataKey].state = 'success'; |
transactionsHistory[dataKey].state = 'success'; |
||||
//Gets orbit
|
// Gets orbit
|
||||
const orbit = yield select((state) => state.orbit); |
const orbit = yield select(state => state.orbit); |
||||
//And saves the topic
|
// And saves the topic
|
||||
yield call(orbitSagaPut, orbit.postsDB, action.event.returnValues.postID, |
yield call(orbitSagaPut, orbit.postsDB, |
||||
{subject: transactionsHistory[dataKey].userInputs.postSubject, |
action.event.returnValues.postID, |
||||
content: transactionsHistory[dataKey].userInputs.postMessage }); |
{ |
||||
|
subject: transactionsHistory[dataKey].userInputs.postSubject, |
||||
|
content: transactionsHistory[dataKey].userInputs.postMessage |
||||
|
}); |
||||
} |
} |
||||
break; |
break; |
||||
default: |
default: |
||||
//Nothing to do here
|
// Nothing to do here
|
||||
return; |
|
||||
} |
} |
||||
} |
} |
||||
|
|
||||
function* handleError() { |
function* handleError() { |
||||
var transactionStack = yield select((state) => state.transactionStack); |
const transactionStack = yield select(state => state.transactionStack); |
||||
transactionStack.forEach((transaction, index) => { |
transactionStack.forEach((transaction, index) => { |
||||
if (transaction.startsWith('TEMP_')) { |
if (transaction.startsWith('TEMP_')) { |
||||
transactionsHistory[index].state = 'error'; |
transactionsHistory[index].state = 'error'; |
||||
} |
} |
||||
}) |
}); |
||||
} |
} |
||||
|
|
||||
function* transactionsSaga() { |
function* transactionsSaga() { |
||||
yield take(DRIZZLE_UTILS_SAGA_INITIALIZED); |
yield take(DRIZZLE_UTILS_SAGA_INITIALIZED); |
||||
yield takeEvery("INIT_TRANSACTION", initTransaction); |
yield takeEvery('INIT_TRANSACTION', initTransaction); |
||||
yield takeEvery("EVENT_FIRED", handleEvent); |
yield takeEvery('EVENT_FIRED', handleEvent); |
||||
yield takeEvery("TX_ERROR", handleError); |
yield takeEvery('TX_ERROR', handleError); |
||||
} |
} |
||||
|
|
||||
export default transactionsSaga; |
export default transactionsSaga; |
||||
|
@ -1,53 +1,61 @@ |
|||||
import {call, put, select, take, takeEvery} from 'redux-saga/effects' |
import { call, put, select, take, takeEvery } from 'redux-saga/effects'; |
||||
|
|
||||
import { contract, getCurrentAccount } from './drizzleUtilsSaga'; |
import { contract, getCurrentAccount } from './drizzleUtilsSaga'; |
||||
import { DRIZZLE_UTILS_SAGA_INITIALIZED } from "../actions/drizzleUtilsActions"; |
import { DRIZZLE_UTILS_SAGA_INITIALIZED } from '../actions/drizzleUtilsActions'; |
||||
|
|
||||
let account; |
let account; |
||||
|
|
||||
function* updateUserData() { |
function* updateUserData() { |
||||
const currentAccount = yield call(getCurrentAccount); |
const currentAccount = yield call(getCurrentAccount); |
||||
if(currentAccount!==account) { |
if (currentAccount !== account) { |
||||
account = currentAccount; |
account = currentAccount; |
||||
yield put({type: 'ACCOUNT_CHANGED', ...[]}); |
yield put({ |
||||
|
type: 'ACCOUNT_CHANGED', ...[] |
||||
|
}); |
||||
} |
} |
||||
const txObj1 = yield call(contract.methods["hasUserSignedUp"], ...[account]); |
const txObj1 = yield call(contract.methods.hasUserSignedUp, ...[account]); |
||||
try { |
try { |
||||
const userState = yield call(getUserState); |
const userState = yield call(getUserState); |
||||
const callResult = yield call(txObj1.call, {address:account}); |
const callResult = yield call(txObj1.call, { |
||||
if(callResult) { |
address: account |
||||
const txObj2 = yield call(contract.methods["getUsername"], ...[account]); |
}); |
||||
const username = yield call(txObj2.call, {address:account}); |
if (callResult) { |
||||
if(account!==userState.address || username!==userState.username){ |
const txObj2 = yield call(contract.methods.getUsername, ...[account]); |
||||
|
const username = yield call(txObj2.call, { |
||||
|
address: account |
||||
|
}); |
||||
|
if (account !== userState.address || username !== userState.username) { |
||||
const dispatchArgs = { |
const dispatchArgs = { |
||||
address: account, |
address: account, |
||||
username: username |
username |
||||
}; |
}; |
||||
yield put({type: 'USER_DATA_UPDATED_(AUTHENTICATED)', ...dispatchArgs}); |
yield put({ |
||||
} |
type: 'USER_DATA_UPDATED_(AUTHENTICATED)', ...dispatchArgs |
||||
|
}); |
||||
} |
} |
||||
else{ |
} else if (account !== userState.address) { |
||||
if(account!==userState.address){ |
|
||||
const dispatchArgs = { |
const dispatchArgs = { |
||||
address: account |
address: account |
||||
}; |
}; |
||||
yield put({type: 'USER_DATA_UPDATED_(GUEST)', ...dispatchArgs}); |
yield put({ |
||||
} |
type: 'USER_DATA_UPDATED_(GUEST)', ...dispatchArgs |
||||
} |
}); |
||||
} |
} |
||||
catch (error) { |
} catch (error) { |
||||
console.error(error); |
console.error(error); |
||||
yield put({type: 'USER_FETCHING_ERROR', ...[]}) |
yield put({ |
||||
|
type: 'USER_FETCHING_ERROR', ...[] |
||||
|
}); |
||||
} |
} |
||||
} |
} |
||||
|
|
||||
function* getUserState(){ |
function* getUserState() { |
||||
return yield select((state) => state.user); |
return yield select(state => state.user); |
||||
} |
} |
||||
|
|
||||
function* userSaga() { |
function* userSaga() { |
||||
yield take(DRIZZLE_UTILS_SAGA_INITIALIZED); |
yield take(DRIZZLE_UTILS_SAGA_INITIALIZED); |
||||
yield takeEvery("ACCOUNTS_FETCHED", updateUserData); |
yield takeEvery('ACCOUNTS_FETCHED', updateUserData); |
||||
} |
} |
||||
|
|
||||
export default userSaga; |
export default userSaga; |
||||
|
@ -1,28 +1,27 @@ |
|||||
import React from 'react' |
import React from 'react'; |
||||
import {connect} from 'react-redux'; |
import { connect } from 'react-redux'; |
||||
import { Route, Redirect } from 'react-router-dom' |
import { Redirect, Route } from 'react-router-dom'; |
||||
|
|
||||
const PrivateRoute = ({ component: Component, ...rest }) => ( |
const PrivateRoute = ({ component: Component, ...rest }) => ( |
||||
<Route |
<Route |
||||
{...rest} |
{...rest} |
||||
render={props => |
render={props => (props.hasSignedUp ? ( |
||||
props.hasSignedUp ? ( |
|
||||
<Component {...props} /> |
<Component {...props} /> |
||||
) : ( |
) : ( |
||||
<Redirect to={{ |
<Redirect to={{ |
||||
pathname: "/signup", |
pathname: '/signup', |
||||
state: { from: props.location } |
state: { |
||||
|
from: props.location |
||||
|
} |
||||
}} |
}} |
||||
/> |
/> |
||||
) |
)) |
||||
} |
} |
||||
/> |
/> |
||||
); |
); |
||||
|
|
||||
const mapStateToProps = state => { |
const mapStateToProps = state => ({ |
||||
return { |
hasSignedUp: state.user.hasSignedUp |
||||
hasSignedUp: state.user.hasSignedUp, |
}); |
||||
} |
|
||||
}; |
|
||||
|
|
||||
export default connect(mapStateToProps)(PrivateRoute); |
export default connect(mapStateToProps)(PrivateRoute); |
||||
|
@ -1,28 +1,31 @@ |
|||||
import React from 'react' |
import React from 'react'; |
||||
import { Route, Redirect, Switch } from 'react-router-dom' |
import { Redirect, Route, Switch } from 'react-router-dom'; |
||||
import CoreLayoutContainer from '../containers/CoreLayoutContainer'; |
import CoreLayoutContainer from '../containers/CoreLayoutContainer'; |
||||
import HomeContainer from '../containers/HomeContainer' |
import HomeContainer from '../containers/HomeContainer'; |
||||
import SignUpContainer from '../containers/SignUpContainer' |
import SignUpContainer from '../containers/SignUpContainer'; |
||||
import StartTopicContainer from '../containers/StartTopicContainer' |
import StartTopicContainer from '../containers/StartTopicContainer'; |
||||
import TopicContainer from '../containers/TopicContainer' |
import TopicContainer from '../containers/TopicContainer'; |
||||
import ProfileContainer from '../containers/ProfileContainer' |
import ProfileContainer from '../containers/ProfileContainer'; |
||||
import NotFound from '../components/NotFound' |
import NotFound from '../components/NotFound'; |
||||
|
|
||||
const routes = ( |
const routes = ( |
||||
<div> |
<div> |
||||
<CoreLayoutContainer> |
<CoreLayoutContainer> |
||||
<Switch> |
<Switch> |
||||
<Route exact path="/" component={HomeContainer} /> |
<Route exact path="/" component={HomeContainer} /> |
||||
<Redirect from='/home' to="/" /> |
<Redirect from="/home" to="/" /> |
||||
<Route path="/signup" component={SignUpContainer} /> |
<Route path="/signup" component={SignUpContainer} /> |
||||
<Route path="/startTopic" component={StartTopicContainer} /> |
<Route path="/startTopic" component={StartTopicContainer} /> |
||||
<Route path="/topic/:topicId/:postId?" component={TopicContainer} /> |
<Route path="/topic/:topicId/:postId?" component={TopicContainer} /> |
||||
<Route path='/profile/:address?/:username?' component={ProfileContainer} /> |
<Route |
||||
<Route path='/404' component={NotFound} /> |
path="/profile/:address?/:username?" |
||||
|
component={ProfileContainer} |
||||
|
/> |
||||
|
<Route path="/404" component={NotFound} /> |
||||
<Route component={NotFound} /> |
<Route component={NotFound} /> |
||||
</Switch> |
</Switch> |
||||
</CoreLayoutContainer> |
</CoreLayoutContainer> |
||||
</div> |
</div> |
||||
); |
); |
||||
|
|
||||
export default routes |
export default routes; |
||||
|
Loading…
Reference in new issue