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