lbry-desktop/ui/redux/selectors/app.js

141 lines
2.9 KiB
JavaScript
Raw Normal View History

import { createSelector } from 'reselect';
2017-04-07 07:15:22 +02:00
export const selectState = state => state.app || {};
2017-04-07 07:15:22 +02:00
2019-03-05 05:46:57 +01:00
export const selectPlatform = createSelector(
selectState,
state => state.platform
);
export const selectUpdateUrl = createSelector(
selectPlatform,
platform => {
switch (platform) {
case 'darwin':
2019-03-20 22:43:00 +01:00
return 'https://lbry.com/get/lbry.dmg';
2019-03-05 05:46:57 +01:00
case 'linux':
2019-03-20 22:43:00 +01:00
return 'https://lbry.com/get/lbry.deb';
2019-03-05 05:46:57 +01:00
case 'win32':
2019-03-20 22:43:00 +01:00
return 'https://lbry.com/get/lbry.exe';
2019-03-05 05:46:57 +01:00
default:
throw Error('Unknown platform');
}
2017-04-07 07:15:22 +02:00
}
2019-03-05 05:46:57 +01:00
);
2017-04-07 07:15:22 +02:00
2018-11-07 23:44:38 +01:00
export const selectHasClickedComment = createSelector(
selectState,
state => state.hasClickedComment
);
2019-03-05 05:46:57 +01:00
export const selectRemoteVersion = createSelector(
selectState,
state => state.remoteVersion
);
export const selectIsUpgradeAvailable = createSelector(
selectState,
state => state.isUpgradeAvailable
);
2017-04-07 07:15:22 +02:00
export const selectUpgradeFilename = createSelector(
selectPlatform,
selectRemoteVersion,
2017-04-07 07:15:22 +02:00
(platform, version) => {
switch (platform) {
case 'darwin':
return `LBRY_${version}.dmg`;
case 'linux':
return `LBRY_${version}.deb`;
case 'win32':
return `LBRY_${version}.exe`;
2017-04-07 07:15:22 +02:00
default:
throw Error('Unknown platform');
2017-04-07 07:15:22 +02:00
}
}
2017-06-06 06:21:55 +02:00
);
2017-04-07 07:15:22 +02:00
2019-03-05 05:46:57 +01:00
export const selectDownloadProgress = createSelector(
selectState,
state => state.downloadProgress
);
2017-04-07 07:15:22 +02:00
export const selectDownloadComplete = createSelector(
selectState,
2017-06-06 23:19:12 +02:00
state => state.upgradeDownloadCompleted
2017-06-06 06:21:55 +02:00
);
2019-03-05 05:46:57 +01:00
export const selectIsUpgradeSkipped = createSelector(
selectState,
state => state.isUpgradeSkipped
);
2017-04-07 07:15:22 +02:00
2019-03-05 05:46:57 +01:00
export const selectUpgradeDownloadPath = createSelector(
selectState,
state => state.downloadPath
);
2017-04-07 07:15:22 +02:00
2019-03-05 05:46:57 +01:00
export const selectUpgradeDownloadItem = createSelector(
selectState,
state => state.downloadItem
);
2017-04-07 07:15:22 +02:00
2018-02-24 01:24:00 +01:00
export const selectAutoUpdateDownloaded = createSelector(
selectState,
state => state.autoUpdateDownloaded
);
2018-02-24 01:24:00 +01:00
export const selectAutoUpdateDeclined = createSelector(
selectState,
state => state.autoUpdateDeclined
);
export const selectDaemonVersionMatched = createSelector(
selectState,
state => state.daemonVersionMatched
);
2019-03-05 05:46:57 +01:00
export const selectVolume = createSelector(
selectState,
state => state.volume
);
2019-08-02 08:28:14 +02:00
export const selectMute = createSelector(
selectState,
state => state.muted
);
2019-03-05 05:46:57 +01:00
export const selectUpgradeTimer = createSelector(
selectState,
state => state.checkUpgradeTimer
);
2019-03-05 05:46:57 +01:00
export const selectModal = createSelector(
selectState,
state => {
if (!state.modal) {
return null;
}
2019-03-05 05:46:57 +01:00
return {
id: state.modal,
modalProps: state.modalProps,
};
}
);
2019-01-23 16:38:40 +01:00
export const selectSearchOptionsExpanded = createSelector(
selectState,
state => state.searchOptionsExpanded
);
2019-07-23 01:43:30 +02:00
export const selectScrollStartingPosition = createSelector(
selectState,
state => state.currentScroll
);
2019-08-20 14:29:59 +02:00
export const selectIsPasswordSaved = createSelector(
selectState,
state => state.isPasswordSaved
);