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

26 lines
914 B
JavaScript
Raw Normal View History

import { connect } from 'react-redux';
import { doChannelSubscribe, doChannelUnsubscribe } from 'redux/actions/subscriptions';
2020-11-02 17:51:08 +01:00
import {
selectIsSubscribedForUri,
2020-11-02 17:51:08 +01:00
selectFirstRunCompleted,
makeSelectNotificationsDisabled,
} from 'redux/selectors/subscriptions';
import { makeSelectPermanentUrlForUri } from 'redux/selectors/claims';
import { selectUser } from 'redux/selectors/user';
import { doToast } from 'redux/actions/notifications';
import SubscribeButton from './view';
2017-12-08 21:38:20 +01:00
const select = (state, props) => ({
isSubscribed: selectIsSubscribedForUri(state, props.uri),
2018-11-21 22:20:55 +01:00
firstRunCompleted: selectFirstRunCompleted(state),
2019-09-04 06:22:31 +02:00
permanentUrl: makeSelectPermanentUrlForUri(props.uri)(state),
2020-11-02 17:51:08 +01:00
notificationsDisabled: makeSelectNotificationsDisabled(props.uri)(state),
user: selectUser(state),
2017-12-08 21:38:20 +01:00
});
export default connect(select, {
doChannelSubscribe,
doChannelUnsubscribe,
doToast,
})(SubscribeButton);