2017-11-29 09:57:37 +01:00
|
|
|
// @flow
|
2017-04-07 07:15:22 +02:00
|
|
|
|
2017-12-21 18:32:51 +01:00
|
|
|
import * as ACTIONS from 'constants/action_types';
|
2017-12-28 00:48:11 +01:00
|
|
|
import { remote } from 'electron';
|
2017-11-29 09:57:37 +01:00
|
|
|
|
2019-02-22 07:59:50 +01:00
|
|
|
// @if TARGET='app'
|
2017-06-24 10:57:37 +02:00
|
|
|
const win = remote.BrowserWindow.getFocusedWindow();
|
2019-02-22 07:59:50 +01:00
|
|
|
// @endif
|
2017-06-24 10:57:37 +02:00
|
|
|
|
2017-06-06 06:21:55 +02:00
|
|
|
const reducers = {};
|
2017-11-30 07:53:23 +01:00
|
|
|
|
|
|
|
export type SnackBar = {
|
|
|
|
message: string,
|
|
|
|
linkText: string,
|
|
|
|
linkTarget: string,
|
|
|
|
isError: boolean,
|
|
|
|
};
|
|
|
|
export type AppState = {
|
2017-11-29 09:57:37 +01:00
|
|
|
isLoaded: boolean,
|
2017-11-30 07:53:23 +01:00
|
|
|
modal: ?string,
|
2017-11-29 09:57:37 +01:00
|
|
|
modalProps: mixed,
|
|
|
|
platform: string,
|
2017-11-29 23:43:27 +01:00
|
|
|
upgradeSkipped: boolean,
|
|
|
|
daemonVersionMatched: ?boolean,
|
2017-11-29 09:57:37 +01:00
|
|
|
daemonReady: boolean,
|
|
|
|
hasSignature: boolean,
|
|
|
|
badgeNumber: number,
|
2017-11-29 23:43:27 +01:00
|
|
|
volume: number,
|
2018-01-17 11:50:02 +01:00
|
|
|
autoUpdateDeclined: boolean,
|
|
|
|
modalsAllowed: boolean,
|
2017-11-30 07:53:23 +01:00
|
|
|
downloadProgress: ?number,
|
|
|
|
upgradeDownloading: ?boolean,
|
|
|
|
upgradeDownloadComplete: ?boolean,
|
|
|
|
checkUpgradeTimer: ?number,
|
|
|
|
isUpgradeAvailable: ?boolean,
|
|
|
|
isUpgradeSkipped: ?boolean,
|
2021-10-27 17:07:06 +02:00
|
|
|
isReloadRequired: ?boolean,
|
2018-11-07 23:44:38 +01:00
|
|
|
hasClickedComment: boolean,
|
2019-05-30 15:20:28 +02:00
|
|
|
enhancedLayout: boolean,
|
2020-11-09 18:22:38 +01:00
|
|
|
splashAnimationEnabled: boolean,
|
2019-02-21 23:45:17 +01:00
|
|
|
searchOptionsExpanded: boolean,
|
2019-08-20 14:29:59 +02:00
|
|
|
isPasswordSaved: boolean,
|
2020-02-19 07:31:40 +01:00
|
|
|
welcomeVersion: number,
|
|
|
|
allowAnalytics: boolean,
|
2020-07-10 23:04:36 +02:00
|
|
|
hasNavigated: boolean,
|
2020-09-04 22:11:28 +02:00
|
|
|
interestedInYoutubeSync: boolean,
|
2021-02-09 17:05:56 +01:00
|
|
|
activeChannel: ?string,
|
|
|
|
incognito: boolean,
|
2022-03-14 18:49:15 +01:00
|
|
|
adBlockerFound: ?boolean, // undefined = unknown; true/false = yes/no;
|
Playlists v2: Refactors, touch ups + Queue Mode (#1604)
* Playlists v2
* Style pass
* Change playlist items arrange icon
* Playlist card body open by default
* Refactor collectionEdit components
* Paginate & Refactor bid field
* Collection page changes
* Add Thumbnail optional
* Replace extra info for description on collection page
* Playlist card right below video on medium screen
* Allow editing private collections
* Add edit option to menus
* Allow deleting a public playlist but keeping a private version
* Add queue to Save menu, remove edit option from Builtin pages, show queue on playlists page
* Fix scroll to recent persisting on medium screen
* Fix adding to queue from menu
* Fixes for delete
* PublishList: delay mounting Items tab to prevent lock-up (#1783)
For a large list, the playlist publish form is unusable (super-slow typing) due to the entire list being mounted despite the tab is not active.
The full solution is still to paginate it, but for now, don't mount the tab until it is selected. Add a spinner to indicate something is loading. It's not prefect, but it's throwaway code anyway. At least we can fill in the fields properly now.
* Batch-resolve private collections (#1782)
* makeSelectClaimForClaimId --> selectClaimForClaimId
Move away from the problematic `makeSelect*`, especially in large loops.
* Batch-resolve private collections
1758
This alleviates the lock-up that is caused by large number of invidual resolves. There will still be some minor stutter due to the large DOM that React needs to handle -- that is logged in 1758 and will be handled separately.
At least the stutter is short (1-2s) and the app is still usable.
Private list items are being resolve individually, super slow if the list is large (>100). Published lists doesn't have this issue.
doFetchItemsInCollections contains most of the useful logic, but it isn't called for private/built-in lists because it's not an actual claim.
Tweaked doFetchItemsInCollections to handle private (UUID-based) collections.
* Use persisted state for floating player playlist card body
- I find it annoying being open everytime
* Fix removing edits from published playlist
* Fix scroll on mobile
* Allow going editing items from toast
* Fix ClaimShareButton
* Prevent edit/publish of builtin
* Fix async inside forEach
* Fix sync on queue edit
* Fix autoplayCountdown replay
* Fix deleting an item scrolling the playlist
* CreatedAt fixes
* Remove repost for now
* Anon publish fixes
* Fix mature case on floating
Co-authored-by: infinite-persistence <64950861+infinite-persistence@users.noreply.github.com>
2022-07-13 15:59:59 +02:00
|
|
|
appDrawerOpen: boolean | string,
|
|
|
|
mainPlayerDimensions: { height: ?number, width: ?number },
|
2017-11-30 07:53:23 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
const defaultState: AppState = {
|
2017-04-07 07:15:22 +02:00
|
|
|
isLoaded: false,
|
2017-09-08 05:15:05 +02:00
|
|
|
modal: null,
|
|
|
|
modalProps: {},
|
2017-04-07 07:15:22 +02:00
|
|
|
platform: process.platform,
|
2017-07-19 23:05:08 +02:00
|
|
|
daemonVersionMatched: null,
|
2017-04-22 15:17:01 +02:00
|
|
|
daemonReady: false,
|
2017-04-29 11:50:29 +02:00
|
|
|
hasSignature: false,
|
2017-06-24 10:57:37 +02:00
|
|
|
badgeNumber: 0,
|
2020-01-27 22:37:54 +01:00
|
|
|
volume: 1,
|
2019-12-30 20:54:53 +01:00
|
|
|
// @if TARGET='app'
|
|
|
|
upgradeSkipped: sessionStorage.getItem('upgradeSkipped') === 'true',
|
|
|
|
// @endif
|
2019-07-27 23:17:25 +02:00
|
|
|
muted: false,
|
2018-01-16 06:38:23 +01:00
|
|
|
autoUpdateDownloaded: false,
|
2018-01-17 11:50:02 +01:00
|
|
|
autoUpdateDeclined: false,
|
|
|
|
modalsAllowed: true,
|
2018-11-07 23:44:38 +01:00
|
|
|
hasClickedComment: false,
|
2017-11-30 07:53:23 +01:00
|
|
|
downloadProgress: undefined,
|
|
|
|
upgradeDownloading: undefined,
|
|
|
|
upgradeDownloadComplete: undefined,
|
|
|
|
checkUpgradeTimer: undefined,
|
|
|
|
isUpgradeAvailable: undefined,
|
|
|
|
isUpgradeSkipped: undefined,
|
2021-10-27 17:07:06 +02:00
|
|
|
isReloadRequired: undefined,
|
2019-01-23 16:38:40 +01:00
|
|
|
enhancedLayout: false,
|
2020-11-09 18:22:38 +01:00
|
|
|
splashAnimationEnabled: true,
|
2019-02-21 23:45:17 +01:00
|
|
|
searchOptionsExpanded: false,
|
2019-07-17 22:49:06 +02:00
|
|
|
currentScroll: 0,
|
|
|
|
scrollHistory: [0],
|
2019-08-20 14:29:59 +02:00
|
|
|
isPasswordSaved: false,
|
2020-02-19 07:31:40 +01:00
|
|
|
welcomeVersion: 0.0,
|
|
|
|
allowAnalytics: false,
|
2020-07-10 23:04:36 +02:00
|
|
|
hasNavigated: false,
|
2020-09-04 22:11:28 +02:00
|
|
|
interestedInYoutubeSync: false,
|
2021-02-09 17:05:56 +01:00
|
|
|
activeChannel: undefined,
|
|
|
|
incognito: false,
|
2022-03-14 18:49:15 +01:00
|
|
|
adBlockerFound: undefined,
|
2022-04-04 14:13:15 +02:00
|
|
|
appDrawerOpen: false,
|
Playlists v2: Refactors, touch ups + Queue Mode (#1604)
* Playlists v2
* Style pass
* Change playlist items arrange icon
* Playlist card body open by default
* Refactor collectionEdit components
* Paginate & Refactor bid field
* Collection page changes
* Add Thumbnail optional
* Replace extra info for description on collection page
* Playlist card right below video on medium screen
* Allow editing private collections
* Add edit option to menus
* Allow deleting a public playlist but keeping a private version
* Add queue to Save menu, remove edit option from Builtin pages, show queue on playlists page
* Fix scroll to recent persisting on medium screen
* Fix adding to queue from menu
* Fixes for delete
* PublishList: delay mounting Items tab to prevent lock-up (#1783)
For a large list, the playlist publish form is unusable (super-slow typing) due to the entire list being mounted despite the tab is not active.
The full solution is still to paginate it, but for now, don't mount the tab until it is selected. Add a spinner to indicate something is loading. It's not prefect, but it's throwaway code anyway. At least we can fill in the fields properly now.
* Batch-resolve private collections (#1782)
* makeSelectClaimForClaimId --> selectClaimForClaimId
Move away from the problematic `makeSelect*`, especially in large loops.
* Batch-resolve private collections
1758
This alleviates the lock-up that is caused by large number of invidual resolves. There will still be some minor stutter due to the large DOM that React needs to handle -- that is logged in 1758 and will be handled separately.
At least the stutter is short (1-2s) and the app is still usable.
Private list items are being resolve individually, super slow if the list is large (>100). Published lists doesn't have this issue.
doFetchItemsInCollections contains most of the useful logic, but it isn't called for private/built-in lists because it's not an actual claim.
Tweaked doFetchItemsInCollections to handle private (UUID-based) collections.
* Use persisted state for floating player playlist card body
- I find it annoying being open everytime
* Fix removing edits from published playlist
* Fix scroll on mobile
* Allow going editing items from toast
* Fix ClaimShareButton
* Prevent edit/publish of builtin
* Fix async inside forEach
* Fix sync on queue edit
* Fix autoplayCountdown replay
* Fix deleting an item scrolling the playlist
* CreatedAt fixes
* Remove repost for now
* Anon publish fixes
* Fix mature case on floating
Co-authored-by: infinite-persistence <64950861+infinite-persistence@users.noreply.github.com>
2022-07-13 15:59:59 +02:00
|
|
|
mainPlayerDimensions: { height: undefined, width: undefined },
|
2019-07-17 22:49:06 +02:00
|
|
|
};
|
|
|
|
|
2019-07-23 01:43:30 +02:00
|
|
|
// @@router comes from react-router
|
|
|
|
// This action is dispatched any time a user navigates forward or back
|
2020-01-27 22:37:54 +01:00
|
|
|
try {
|
2020-10-07 04:14:20 +02:00
|
|
|
defaultState.volume = Number(sessionStorage.getItem('volume') || 1);
|
2020-01-27 22:37:54 +01:00
|
|
|
} catch (e) {}
|
|
|
|
|
2019-07-17 22:49:06 +02:00
|
|
|
reducers['@@router/LOCATION_CHANGE'] = (state, action) => {
|
|
|
|
const { currentScroll } = state;
|
2019-07-23 10:05:51 +02:00
|
|
|
const scrollHistory = (state.scrollHistory && state.scrollHistory.slice()) || [];
|
2019-07-17 22:49:06 +02:00
|
|
|
const { action: name } = action.payload;
|
|
|
|
let newCurrentScroll = currentScroll;
|
|
|
|
if (name === 'PUSH') {
|
|
|
|
scrollHistory.push(window.scrollY);
|
|
|
|
newCurrentScroll = 0;
|
|
|
|
} else if (name === 'POP') {
|
|
|
|
newCurrentScroll = scrollHistory[scrollHistory.length - 1];
|
|
|
|
scrollHistory.pop();
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
scrollHistory,
|
|
|
|
currentScroll: newCurrentScroll,
|
|
|
|
};
|
2017-06-06 06:21:55 +02:00
|
|
|
};
|
2017-04-07 07:15:22 +02:00
|
|
|
|
2021-10-17 10:36:14 +02:00
|
|
|
reducers[ACTIONS.DAEMON_READY] = (state) =>
|
2017-12-28 00:48:11 +01:00
|
|
|
Object.assign({}, state, {
|
2017-05-02 05:57:50 +02:00
|
|
|
daemonReady: true,
|
2017-06-06 23:19:12 +02:00
|
|
|
});
|
2017-05-02 05:57:50 +02:00
|
|
|
|
2019-08-20 14:29:59 +02:00
|
|
|
reducers[ACTIONS.PASSWORD_SAVED] = (state, action) =>
|
|
|
|
Object.assign({}, state, {
|
|
|
|
isPasswordSaved: action.data,
|
|
|
|
});
|
|
|
|
|
2021-10-17 10:36:14 +02:00
|
|
|
reducers[ACTIONS.DAEMON_VERSION_MATCH] = (state) =>
|
2017-12-28 00:48:11 +01:00
|
|
|
Object.assign({}, state, {
|
2017-07-19 23:05:08 +02:00
|
|
|
daemonVersionMatched: true,
|
|
|
|
});
|
|
|
|
|
2021-10-17 10:36:14 +02:00
|
|
|
reducers[ACTIONS.DAEMON_VERSION_MISMATCH] = (state) =>
|
2017-12-28 00:48:11 +01:00
|
|
|
Object.assign({}, state, {
|
2017-07-19 23:05:08 +02:00
|
|
|
daemonVersionMatched: false,
|
|
|
|
});
|
2017-05-02 05:57:50 +02:00
|
|
|
|
2021-10-17 10:36:14 +02:00
|
|
|
reducers[ACTIONS.UPGRADE_CANCELLED] = (state) =>
|
2017-12-28 00:48:11 +01:00
|
|
|
Object.assign({}, state, {
|
2017-04-07 07:15:22 +02:00
|
|
|
downloadProgress: null,
|
2017-05-25 22:07:32 +02:00
|
|
|
upgradeDownloadComplete: false,
|
2017-04-07 07:15:22 +02:00
|
|
|
modal: null,
|
2017-06-06 23:19:12 +02:00
|
|
|
});
|
2017-04-07 07:15:22 +02:00
|
|
|
|
2021-10-17 10:36:14 +02:00
|
|
|
reducers[ACTIONS.AUTO_UPDATE_DOWNLOADED] = (state) =>
|
2018-01-16 06:38:23 +01:00
|
|
|
Object.assign({}, state, {
|
|
|
|
autoUpdateDownloaded: true,
|
|
|
|
});
|
|
|
|
|
2021-10-17 10:36:14 +02:00
|
|
|
reducers[ACTIONS.AUTO_UPDATE_DECLINED] = (state) =>
|
2018-04-18 06:03:01 +02:00
|
|
|
Object.assign({}, state, {
|
2018-01-17 11:50:02 +01:00
|
|
|
autoUpdateDeclined: true,
|
|
|
|
});
|
|
|
|
|
2017-12-28 00:48:11 +01:00
|
|
|
reducers[ACTIONS.UPGRADE_DOWNLOAD_COMPLETED] = (state, action) =>
|
|
|
|
Object.assign({}, state, {
|
2017-06-01 08:51:16 +02:00
|
|
|
downloadPath: action.data.path,
|
2017-05-25 22:07:32 +02:00
|
|
|
upgradeDownloading: false,
|
2017-06-06 23:19:12 +02:00
|
|
|
upgradeDownloadCompleted: true,
|
|
|
|
});
|
2017-04-07 07:15:22 +02:00
|
|
|
|
2021-10-17 10:36:14 +02:00
|
|
|
reducers[ACTIONS.UPGRADE_DOWNLOAD_STARTED] = (state) =>
|
2017-12-28 00:48:11 +01:00
|
|
|
Object.assign({}, state, {
|
2017-06-06 23:19:12 +02:00
|
|
|
upgradeDownloading: true,
|
|
|
|
});
|
2017-04-07 07:15:22 +02:00
|
|
|
|
2018-01-17 11:50:02 +01:00
|
|
|
reducers[ACTIONS.CHANGE_MODALS_ALLOWED] = (state, action) =>
|
|
|
|
Object.assign({}, state, {
|
|
|
|
modalsAllowed: action.data.modalsAllowed,
|
|
|
|
});
|
|
|
|
|
2021-10-17 10:36:14 +02:00
|
|
|
reducers[ACTIONS.SKIP_UPGRADE] = (state) => {
|
2017-12-21 18:32:51 +01:00
|
|
|
sessionStorage.setItem('upgradeSkipped', 'true');
|
2017-04-07 07:15:22 +02:00
|
|
|
|
|
|
|
return Object.assign({}, state, {
|
2017-11-15 02:50:21 +01:00
|
|
|
isUpgradeSkipped: true,
|
2017-06-06 23:19:12 +02:00
|
|
|
});
|
2017-06-06 06:21:55 +02:00
|
|
|
};
|
2017-04-07 07:15:22 +02:00
|
|
|
|
2021-10-17 10:36:14 +02:00
|
|
|
reducers[ACTIONS.MEDIA_PLAY] = (state) =>
|
2018-04-18 06:03:01 +02:00
|
|
|
Object.assign({}, state, {
|
2018-01-17 11:50:02 +01:00
|
|
|
modalsAllowed: false,
|
|
|
|
});
|
|
|
|
|
2021-10-17 10:36:14 +02:00
|
|
|
reducers[ACTIONS.MEDIA_PAUSE] = (state) =>
|
2018-04-18 06:03:01 +02:00
|
|
|
Object.assign({}, state, {
|
2018-01-17 11:50:02 +01:00
|
|
|
modalsAllowed: true,
|
|
|
|
});
|
|
|
|
|
|
|
|
reducers[ACTIONS.SET_PLAYING_URI] = (state, action) => {
|
|
|
|
if (action.data.uri === null) {
|
|
|
|
return Object.assign({}, state, {
|
|
|
|
modalsAllowed: true,
|
|
|
|
});
|
|
|
|
}
|
2018-03-26 23:32:43 +02:00
|
|
|
return state;
|
2018-01-17 11:50:02 +01:00
|
|
|
};
|
|
|
|
|
2017-12-28 00:48:11 +01:00
|
|
|
reducers[ACTIONS.UPDATE_VERSION] = (state, action) =>
|
|
|
|
Object.assign({}, state, {
|
2017-06-06 23:19:12 +02:00
|
|
|
version: action.data.version,
|
|
|
|
});
|
2017-04-07 07:15:22 +02:00
|
|
|
|
2017-12-28 00:48:11 +01:00
|
|
|
reducers[ACTIONS.CHECK_UPGRADE_SUCCESS] = (state, action) =>
|
|
|
|
Object.assign({}, state, {
|
2017-11-15 02:50:21 +01:00
|
|
|
isUpgradeAvailable: action.data.upgradeAvailable,
|
|
|
|
remoteVersion: action.data.remoteVersion,
|
|
|
|
});
|
|
|
|
|
2017-12-28 00:48:11 +01:00
|
|
|
reducers[ACTIONS.CHECK_UPGRADE_SUBSCRIBE] = (state, action) =>
|
|
|
|
Object.assign({}, state, {
|
2017-11-15 02:50:21 +01:00
|
|
|
checkUpgradeTimer: action.data.checkUpgradeTimer,
|
|
|
|
});
|
|
|
|
|
2017-12-28 00:48:11 +01:00
|
|
|
reducers[ACTIONS.UPGRADE_DOWNLOAD_PROGRESSED] = (state, action) =>
|
|
|
|
Object.assign({}, state, {
|
2017-06-06 23:19:12 +02:00
|
|
|
downloadProgress: action.data.percent,
|
|
|
|
});
|
2017-04-07 07:15:22 +02:00
|
|
|
|
2021-10-27 17:07:06 +02:00
|
|
|
reducers[ACTIONS.RELOAD_REQUIRED] = (state, action) =>
|
|
|
|
Object.assign({}, state, {
|
|
|
|
isReloadRequired: true,
|
|
|
|
});
|
|
|
|
|
2021-10-17 10:36:14 +02:00
|
|
|
reducers[ACTIONS.DOWNLOADING_COMPLETED] = (state) => {
|
2017-12-21 18:32:51 +01:00
|
|
|
const { badgeNumber } = state;
|
2017-06-24 10:57:37 +02:00
|
|
|
|
|
|
|
// Don't update the badge number if the window is focused
|
2019-02-22 07:59:50 +01:00
|
|
|
// @if TARGET='app'
|
2017-10-13 22:33:37 +02:00
|
|
|
if (win && win.isFocused()) return Object.assign({}, state);
|
2019-02-22 07:59:50 +01:00
|
|
|
// @endif
|
2017-06-24 10:57:37 +02:00
|
|
|
|
|
|
|
return Object.assign({}, state, {
|
|
|
|
badgeNumber: badgeNumber + 1,
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2021-10-17 10:36:14 +02:00
|
|
|
reducers[ACTIONS.WINDOW_FOCUSED] = (state) =>
|
2017-12-28 00:48:11 +01:00
|
|
|
Object.assign({}, state, {
|
2017-06-24 10:57:37 +02:00
|
|
|
badgeNumber: 0,
|
|
|
|
});
|
|
|
|
|
2017-12-28 00:48:11 +01:00
|
|
|
reducers[ACTIONS.VOLUME_CHANGED] = (state, action) =>
|
|
|
|
Object.assign({}, state, {
|
2017-08-25 21:05:00 +02:00
|
|
|
volume: action.data.volume,
|
|
|
|
});
|
|
|
|
|
2019-07-27 23:17:25 +02:00
|
|
|
reducers[ACTIONS.VOLUME_MUTED] = (state, action) =>
|
|
|
|
Object.assign({}, state, {
|
|
|
|
muted: action.data.muted,
|
|
|
|
});
|
|
|
|
|
2021-10-17 10:36:14 +02:00
|
|
|
reducers[ACTIONS.HISTORY_NAVIGATE] = (state) =>
|
2018-03-26 23:32:43 +02:00
|
|
|
Object.assign({}, state, {
|
|
|
|
modal: undefined,
|
|
|
|
modalProps: {},
|
|
|
|
});
|
|
|
|
|
2021-10-17 10:36:14 +02:00
|
|
|
reducers[ACTIONS.CLEAR_UPGRADE_TIMER] = (state) =>
|
2018-08-07 16:02:11 +02:00
|
|
|
Object.assign({}, state, {
|
|
|
|
checkUpgradeTimer: undefined,
|
|
|
|
});
|
|
|
|
|
2021-10-17 10:36:14 +02:00
|
|
|
reducers[ACTIONS.ADD_COMMENT] = (state) =>
|
2018-11-07 23:44:38 +01:00
|
|
|
Object.assign({}, state, {
|
|
|
|
hasClickedComment: true,
|
|
|
|
});
|
|
|
|
|
2018-10-29 18:23:53 +01:00
|
|
|
reducers[ACTIONS.SHOW_MODAL] = (state, action) =>
|
|
|
|
Object.assign({}, state, {
|
|
|
|
modal: action.data.id,
|
2018-11-28 18:40:52 +01:00
|
|
|
modalProps: action.data.modalProps,
|
|
|
|
});
|
2018-10-29 18:23:53 +01:00
|
|
|
|
2020-02-19 07:31:40 +01:00
|
|
|
reducers[ACTIONS.SET_WELCOME_VERSION] = (state, action) =>
|
|
|
|
Object.assign({}, state, {
|
|
|
|
welcomeVersion: action.data,
|
|
|
|
});
|
|
|
|
|
|
|
|
reducers[ACTIONS.SET_ALLOW_ANALYTICS] = (state, action) =>
|
|
|
|
Object.assign({}, state, {
|
|
|
|
allowAnalytics: action.data,
|
|
|
|
});
|
|
|
|
|
2020-07-10 23:04:36 +02:00
|
|
|
reducers[ACTIONS.SET_HAS_NAVIGATED] = (state, action) =>
|
|
|
|
Object.assign({}, state, {
|
|
|
|
hasNavigated: action.data,
|
|
|
|
});
|
|
|
|
|
2021-10-17 10:36:14 +02:00
|
|
|
reducers[ACTIONS.HIDE_MODAL] = (state) =>
|
2018-10-29 18:23:53 +01:00
|
|
|
Object.assign({}, state, {
|
|
|
|
modal: null,
|
|
|
|
modalProps: null,
|
2018-11-28 18:40:52 +01:00
|
|
|
});
|
|
|
|
|
2021-10-17 10:36:14 +02:00
|
|
|
reducers[ACTIONS.TOGGLE_SEARCH_EXPANDED] = (state) =>
|
2019-02-21 23:45:17 +01:00
|
|
|
Object.assign({}, state, {
|
|
|
|
searchOptionsExpanded: !state.searchOptionsExpanded,
|
|
|
|
});
|
|
|
|
|
2020-09-04 22:11:28 +02:00
|
|
|
reducers[ACTIONS.TOGGLE_YOUTUBE_SYNC_INTEREST] = (state, action) => {
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
interestedInYoutubeSync: !state.interestedInYoutubeSync,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2020-11-09 18:22:38 +01:00
|
|
|
reducers[ACTIONS.TOGGLE_SPLASH_ANIMATION] = (state, action) => {
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
splashAnimationEnabled: !state.splashAnimationEnabled,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-02-09 17:05:56 +01:00
|
|
|
reducers[ACTIONS.SET_ACTIVE_CHANNEL] = (state, action) => {
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
activeChannel: action.data.claimId,
|
|
|
|
};
|
|
|
|
};
|
2021-02-11 06:12:41 +01:00
|
|
|
|
2021-02-09 17:05:56 +01:00
|
|
|
reducers[ACTIONS.SET_INCOGNITO] = (state, action) => {
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
incognito: action.data.enabled,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-04-04 14:13:15 +02:00
|
|
|
reducers[ACTIONS.SET_AD_BLOCKER_FOUND] = (state, action) => {
|
2022-02-02 13:44:33 +01:00
|
|
|
return {
|
|
|
|
...state,
|
2022-04-04 14:13:15 +02:00
|
|
|
adBlockerFound: action.data,
|
2022-02-02 13:44:33 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
Playlists v2: Refactors, touch ups + Queue Mode (#1604)
* Playlists v2
* Style pass
* Change playlist items arrange icon
* Playlist card body open by default
* Refactor collectionEdit components
* Paginate & Refactor bid field
* Collection page changes
* Add Thumbnail optional
* Replace extra info for description on collection page
* Playlist card right below video on medium screen
* Allow editing private collections
* Add edit option to menus
* Allow deleting a public playlist but keeping a private version
* Add queue to Save menu, remove edit option from Builtin pages, show queue on playlists page
* Fix scroll to recent persisting on medium screen
* Fix adding to queue from menu
* Fixes for delete
* PublishList: delay mounting Items tab to prevent lock-up (#1783)
For a large list, the playlist publish form is unusable (super-slow typing) due to the entire list being mounted despite the tab is not active.
The full solution is still to paginate it, but for now, don't mount the tab until it is selected. Add a spinner to indicate something is loading. It's not prefect, but it's throwaway code anyway. At least we can fill in the fields properly now.
* Batch-resolve private collections (#1782)
* makeSelectClaimForClaimId --> selectClaimForClaimId
Move away from the problematic `makeSelect*`, especially in large loops.
* Batch-resolve private collections
1758
This alleviates the lock-up that is caused by large number of invidual resolves. There will still be some minor stutter due to the large DOM that React needs to handle -- that is logged in 1758 and will be handled separately.
At least the stutter is short (1-2s) and the app is still usable.
Private list items are being resolve individually, super slow if the list is large (>100). Published lists doesn't have this issue.
doFetchItemsInCollections contains most of the useful logic, but it isn't called for private/built-in lists because it's not an actual claim.
Tweaked doFetchItemsInCollections to handle private (UUID-based) collections.
* Use persisted state for floating player playlist card body
- I find it annoying being open everytime
* Fix removing edits from published playlist
* Fix scroll on mobile
* Allow going editing items from toast
* Fix ClaimShareButton
* Prevent edit/publish of builtin
* Fix async inside forEach
* Fix sync on queue edit
* Fix autoplayCountdown replay
* Fix deleting an item scrolling the playlist
* CreatedAt fixes
* Remove repost for now
* Anon publish fixes
* Fix mature case on floating
Co-authored-by: infinite-persistence <64950861+infinite-persistence@users.noreply.github.com>
2022-07-13 15:59:59 +02:00
|
|
|
reducers[ACTIONS.SET_MAIN_PLAYER_DIMENSIONS] = (state, action) => {
|
|
|
|
return { ...state, mainPlayerDimensions: action.data };
|
|
|
|
};
|
|
|
|
|
2022-04-04 14:13:15 +02:00
|
|
|
reducers[ACTIONS.DRAWER_OPENED] = (state, action) => {
|
2022-03-14 18:49:15 +01:00
|
|
|
return {
|
|
|
|
...state,
|
2022-04-04 14:13:15 +02:00
|
|
|
appDrawerOpen: action.data,
|
2022-03-14 18:49:15 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
Playlists v2: Refactors, touch ups + Queue Mode (#1604)
* Playlists v2
* Style pass
* Change playlist items arrange icon
* Playlist card body open by default
* Refactor collectionEdit components
* Paginate & Refactor bid field
* Collection page changes
* Add Thumbnail optional
* Replace extra info for description on collection page
* Playlist card right below video on medium screen
* Allow editing private collections
* Add edit option to menus
* Allow deleting a public playlist but keeping a private version
* Add queue to Save menu, remove edit option from Builtin pages, show queue on playlists page
* Fix scroll to recent persisting on medium screen
* Fix adding to queue from menu
* Fixes for delete
* PublishList: delay mounting Items tab to prevent lock-up (#1783)
For a large list, the playlist publish form is unusable (super-slow typing) due to the entire list being mounted despite the tab is not active.
The full solution is still to paginate it, but for now, don't mount the tab until it is selected. Add a spinner to indicate something is loading. It's not prefect, but it's throwaway code anyway. At least we can fill in the fields properly now.
* Batch-resolve private collections (#1782)
* makeSelectClaimForClaimId --> selectClaimForClaimId
Move away from the problematic `makeSelect*`, especially in large loops.
* Batch-resolve private collections
1758
This alleviates the lock-up that is caused by large number of invidual resolves. There will still be some minor stutter due to the large DOM that React needs to handle -- that is logged in 1758 and will be handled separately.
At least the stutter is short (1-2s) and the app is still usable.
Private list items are being resolve individually, super slow if the list is large (>100). Published lists doesn't have this issue.
doFetchItemsInCollections contains most of the useful logic, but it isn't called for private/built-in lists because it's not an actual claim.
Tweaked doFetchItemsInCollections to handle private (UUID-based) collections.
* Use persisted state for floating player playlist card body
- I find it annoying being open everytime
* Fix removing edits from published playlist
* Fix scroll on mobile
* Allow going editing items from toast
* Fix ClaimShareButton
* Prevent edit/publish of builtin
* Fix async inside forEach
* Fix sync on queue edit
* Fix autoplayCountdown replay
* Fix deleting an item scrolling the playlist
* CreatedAt fixes
* Remove repost for now
* Anon publish fixes
* Fix mature case on floating
Co-authored-by: infinite-persistence <64950861+infinite-persistence@users.noreply.github.com>
2022-07-13 15:59:59 +02:00
|
|
|
reducers[ACTIONS.DRAWER_CLOSED] = (state, action) => {
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
appDrawerOpen: false,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-10-17 10:36:14 +02:00
|
|
|
reducers[ACTIONS.USER_STATE_POPULATE] = (state, action) => {
|
2020-02-19 07:31:40 +01:00
|
|
|
const { welcomeVersion, allowAnalytics } = action.data;
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
...(welcomeVersion !== undefined ? { welcomeVersion } : {}),
|
|
|
|
...(allowAnalytics !== undefined ? { allowAnalytics } : {}),
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-10-17 10:36:14 +02:00
|
|
|
reducers[ACTIONS.PURCHASE_URI_FAILED] = (state, action) => {
|
2020-05-21 17:38:28 +02:00
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
modal: null,
|
|
|
|
modalProps: null,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2017-11-30 07:53:23 +01:00
|
|
|
export default function reducer(state: AppState = defaultState, action: any) {
|
2017-04-07 07:15:22 +02:00
|
|
|
const handler = reducers[action.type];
|
|
|
|
if (handler) return handler(state, action);
|
|
|
|
return state;
|
|
|
|
}
|