-
-
Notifications
You must be signed in to change notification settings - Fork 62
[WIP] Redux store #927
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
turnerhayes
wants to merge
20
commits into
codeforboston:dev
Choose a base branch
from
turnerhayes:redux
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[WIP] Redux store #927
Changes from 8 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
8fd0b77
Add Redux store; seed it with initial state data
turnerhayes 40c8f88
Merge branch 'dev' into redux
turnerhayes 70d571f
Fix path resolution errors
turnerhayes 56c8af6
Convert CurrentBenefitsStep to use Redux store
turnerhayes 9b96f3f
Incorporate Redux store into Household, CurrentIncome and
turnerhayes e0ab961
Merge branch 'dev' into redux
turnerhayes 4b7e53a
Convert Predictions step to use Redux store
turnerhayes b07018a
Merge branch 'dev' into redux
turnerhayes c935fb4
Remove unused package
turnerhayes 546efbc
Merge branch 'dev' into redux
turnerhayes bf628c9
Merge branch 'dev' into redux
turnerhayes f65d5c3
Merge branch 'dev' into redux
turnerhayes 2d32a5e
Change STEP_VALS.js to use containers for steps
turnerhayes 0287c0b
Merge branch 'dev' into redux
turnerhayes e8ff257
Fix unit tests for step components
turnerhayes 893628a
Merge branch 'dev' into redux
turnerhayes 47a54bf
Merge branch 'dev' into redux
turnerhayes f6d6195
Merge branch 'dev' into redux
turnerhayes da08f85
Fix steps to work with Redux again; update unit tests
turnerhayes d87cc3d
Merge branch 'dev' into redux
turnerhayes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,125 @@ | ||
| export const SET_CLIENT_VALUE = 'SET_CLIENT_VALUE'; | ||
|
|
||
| export const setClientValue = ({ time, route, value }) => { | ||
| return { | ||
| type: SET_CLIENT_VALUE, | ||
| payload: { | ||
| time, | ||
| route, | ||
| value, | ||
| }, | ||
| }; | ||
| }; | ||
|
|
||
| export const REMOVE_MEMBER = 'REMOVE_MEMBER'; | ||
|
|
||
| export const removeMember = ({ time = 'current', index }) => { | ||
| return { | ||
| type: REMOVE_MEMBER, | ||
| payload: { | ||
| time, | ||
| index, | ||
| }, | ||
| }; | ||
| }; | ||
|
|
||
| export const ADD_MEMBER = 'ADD_MEMBER'; | ||
|
|
||
| export const addMember = ({ time = 'current', member }) => { | ||
| return { | ||
| type: ADD_MEMBER, | ||
| payload: { | ||
| time, | ||
| member, | ||
| }, | ||
| }; | ||
| }; | ||
|
|
||
| export const SET_MEMBER_IS_DISABLED = 'SET_MEMBER_IS_DISABLED'; | ||
|
|
||
| export const setMemberIsDisabled = ({ time = 'current', index, isDisabled }) => { | ||
| return { | ||
| type: SET_MEMBER_IS_DISABLED, | ||
| payload: { | ||
| time, | ||
| index, | ||
| isDisabled: !!isDisabled, | ||
| }, | ||
| }; | ||
| }; | ||
|
|
||
| export const SET_MEMBER_ROLE = 'SET_MEMBER_ROLE'; | ||
|
|
||
| export const setMemberRole = ({ time = 'current', index, role }) => { | ||
| return { | ||
| type: SET_MEMBER_ROLE, | ||
| payload: { | ||
| time, | ||
| index, | ||
| role, | ||
| }, | ||
| }; | ||
| }; | ||
|
|
||
| export const SET_MEMBER_AGE = 'SET_MEMBER_AGE'; | ||
|
|
||
| export const setMemberAge = ({ time = 'current', index, age }) => { | ||
| return { | ||
| type: SET_MEMBER_AGE, | ||
| payload: { | ||
| time, | ||
| index, | ||
| age, | ||
| }, | ||
| }; | ||
| }; | ||
|
|
||
| export const SET_CASH_VALUE = 'SET_CASH_VALUE'; | ||
|
|
||
| export const setCashValue = ({ time, name, value }) => { | ||
| return { | ||
| type: SET_CASH_VALUE, | ||
| payload: { | ||
| time, | ||
| name, | ||
| value, | ||
| }, | ||
| }; | ||
| }; | ||
|
|
||
| export const SET_HOUSING_TYPE = 'SET_HOUSING_TYPE'; | ||
|
|
||
| export const setHousingType = ({ time, housingType }) => { | ||
| return { | ||
| type: SET_HOUSING_TYPE, | ||
| payload: { | ||
| time, | ||
| housingType, | ||
| }, | ||
| }; | ||
| }; | ||
|
|
||
| export const SET_PAYS_UTILITY = 'SET_PAYS_UTILITY'; | ||
|
|
||
| export const setPaysUtility = ({ time, utility, paysUtility }) => { | ||
| return { | ||
| type: SET_PAYS_UTILITY, | ||
| payload: { | ||
| time, | ||
| utility, | ||
| paysUtility, | ||
| }, | ||
| }; | ||
| }; | ||
|
|
||
| export const SET_GETS_FUEL_ASSISTANCE = 'SET_GETS_FUEL_ASSISTANCE'; | ||
|
|
||
| export const setGetsFuelAssistance = ({ time, getsAssistance }) => { | ||
| return { | ||
| type: SET_GETS_FUEL_ASSISTANCE, | ||
| payload: { | ||
| time, | ||
| getsAssistance, | ||
| }, | ||
| }; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| export const SET_US_STATE = 'SET_US_STATE'; | ||
|
|
||
| export const setUSState = ({ state }) => { | ||
| return { | ||
| type: SET_US_STATE, | ||
| payload: { state }, | ||
| }; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| export * from './geography'; | ||
| export * from './localization'; | ||
| export * from './client'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| export const SET_LANGUAGE = 'SET_LANGUAGE'; | ||
|
|
||
| export const setLanguage = ({ language }) => { | ||
| return { | ||
| type: SET_LANGUAGE, | ||
| payload: { language }, | ||
| }; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| /* global module, process */ | ||
|
|
||
| import { createStore, compose } from 'redux'; | ||
| import { Map } from 'immutable'; | ||
| import createReducer from './reducers'; | ||
|
|
||
|
|
||
| export default function configureStore(initialState = Map()) { | ||
| // If Redux DevTools Extension is installed use it, otherwise use Redux compose | ||
| const composeEnhancers = process.env.NODE_ENV !== 'production' && | ||
| typeof window === 'object' && | ||
| window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ | ||
| ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({}) | ||
| : compose; | ||
|
|
||
| const store = createStore( | ||
| createReducer(), | ||
| initialState, | ||
| composeEnhancers() | ||
| ); | ||
|
|
||
| // Make reducers hot reloadable, see http://mxs.is/googmo | ||
| /* istanbul ignore next */ | ||
| if (module.hot) { | ||
| module.hot.accept('./reducers', () => { | ||
| store.replaceReducer(createReducer()); | ||
| }); | ||
| } | ||
|
|
||
| return store; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import { connect } from 'react-redux'; | ||
|
|
||
| import App from '../components/App'; | ||
| import { setUSState, setLanguage } from '../actions'; | ||
|
|
||
| const mapDispatchToProps = (dispatch) => { | ||
| return { | ||
| setUSState({ state }) { | ||
| dispatch(setUSState({ state })); | ||
| }, | ||
|
|
||
| setLanguage({ language }) { | ||
| dispatch(setLanguage({ language })); | ||
| }, | ||
| }; | ||
| }; | ||
|
|
||
| export default connect(null, mapDispatchToProps)(App); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import { connect } from 'react-redux'; | ||
|
|
||
| import { CurrentBenefitsStep } from '../../forms/CurrentBenefits'; | ||
| import { setClientValue } from '../../actions'; | ||
|
|
||
| const mapStateToProps = (state) => { | ||
| return { | ||
| currentClient: state.getIn([ | ||
| 'client', | ||
| 'current', | ||
| ]), | ||
| }; | ||
| }; | ||
|
|
||
| const mapDispatchToProps = (dispatch) => { | ||
| return { | ||
| setHasBenefit({ benefit, value }) { | ||
| dispatch( | ||
| setClientValue({ | ||
| time: 'current', | ||
| route: [ benefit ], | ||
| value, | ||
| }) | ||
| ); | ||
| }, | ||
| }; | ||
| }; | ||
|
|
||
| const CurrentBenefitsContainer = connect(mapStateToProps, mapDispatchToProps)(CurrentBenefitsStep); | ||
|
|
||
| export { CurrentBenefitsContainer as CurrentBenefitsStep }; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.