2017-12-21 18:08:54 -03:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { doChannelSubscribe, doChannelUnsubscribe } from 'redux/actions/subscriptions';
|
2020-11-02 11:51:08 -05:00
|
|
|
import {
|
2021-11-12 22:47:07 +08:00
|
|
|
selectIsSubscribedForUri,
|
2020-11-02 11:51:08 -05:00
|
|
|
selectFirstRunCompleted,
|
|
|
|
makeSelectNotificationsDisabled,
|
|
|
|
} from 'redux/selectors/subscriptions';
|
2021-11-17 19:57:04 +08:00
|
|
|
import { selectPermanentUrlForUri } from 'redux/selectors/claims';
|
2020-11-02 15:43:52 -05:00
|
|
|
import { selectUser } from 'redux/selectors/user';
|
2021-07-07 14:21:11 -04:00
|
|
|
import { doToast } from 'redux/actions/notifications';
|
2017-12-21 18:08:54 -03:00
|
|
|
import SubscribeButton from './view';
|
2017-12-08 15:38:20 -05:00
|
|
|
|
|
|
|
const select = (state, props) => ({
|
2021-11-12 22:47:07 +08:00
|
|
|
isSubscribed: selectIsSubscribedForUri(state, props.uri),
|
2018-11-21 16:20:55 -05:00
|
|
|
firstRunCompleted: selectFirstRunCompleted(state),
|
2021-11-17 19:57:04 +08:00
|
|
|
permanentUrl: selectPermanentUrlForUri(state, props.uri),
|
2020-11-02 11:51:08 -05:00
|
|
|
notificationsDisabled: makeSelectNotificationsDisabled(props.uri)(state),
|
2020-11-02 15:43:52 -05:00
|
|
|
user: selectUser(state),
|
2017-12-08 15:38:20 -05:00
|
|
|
});
|
|
|
|
|
2020-06-12 16:44:25 -04:00
|
|
|
export default connect(select, {
|
|
|
|
doChannelSubscribe,
|
|
|
|
doChannelUnsubscribe,
|
|
|
|
doToast,
|
|
|
|
})(SubscribeButton);
|