lbry-desktop/ui/component/subscribeButton/index.js
2020-11-02 15:50:53 -05:00

25 lines
904 B
JavaScript

import { connect } from 'react-redux';
import { doChannelSubscribe, doChannelUnsubscribe } from 'redux/actions/subscriptions';
import {
makeSelectIsSubscribed,
selectFirstRunCompleted,
makeSelectNotificationsDisabled,
} from 'redux/selectors/subscriptions';
import { makeSelectPermanentUrlForUri } from 'lbry-redux';
import { doToast } from 'redux/actions/notifications';
import { selectUser } from 'redux/selectors/user';
import SubscribeButton from './view';
const select = (state, props) => ({
isSubscribed: makeSelectIsSubscribed(props.uri, true)(state),
firstRunCompleted: selectFirstRunCompleted(state),
permanentUrl: makeSelectPermanentUrlForUri(props.uri)(state),
notificationsDisabled: makeSelectNotificationsDisabled(props.uri)(state),
user: selectUser(state),
});
export default connect(select, {
doChannelSubscribe,
doChannelUnsubscribe,
doToast,
})(SubscribeButton);