lbry-desktop/ui/component/claimCollectionAddButton/index.js
Rafael 1fb154f7fe Refactor claimCollecitonAddButton
- claim makeSelect to select
- only interested in claim's stream_type
- Tooltip
2022-02-08 12:35:40 -05:00

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);