lbry-react-native/src/page/discover/index.js

52 lines
2.2 KiB
JavaScript
Raw Normal View History

2019-07-09 02:54:32 +02:00
import { connect } from 'react-redux';
import { doClaimSearch, doFileList, selectBalance, selectFileInfosDownloaded, selectFollowedTags } from 'lbry-redux';
2019-07-09 02:54:32 +02:00
import {
doFetchFeaturedUris,
doFetchRewardedContent,
doFetchMySubscriptions,
doRemoveUnreadSubscriptions,
selectEnabledChannelNotifications,
selectFeaturedUris,
selectFetchingFeaturedUris,
selectSubscriptionClaims,
selectUnreadSubscriptions,
} from 'lbryinc';
import { doPushDrawerStack } from 'redux/actions/drawer';
import { doSetClientSetting, doSetSortByItem, doSetTimeItem } from 'redux/actions/settings';
import { makeSelectClientSetting, selectSortByItem, selectTimeItem } from 'redux/selectors/settings';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
2019-07-09 02:54:32 +02:00
import DiscoverPage from './view';
const select = state => ({
allSubscriptions: selectSubscriptionClaims(state),
balance: selectBalance(state),
enabledChannelNotifications: selectEnabledChannelNotifications(state),
featuredUris: selectFeaturedUris(state),
fetchingFeaturedUris: selectFetchingFeaturedUris(state),
fileInfos: selectFileInfosDownloaded(state),
followedTags: selectFollowedTags(state),
2019-07-09 02:54:32 +02:00
ratingReminderDisabled: makeSelectClientSetting(Constants.SETTING_RATING_REMINDER_DISABLED)(state),
ratingReminderLastShown: makeSelectClientSetting(Constants.SETTING_RATING_REMINDER_LAST_SHOWN)(state),
2019-08-10 08:55:12 +02:00
sortByItem: selectSortByItem(state),
timeItem: selectTimeItem(state),
2019-07-09 02:54:32 +02:00
unreadSubscriptions: selectUnreadSubscriptions(state),
});
const perform = dispatch => ({
doClaimSearch,
2019-07-09 02:54:32 +02:00
fetchFeaturedUris: () => dispatch(doFetchFeaturedUris()),
fetchRewardedContent: () => dispatch(doFetchRewardedContent()),
fetchSubscriptions: () => dispatch(doFetchMySubscriptions()),
fileList: () => dispatch(doFileList()),
pushDrawerStack: () => dispatch(doPushDrawerStack(Constants.DRAWER_ROUTE_DISCOVER)),
2019-07-09 02:54:32 +02:00
removeUnreadSubscriptions: () => dispatch(doRemoveUnreadSubscriptions()),
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
2019-08-10 08:55:12 +02:00
setSortByItem: item => dispatch(doSetSortByItem(item)),
setTimeItem: item => dispatch(doSetTimeItem(item)),
2019-07-09 02:54:32 +02:00
});
export default connect(
select,
perform
)(DiscoverPage);