This commit is contained in:
Belen Curcio
2017-01-31 16:31:29 -03:00
parent 1070dfd5ae
commit 890da0400f
8 changed files with 62 additions and 1 deletions
+2
View File
@@ -7,6 +7,7 @@ import Configure from 'containers/Configure/Configure';
import Streams from 'containers/Streams/Streams';
import CommunityContainer from 'containers/Community/CommunityContainer';
import LayoutContainer from 'containers/LayoutContainer';
import InstallContainer from 'containers/Install/InstallContainer';
const routes = (
<Route path='/admin' component={LayoutContainer}>
@@ -15,6 +16,7 @@ const routes = (
<Route path='community' component={CommunityContainer} />
<Route path='configure' component={Configure} />
<Route path='streams' component={Streams} />
<Route path='install' component={InstallContainer} />
</Route>
);
@@ -0,0 +1,4 @@
import * as actions from '../constants/install';
export const nextStep = () => ({type: actions.NEXT_STEP});
export const previousStep = () => ({type: actions.PREVIOUS_STEP});
@@ -0,0 +1,2 @@
export const NEXT_STEP = 'NEXT_STEP';
export const PREVIOUS_STEP = 'PREVIOUS_STEP';
@@ -0,0 +1,30 @@
import React from 'react';
import {connect} from 'react-redux';
import styles from './style.css';
import {nextStep, previousStep} from '../../actions/install'
const InstallContainer = props => {
const {nextStep, previousStep, install} = props;
return (
<div className={styles.Install}>
Install:
<h1>
{install.step}
</h1>
<button onClick={previousStep}>Previous Step</button>
<button onClick={nextStep}>Next Step</button>
</div>
);
};
const mapStateToProps = state => ({
install: state.install.toJS()
});
const mapDispatchToProps = dispatch => ({
nextStep: () => dispatch(nextStep()),
previousStep: () => dispatch(previousStep())
});
export default connect(mapStateToProps, mapDispatchToProps)(InstallContainer);
+3 -1
View File
@@ -6,6 +6,7 @@ import users from 'reducers/users';
import auth from 'reducers/auth';
import actions from 'reducers/actions';
import assets from 'reducers/assets';
import install from 'reducers/install';
// Combine all reducers into a main one
export default combineReducers({
@@ -15,5 +16,6 @@ export default combineReducers({
auth,
actions,
assets,
users
users,
install
});
@@ -0,0 +1,21 @@
import {Map} from 'immutable';
import * as actions from '../constants/install';
const initialState = Map({
step: 0
});
export default function auth (state = initialState, action) {
switch (action.type) {
case actions.NEXT_STEP:
console.log(state)
return state
.set('step', state.get('step') + 1);
case actions.PREVIOUS_STEP:
return state
.set('step', state.get('step') - 1);
default :
return state;
}
}