mirror of
https://framagit.org/tykayn/mastodon.git
synced 2023-08-25 08:33:12 +02:00
25 lines
902 B
JavaScript
25 lines
902 B
JavaScript
![]() |
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));
|