diff options
author | Victor Chabbert <chabbertvi@eisti.eu> | 2016-12-21 14:54:48 +0100 |
---|---|---|
committer | Victor Chabbert <chabbertvi@eisti.eu> | 2016-12-21 14:54:48 +0100 |
commit | f6640dd198044924eb142b2f335c1c30406a8a4f (patch) | |
tree | c10a6a01507157575042e22a627026a69b4323e5 /src/main/js | |
parent | Made gameBrowser logic use immutable.js (diff) | |
download | seven-wonders-f6640dd198044924eb142b2f335c1c30406a8a4f.tar.gz seven-wonders-f6640dd198044924eb142b2f335c1c30406a8a4f.tar.bz2 seven-wonders-f6640dd198044924eb142b2f335c1c30406a8a4f.zip |
Remove Counter from application
Diffstat (limited to 'src/main/js')
-rw-r--r-- | src/main/js/src/containers/Counter/actions.js | 20 | ||||
-rw-r--r-- | src/main/js/src/containers/Counter/constants.js | 4 | ||||
-rw-r--r-- | src/main/js/src/containers/Counter/index.js | 51 | ||||
-rw-r--r-- | src/main/js/src/containers/Counter/reducer.js | 17 | ||||
-rw-r--r-- | src/main/js/src/containers/Counter/saga.js | 14 | ||||
-rw-r--r-- | src/main/js/src/index.js | 2 | ||||
-rw-r--r-- | src/main/js/src/reducers.js | 2 | ||||
-rw-r--r-- | src/main/js/src/sagas.js | 2 |
8 files changed, 0 insertions, 112 deletions
diff --git a/src/main/js/src/containers/Counter/actions.js b/src/main/js/src/containers/Counter/actions.js deleted file mode 100644 index abd6babb..00000000 --- a/src/main/js/src/containers/Counter/actions.js +++ /dev/null @@ -1,20 +0,0 @@ -import { - INCREMENT, DECREMENT, - INCREMENT_IF_ODD, INCREMENT_ASYNC -} from './constants' - -export const increment = () => ({ - type: INCREMENT -}) - -export const decrement = () => ({ - type: DECREMENT -}) - -export const incrementIfOdd = () => ({ - type: INCREMENT_IF_ODD -}) - -export const incrementAsync = () => ({ - type: INCREMENT_ASYNC -})
\ No newline at end of file diff --git a/src/main/js/src/containers/Counter/constants.js b/src/main/js/src/containers/Counter/constants.js deleted file mode 100644 index 9b829ae0..00000000 --- a/src/main/js/src/containers/Counter/constants.js +++ /dev/null @@ -1,4 +0,0 @@ -export const INCREMENT = 'counter/INCREMENT' -export const DECREMENT = 'counter/DECREMENT' -export const INCREMENT_IF_ODD = 'counter/INCREMENT_IF_ODD' -export const INCREMENT_ASYNC = 'counter/INCREMENT_ASYNC'
\ No newline at end of file diff --git a/src/main/js/src/containers/Counter/index.js b/src/main/js/src/containers/Counter/index.js deleted file mode 100644 index 0be665fd..00000000 --- a/src/main/js/src/containers/Counter/index.js +++ /dev/null @@ -1,51 +0,0 @@ -import React, { PropTypes } from 'react' -import { connect } from 'react-redux' - -import { - increment, - decrement, - incrementAsync, - incrementIfOdd -} from './actions' - -const Counter = ({value, increment, decrement, incrementIfOdd, incrementAsync}) => - <p> - Clicked: {value} times - {' '} - <button onClick={increment}> - + - </button> - {' '} - <button onClick={decrement}> - - - </button> - {' '} - <button onClick={incrementIfOdd}> - Increment if odd - </button> - {' '} - <button onClick={incrementAsync}> - Increment async - </button> - </p> - -Counter.propTypes = { - value: PropTypes.number.isRequired, - increment: PropTypes.func.isRequired, - decrement: PropTypes.func.isRequired, - incrementAsync: PropTypes.func.isRequired, - incrementIfOdd: PropTypes.func.isRequired -} - -const mapStateToProps = (state) => ({ - value: state.counter -}) - -const mapDispatchToProps = { - increment, - decrement, - incrementAsync, - incrementIfOdd -} - -export default connect(mapStateToProps, mapDispatchToProps)(Counter)
\ No newline at end of file diff --git a/src/main/js/src/containers/Counter/reducer.js b/src/main/js/src/containers/Counter/reducer.js deleted file mode 100644 index 44006f3e..00000000 --- a/src/main/js/src/containers/Counter/reducer.js +++ /dev/null @@ -1,17 +0,0 @@ -import { - INCREMENT, DECREMENT, - INCREMENT_IF_ODD -} from './constants' - -export default function reducer(state = 0, action) { - switch (action.type) { - case INCREMENT: - return state + 1 - case DECREMENT: - return state - 1 - case INCREMENT_IF_ODD: - return (state % 2 === 0) ? state + 1 : state - default: - return state - } -}
\ No newline at end of file diff --git a/src/main/js/src/containers/Counter/saga.js b/src/main/js/src/containers/Counter/saga.js deleted file mode 100644 index 0b9e2866..00000000 --- a/src/main/js/src/containers/Counter/saga.js +++ /dev/null @@ -1,14 +0,0 @@ -import { put, call } from 'redux-saga/effects' -import { delay, takeEvery } from 'redux-saga' - -import { increment } from './actions' -import { INCREMENT_ASYNC } from './constants' - -export function* incrementAsync() { - yield call(delay, 1000) - yield put(increment()) -} - -export default function* counterSaga() { - yield takeEvery(INCREMENT_ASYNC, incrementAsync) -}
\ No newline at end of file diff --git a/src/main/js/src/index.js b/src/main/js/src/index.js index 97af0f59..6c6043f0 100644 --- a/src/main/js/src/index.js +++ b/src/main/js/src/index.js @@ -11,7 +11,6 @@ const store = configureStore(initialState) import './global-styles.css' import App from './containers/App' -import Counter from './containers/Counter' import Error404 from './components/errors/Error404' ReactDOM.render( @@ -19,7 +18,6 @@ ReactDOM.render( <BrowserRouter> <div className="app"> <Match exactly pattern="/" component={App}/> - <Match exactly pattern="/counter" component={Counter}/> <Miss component={Error404}/> </div> </BrowserRouter> diff --git a/src/main/js/src/reducers.js b/src/main/js/src/reducers.js index 4bfaf7c1..5a369ce5 100644 --- a/src/main/js/src/reducers.js +++ b/src/main/js/src/reducers.js @@ -1,11 +1,9 @@ import { combineReducers } from 'redux' -import counterReducer from './containers/Counter/reducer' import gamesReducer from './containers/GameBrowser/reducer' export default function createReducer() { return combineReducers({ - counter: counterReducer, games: gamesReducer, }) } diff --git a/src/main/js/src/sagas.js b/src/main/js/src/sagas.js index 92235434..66531ead 100644 --- a/src/main/js/src/sagas.js +++ b/src/main/js/src/sagas.js @@ -2,7 +2,6 @@ import { fork, call } from 'redux-saga/effects' import createWsConnection from './utils/createWebSocketConnection' -import counterSaga from './containers/Counter/saga' import errorSaga from './containers/App/saga' import newGamesSaga from './containers/GameBrowser/saga' @@ -21,7 +20,6 @@ function* wsAwareSagas() { export default function* rootSaga() { yield [ - call(counterSaga), call(wsAwareSagas) ] } |