1fb154f7fe
- claim makeSelect to select - only interested in claim's stream_type - Tooltip
26 lines
731 B
JavaScript
26 lines
731 B
JavaScript
import { connect } from 'react-redux';
|
|
import { doOpenModal } from 'redux/actions/app';
|
|
import CollectionAddButton from './view';
|
|
import { selectClaimForUri } from 'redux/selectors/claims';
|
|
import { makeSelectClaimUrlInCollection } from 'redux/selectors/collections';
|
|
|
|
const select = (state, props) => {
|
|
const { uri } = props;
|
|
|
|
const claim = selectClaimForUri(state, uri);
|
|
|
|
// $FlowFixMe
|
|
const { permanent_url: permanentUrl, value } = claim || {};
|
|
const streamType = (value && value.stream_type) || '';
|
|
|
|
return {
|
|
streamType,
|
|
isSaved: permanentUrl && makeSelectClaimUrlInCollection(permanentUrl)(state),
|
|
};
|
|
};
|
|
|
|
const perform = {
|
|
doOpenModal,
|
|
};
|
|
|
|
export default connect(select, perform)(CollectionAddButton);
|