lbry-desktop/src/renderer/page/subscriptions/index.js
2018-10-22 23:31:06 -04:00

41 lines
1.3 KiB
JavaScript

import { connect } from 'react-redux';
import * as settings from 'constants/settings';
import {
selectSubscriptionClaims,
selectSubscriptions,
selectSubscriptionsBeingFetched,
selectIsFetchingSubscriptions,
selectUnreadSubscriptions,
selectViewMode,
} from 'redux/selectors/subscriptions';
import {
doUpdateUnreadSubscriptions,
doFetchMySubscriptions,
doSetViewMode,
} from 'redux/actions/subscriptions';
import { doSetClientSetting } from 'redux/actions/settings';
import { makeSelectClientSetting } from 'redux/selectors/settings';
import { selectFileListSubscriptionSort } from 'lbry-redux';
import SubscriptionsPage from './view';
const select = state => ({
loading:
selectIsFetchingSubscriptions(state) ||
Boolean(Object.keys(selectSubscriptionsBeingFetched(state)).length),
subscribedChannels: selectSubscriptions(state),
autoDownload: makeSelectClientSetting(settings.AUTO_DOWNLOAD)(state),
allSubscriptions: selectSubscriptionClaims(state),
unreadSubscriptions: selectUnreadSubscriptions(state),
sortBy: selectFileListSubscriptionSort(state),
viewMode: selectViewMode(state),
});
export default connect(
select,
{
doUpdateUnreadSubscriptions,
doFetchMySubscriptions,
doSetClientSetting,
doSetViewMode,
}
)(SubscriptionsPage);