parent
d69f045681
commit
9fbaaefe59
@ -0,0 +1,24 @@ |
|||||||
|
import React from 'react'; |
||||||
|
import { connect } from 'react-redux'; |
||||||
|
import { makeGetAccount } from 'flavours/glitch/selectors'; |
||||||
|
import { injectIntl } from 'react-intl'; |
||||||
|
import { removeFromListEditor, addToListEditor } from 'flavours/glitch/actions/lists'; |
||||||
|
import Account from '../components/account'; |
||||||
|
|
||||||
|
const makeMapStateToProps = () => { |
||||||
|
const getAccount = makeGetAccount(); |
||||||
|
|
||||||
|
const mapStateToProps = (state, { accountId, added }) => ({ |
||||||
|
account: getAccount(state, accountId), |
||||||
|
added: typeof added === 'undefined' ? state.getIn(['listEditor', 'accounts', 'items']).includes(accountId) : added, |
||||||
|
}); |
||||||
|
|
||||||
|
return mapStateToProps; |
||||||
|
}; |
||||||
|
|
||||||
|
const mapDispatchToProps = (dispatch, { accountId }) => ({ |
||||||
|
onRemove: () => dispatch(removeFromListEditor(accountId)), |
||||||
|
onAdd: () => dispatch(addToListEditor(accountId)), |
||||||
|
}); |
||||||
|
|
||||||
|
export default injectIntl(connect(makeMapStateToProps, mapDispatchToProps)(Account)); |
@ -0,0 +1,17 @@ |
|||||||
|
import React from 'react'; |
||||||
|
import { connect } from 'react-redux'; |
||||||
|
import { injectIntl } from 'react-intl'; |
||||||
|
import { fetchListSuggestions, clearListSuggestions, changeListSuggestions } from '../../../actions/lists'; |
||||||
|
import Search from '../components/search'; |
||||||
|
|
||||||
|
const mapStateToProps = state => ({ |
||||||
|
value: state.getIn(['listEditor', 'suggestions', 'value']), |
||||||
|
}); |
||||||
|
|
||||||
|
const mapDispatchToProps = dispatch => ({ |
||||||
|
onSubmit: value => dispatch(fetchListSuggestions(value)), |
||||||
|
onClear: () => dispatch(clearListSuggestions()), |
||||||
|
onChange: value => dispatch(changeListSuggestions(value)), |
||||||
|
}); |
||||||
|
|
||||||
|
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(Search)); |
Loading…
Reference in new issue