lbry-desktop/ui/component/subscribeButton/index.js

24 lines
810 B
JavaScript
Raw Normal View History

import { connect } from 'react-redux';
import { doChannelSubscribe, doChannelUnsubscribe } from 'redux/actions/subscriptions';
import { doOpenModal } from 'redux/actions/app';
2019-05-07 23:38:29 +02:00
import { selectSubscriptions, makeSelectIsSubscribed, selectFirstRunCompleted } from 'redux/selectors/subscriptions';
2019-09-04 06:22:31 +02:00
import { doToast, makeSelectPermanentUrlForUri } from 'lbry-redux';
import SubscribeButton from './view';
2017-12-08 21:38:20 +01:00
const select = (state, props) => ({
subscriptions: selectSubscriptions(state),
2018-10-19 22:38:07 +02:00
isSubscribed: makeSelectIsSubscribed(props.uri, true)(state),
2018-11-21 22:20:55 +01:00
firstRunCompleted: selectFirstRunCompleted(state),
2019-09-04 06:22:31 +02:00
permanentUrl: makeSelectPermanentUrlForUri(props.uri)(state),
2017-12-08 21:38:20 +01:00
});
2018-10-19 22:38:07 +02:00
export default connect(
select,
{
doChannelSubscribe,
doChannelUnsubscribe,
doOpenModal,
2018-11-21 22:20:55 +01:00
doToast,
2018-10-19 22:38:07 +02:00
}
)(SubscribeButton);