You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
923 B
25 lines
923 B
6 years ago
|
import React from 'react';
|
||
|
import { connect } from 'react-redux';
|
||
|
import { makeGetAccount } from 'flavours/glitch/selectors';
|
||
|
import { injectIntl } from 'react-intl';
|
||
|
import { pinAccount, unpinAccount } from 'flavours/glitch/actions/accounts';
|
||
|
import Account from 'flavours/glitch/features/list_editor/components/account';
|
||
|
|
||
|
const makeMapStateToProps = () => {
|
||
|
const getAccount = makeGetAccount();
|
||
|
|
||
|
const mapStateToProps = (state, { accountId, added }) => ({
|
||
|
account: getAccount(state, accountId),
|
||
|
added: typeof added === 'undefined' ? state.getIn(['pinnedAccountsEditor', 'accounts', 'items']).includes(accountId) : added,
|
||
|
});
|
||
|
|
||
|
return mapStateToProps;
|
||
|
};
|
||
|
|
||
|
const mapDispatchToProps = (dispatch, { accountId }) => ({
|
||
|
onRemove: () => dispatch(unpinAccount(accountId)),
|
||
|
onAdd: () => dispatch(pinAccount(accountId)),
|
||
|
});
|
||
|
|
||
|
export default injectIntl(connect(makeMapStateToProps, mapDispatchToProps)(Account));
|