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

26 lines
904 B
JavaScript
Raw Permalink Normal View History

import { connect } from 'react-redux';
import { doChannelSubscribe, doChannelUnsubscribe } from 'redux/actions/subscriptions';
2020-11-02 17:51:08 +01:00
import {
makeSelectIsSubscribed,
selectFirstRunCompleted,
makeSelectNotificationsDisabled,
} from 'redux/selectors/subscriptions';
import { makeSelectPermanentUrlForUri } from 'lbry-redux';
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) => ({
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),
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);