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

38 lines
1.6 KiB
JavaScript
Raw Normal View History

2019-07-17 22:49:06 +02:00
import { connect } from 'react-redux';
import * as SETTINGS from 'constants/settings';
import { selectUserVerifiedEmail } from 'redux/selectors/user';
2022-03-29 08:45:59 +02:00
import { selectHasNavigated, selectScrollStartingPosition } from 'redux/selectors/app';
import { selectClientSetting, selectHomepageData, selectWildWestDisabled } from 'redux/selectors/settings';
2018-04-18 06:03:01 +02:00
import Router from './view';
import { selectTitleForUri } from 'redux/selectors/claims';
import { doSetHasNavigated, doSetActiveChannel } from 'redux/actions/app';
import { doUserSetReferrer } from 'redux/actions/user';
import { selectHasUnclaimedRefereeReward } from 'redux/selectors/rewards';
import { selectUnseenNotificationCount } from 'redux/selectors/notifications';
const select = (state, props) => {
const { uri } = props;
2020-01-25 21:37:02 +01:00
return {
uri,
title: selectTitleForUri(state, uri),
2020-01-25 21:37:02 +01:00
currentScroll: selectScrollStartingPosition(state),
isAuthenticated: selectUserVerifiedEmail(state),
hasNavigated: selectHasNavigated(state),
hasUnclaimedRefereeReward: selectHasUnclaimedRefereeReward(state),
homepageData: selectHomepageData(state),
2022-02-15 18:36:33 +01:00
wildWestDisabled: selectWildWestDisabled(state),
unseenCount: selectUnseenNotificationCount(state),
hideTitleNotificationCount: selectClientSetting(state, SETTINGS.HIDE_TITLE_NOTIFICATION_COUNT),
2022-05-04 15:59:10 +02:00
hasDefaultChannel: Boolean(selectClientSetting(state, SETTINGS.ACTIVE_CHANNEL_CLAIM)),
2020-01-25 21:37:02 +01:00
};
};
2019-07-17 22:49:06 +02:00
2022-05-04 15:59:10 +02:00
const perform = {
setHasNavigated: doSetHasNavigated,
setReferrer: doUserSetReferrer,
doSetActiveChannel,
2022-05-04 15:59:10 +02:00
};
export default connect(select, perform)(Router);