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

26 lines
906 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';
2021-11-17 12:57:04 +01:00
import { selectPermanentUrlForUri } 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),
2021-11-17 12:57:04 +01:00
permanentUrl: selectPermanentUrlForUri(state, props.uri),
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);