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

68 lines
2.7 KiB
JavaScript
Raw Normal View History

2019-03-05 00:24:03 -06:00
import { hot } from 'react-hot-loader/root';
import { connect } from 'react-redux';
2020-10-02 11:03:25 -04:00
import { selectUploadCount } from 'lbryinc';
import { selectGetSyncErrorMessage, selectSyncFatalError } from 'redux/selectors/sync';
import { doFetchAccessToken, doUserSetReferrer } from 'redux/actions/user';
import { selectUser, selectAccessToken, selectUserVerifiedEmail } from 'redux/selectors/user';
import { selectUnclaimedRewards } from 'redux/selectors/rewards';
import { doFetchChannelListMine, selectMyChannelUrls, SETTINGS } from 'lbry-redux';
import {
makeSelectClientSetting,
selectLanguage,
selectLoadedLanguages,
selectThemePath,
} from 'redux/selectors/settings';
import {
selectIsUpgradeAvailable,
selectAutoUpdateDownloaded,
selectModal,
selectActiveChannelClaim,
} from 'redux/selectors/app';
import { doGetWalletSyncPreference, doSetLanguage } from 'redux/actions/settings';
2021-01-21 14:50:51 -05:00
import { doSyncLoop } from 'redux/actions/sync';
import {
doDownloadUpgradeRequested,
doSignIn,
doGetAndPopulatePreferences,
doSetActiveChannel,
doSetIncognito,
} from 'redux/actions/app';
import { doFetchModBlockedList } from 'redux/actions/comments';
import App from './view';
2017-04-07 12:15:22 +07:00
const select = (state) => ({
2017-07-27 21:13:12 -04:00
user: selectUser(state),
2020-01-14 15:44:07 -05:00
accessToken: selectAccessToken(state),
2018-10-19 11:27:14 -04:00
theme: selectThemePath(state),
language: selectLanguage(state),
2020-09-04 11:02:30 -04:00
syncEnabled: makeSelectClientSetting(SETTINGS.ENABLE_SYNC)(state),
2019-11-08 15:51:42 -05:00
languages: selectLoadedLanguages(state),
autoUpdateDownloaded: selectAutoUpdateDownloaded(state),
isUpgradeAvailable: selectIsUpgradeAvailable(state),
2019-10-22 13:57:32 -04:00
syncError: selectGetSyncErrorMessage(state),
uploadCount: selectUploadCount(state),
2020-01-14 15:44:07 -05:00
rewards: selectUnclaimedRewards(state),
isAuthenticated: selectUserVerifiedEmail(state),
2020-09-18 13:26:00 -04:00
currentModal: selectModal(state),
syncFatalError: selectSyncFatalError(state),
activeChannelClaim: selectActiveChannelClaim(state),
myChannelUrls: selectMyChannelUrls(state),
2017-07-27 21:13:12 -04:00
});
2017-04-07 12:15:22 +07:00
const perform = (dispatch) => ({
2019-08-06 12:53:59 -04:00
fetchAccessToken: () => dispatch(doFetchAccessToken()),
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
setLanguage: (language) => dispatch(doSetLanguage(language)),
2019-10-01 00:53:33 -04:00
signIn: () => dispatch(doSignIn()),
requestDownloadUpgrade: () => dispatch(doDownloadUpgradeRequested()),
updatePreferences: () => dispatch(doGetAndPopulatePreferences()),
getWalletSyncPref: () => dispatch(doGetWalletSyncPreference()),
syncLoop: (noInterval) => dispatch(doSyncLoop(noInterval)),
2020-01-14 15:44:07 -05:00
setReferrer: (referrer, doClaim) => dispatch(doUserSetReferrer(referrer, doClaim)),
setActiveChannelIfNotSet: () => dispatch(doSetActiveChannel()),
setIncognito: () => dispatch(doSetIncognito()),
fetchModBlockedList: () => dispatch(doFetchModBlockedList()),
2017-06-05 21:21:55 -07:00
});
2017-04-07 12:15:22 +07:00
export default hot(connect(select, perform)(App));