diff --git a/app/package.json b/app/package.json index 2695d68..96edf51 100644 --- a/app/package.json +++ b/app/package.json @@ -7,14 +7,18 @@ "url": "https://gitlab.com/Ezerous/Apella.git" }, "dependencies": { - "@drizzle-utils/get-web3": "^0.1.4-alpha.0", - "@drizzle-utils/get-contract-instance": "^0.1.4-alpha.0", "@drizzle-utils/get-accounts": "0.1.4-alpha.0", + "@drizzle-utils/get-contract-instance": "^0.1.4-alpha.0", + "@drizzle-utils/get-web3": "^0.1.4-alpha.0", + "connected-react-router": "^6.3.1", "drizzle": "^1.3.3", "drizzle-react": "^1.2.0", "drizzle-react-components": "^1.2.1", + "history": "^4.7.2", "react": "^16.8.1", "react-dom": "^16.8.1", + "react-redux": "^6.0.0", + "react-router-dom": "^4.3.1", "react-scripts": "^2.1.5", "redux": "^4.0.1", "redux-saga": "^0.16.0" diff --git a/app/src/components/AppComponent.js b/app/src/components/HomeComponent.js similarity index 100% rename from app/src/components/AppComponent.js rename to app/src/components/HomeComponent.js diff --git a/app/src/components/NotFound.js b/app/src/components/NotFound.js new file mode 100644 index 0000000..eee996f --- /dev/null +++ b/app/src/components/NotFound.js @@ -0,0 +1,12 @@ +import React from 'react'; +import pageNotFound from '../resources/PageNotFound.jpg'; + +const NotFound = () => { + return ( +
+ Page not found! +
+ ); +}; + +export default NotFound; \ No newline at end of file diff --git a/app/src/containers/AppContainer.js b/app/src/containers/HomeContainer.js similarity index 56% rename from app/src/containers/AppContainer.js rename to app/src/containers/HomeContainer.js index 6c17cc9..6eaeb61 100644 --- a/app/src/containers/AppContainer.js +++ b/app/src/containers/HomeContainer.js @@ -1,4 +1,4 @@ -import AppComponent from "../components/AppComponent"; +import HomeComponent from "../components/HomeComponent"; import { drizzleConnect } from "drizzle-react"; const mapStateToProps = state => { @@ -9,6 +9,6 @@ const mapStateToProps = state => { }; }; -const AppContainer = drizzleConnect(AppComponent, mapStateToProps); +const HomeContainer = drizzleConnect(HomeComponent, mapStateToProps); -export default AppContainer; +export default HomeContainer; diff --git a/app/src/index.js b/app/src/index.js index dfda9ea..e88c48f 100644 --- a/app/src/index.js +++ b/app/src/index.js @@ -3,16 +3,23 @@ import { render } from "react-dom"; import { DrizzleProvider } from "drizzle-react"; import { LoadingContainer } from "drizzle-react-components"; import drizzleOptions from "./config/drizzleOptions"; -import AppContainer from "./containers/AppContainer"; -import store from './redux/store'; +import { ConnectedRouter } from 'connected-react-router' +import routerStore, {history} from './redux/routerStore'; +import drizzleStore from './redux/drizzleStore'; +import routes from './router/routes' import * as serviceWorker from "./utils/serviceWorker"; +import {Provider} from "react-redux"; render( - - - - + + + + + { routes } + + + , document.getElementById('root') ); diff --git a/app/src/redux/store.js b/app/src/redux/drizzleStore.js similarity index 58% rename from app/src/redux/store.js rename to app/src/redux/drizzleStore.js index 42db54c..f3bcb00 100644 --- a/app/src/redux/store.js +++ b/app/src/redux/drizzleStore.js @@ -1,28 +1,23 @@ import { createStore, applyMiddleware, compose } from 'redux'; -import reducer from './reducers/reducer'; -import rootSaga from './sagas/rootSaga'; import createSagaMiddleware from 'redux-saga'; import { generateContractsInitialState } from 'drizzle'; +import drizzleReducer from './reducers/drizzleReducer'; +import rootSaga from './sagas/drizzleSaga'; import drizzleOptions from '../config/drizzleOptions'; +const initialState = { contracts: generateContractsInitialState(drizzleOptions) }; + // Redux DevTools const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose; const sagaMiddleware = createSagaMiddleware(); - -const initialState = { - contracts: generateContractsInitialState(drizzleOptions) -}; +const composedEnhancers = composeEnhancers(applyMiddleware(sagaMiddleware)); const store = createStore( - reducer, + drizzleReducer, initialState, - composeEnhancers( - applyMiddleware( - sagaMiddleware - ) - ) + composedEnhancers ); sagaMiddleware.run(rootSaga); diff --git a/app/src/redux/reducers/reducer.js b/app/src/redux/reducers/drizzleReducer.js similarity index 89% rename from app/src/redux/reducers/reducer.js rename to app/src/redux/reducers/drizzleReducer.js index 20cc533..23ce1d7 100644 --- a/app/src/redux/reducers/reducer.js +++ b/app/src/redux/reducers/drizzleReducer.js @@ -7,4 +7,4 @@ const reducer = combineReducers({ ...drizzleReducers }); -export default reducer; +export default reducer; \ No newline at end of file diff --git a/app/src/redux/reducers/routerReducer.js b/app/src/redux/reducers/routerReducer.js new file mode 100644 index 0000000..eede131 --- /dev/null +++ b/app/src/redux/reducers/routerReducer.js @@ -0,0 +1,6 @@ +import { combineReducers } from 'redux'; +import { connectRouter } from 'connected-react-router' + +export default (history) => combineReducers({ + router: connectRouter(history) +}) diff --git a/app/src/redux/routerStore.js b/app/src/redux/routerStore.js new file mode 100644 index 0000000..4d8b31d --- /dev/null +++ b/app/src/redux/routerStore.js @@ -0,0 +1,27 @@ +import { createBrowserHistory } from 'history' +import { createStore, applyMiddleware, compose } from 'redux'; +import { routerMiddleware } from 'connected-react-router' + +import createRootReducer from './reducers/routerReducer'; + +export const history = createBrowserHistory(); + +const rootReducer = createRootReducer(history); + +const initialState = {}; + +// Redux DevTools +const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose; + +const routingMiddleware = routerMiddleware(history); + + +const composedEnhancers = composeEnhancers(applyMiddleware(routingMiddleware)); + +const routerStore = createStore( + rootReducer, + initialState, + composedEnhancers +); + +export default routerStore; \ No newline at end of file diff --git a/app/src/redux/sagas/rootSaga.js b/app/src/redux/sagas/drizzleSaga.js similarity index 100% rename from app/src/redux/sagas/rootSaga.js rename to app/src/redux/sagas/drizzleSaga.js diff --git a/app/src/resources/PageNotFound.jpg b/app/src/resources/PageNotFound.jpg new file mode 100644 index 0000000..ff4d8d4 Binary files /dev/null and b/app/src/resources/PageNotFound.jpg differ diff --git a/app/src/resources/ipfs_logo.png b/app/src/resources/ipfs_logo.png new file mode 100644 index 0000000..2aa68e8 Binary files /dev/null and b/app/src/resources/ipfs_logo.png differ diff --git a/app/src/resources/logo.png b/app/src/resources/logo.png new file mode 100644 index 0000000..eb52170 Binary files /dev/null and b/app/src/resources/logo.png differ diff --git a/app/src/router/routes.js b/app/src/router/routes.js new file mode 100644 index 0000000..8677c26 --- /dev/null +++ b/app/src/router/routes.js @@ -0,0 +1,27 @@ +import React from 'react' +import { Route, Switch } from 'react-router-dom' +import HomeContainer from '../containers/HomeContainer' +import NotFound from '../components/NotFound' + +const routes = ( +
+ + + + +
+); + +export default routes + + +// const routes = ( +//
+// +// +// +// +// +// +//
+// ); \ No newline at end of file