2018-03-26 23:32:43 +02:00
|
|
|
// @flow
|
2022-04-04 14:13:15 +02:00
|
|
|
|
|
|
|
// $FlowFixMe
|
|
|
|
import { Global } from '@emotion/react';
|
|
|
|
|
|
|
|
import type { ElementRef } from 'react';
|
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
|
|
|
import * as MODALS from 'constants/modal_types';
|
2019-08-13 07:35:13 +02:00
|
|
|
import * as ICONS from 'constants/icons';
|
2020-04-01 20:43:50 +02:00
|
|
|
import * as RENDER_MODES from 'constants/file_render_modes';
|
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
|
|
|
import { DEFAULT_INITIAL_FLOATING_POS } from 'constants/player';
|
2022-02-23 22:13:22 +01:00
|
|
|
import React from 'react';
|
2019-08-13 07:35:13 +02:00
|
|
|
import Button from 'component/button';
|
2018-03-26 23:32:43 +02:00
|
|
|
import classnames from 'classnames';
|
2018-07-05 04:49:12 +02:00
|
|
|
import LoadingScreen from 'component/common/loading-screen';
|
2021-07-06 11:02:05 +02:00
|
|
|
import FileRender from 'component/fileRender';
|
2019-08-13 07:35:13 +02:00
|
|
|
import UriIndicator from 'component/uriIndicator';
|
2019-09-27 20:56:15 +02:00
|
|
|
import usePersistedState from 'effects/use-persisted-state';
|
2020-10-20 19:10:02 +02:00
|
|
|
import { PRIMARY_PLAYER_WRAPPER_CLASS } from 'page/file/view';
|
2021-07-06 11:02:05 +02:00
|
|
|
import Draggable from 'react-draggable';
|
2019-10-14 00:28:12 +02:00
|
|
|
import { onFullscreenChange } from 'util/full-screen';
|
2022-03-15 17:28:55 +01:00
|
|
|
import { generateListSearchUrlParams, formatLbryChannelName } from 'util/url';
|
2022-04-06 23:01:26 +02:00
|
|
|
import { useIsMobile, useIsMobileLandscape, useIsLandscapeScreen } from 'effects/use-screensize';
|
2020-09-10 13:52:42 +02:00
|
|
|
import debounce from 'util/debounce';
|
2021-10-17 10:36:14 +02:00
|
|
|
import { isURIEqual } from 'util/lbryURI';
|
2021-09-10 19:27:21 +02:00
|
|
|
import AutoplayCountdown from 'component/autoplayCountdown';
|
2022-02-23 22:13:22 +01:00
|
|
|
import usePlayNext from 'effects/use-play-next';
|
2022-04-04 14:13:15 +02:00
|
|
|
import {
|
|
|
|
getRootEl,
|
|
|
|
getScreenWidth,
|
|
|
|
getScreenHeight,
|
|
|
|
clampFloatingPlayerToScreen,
|
|
|
|
calculateRelativePos,
|
|
|
|
getMaxLandscapeHeight,
|
|
|
|
getAmountNeededToCenterVideo,
|
|
|
|
getPossiblePlayerHeight,
|
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
|
|
|
} from 'util/window';
|
|
|
|
import PlaylistCard from 'component/playlistCard';
|
2020-09-10 13:52:42 +02:00
|
|
|
|
2021-12-20 13:40:24 +01:00
|
|
|
// scss/init/vars.scss
|
|
|
|
// --header-height
|
2022-02-11 19:50:55 +01:00
|
|
|
const HEADER_HEIGHT = 60;
|
2022-02-23 22:13:22 +01:00
|
|
|
// --header-height-mobile
|
|
|
|
export const HEADER_HEIGHT_MOBILE = 56;
|
2021-12-20 13:40:24 +01:00
|
|
|
|
2021-11-15 22:13:48 +01:00
|
|
|
const DEBOUNCE_WINDOW_RESIZE_HANDLER_MS = 100;
|
2022-04-04 14:13:15 +02:00
|
|
|
|
2021-07-06 11:02:05 +02:00
|
|
|
export const INLINE_PLAYER_WRAPPER_CLASS = 'inline-player__wrapper';
|
2022-04-04 14:13:15 +02:00
|
|
|
export const CONTENT_VIEWER_CLASS = 'content__viewer';
|
2022-02-23 22:13:22 +01:00
|
|
|
export const FLOATING_PLAYER_CLASS = 'content__viewer--floating';
|
2021-11-15 22:13:48 +01:00
|
|
|
|
|
|
|
// ****************************************************************************
|
|
|
|
// ****************************************************************************
|
|
|
|
|
2018-03-26 23:32:43 +02:00
|
|
|
type Props = {
|
2022-03-15 17:28:55 +01:00
|
|
|
claimId: ?string,
|
2022-03-16 12:35:58 +01:00
|
|
|
channelUrl: ?string,
|
2020-04-14 01:48:11 +02:00
|
|
|
isFloating: boolean,
|
2018-03-26 23:32:43 +02:00
|
|
|
uri: string,
|
2019-08-02 08:28:14 +02:00
|
|
|
streamingUrl?: string,
|
2019-08-13 07:35:13 +02:00
|
|
|
title: ?string,
|
|
|
|
floatingPlayerEnabled: boolean,
|
2020-04-01 20:43:50 +02:00
|
|
|
renderMode: string,
|
2022-03-15 17:28:55 +01:00
|
|
|
playingUri: PlayingUri,
|
2020-10-20 19:10:02 +02:00
|
|
|
primaryUri: ?string,
|
2021-01-08 16:21:27 +01:00
|
|
|
videoTheaterMode: boolean,
|
2021-09-02 22:05:32 +02:00
|
|
|
collectionId: string,
|
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
|
|
|
collectionSidebarId: ?string,
|
2021-09-10 19:27:21 +02:00
|
|
|
costInfo: any,
|
|
|
|
claimWasPurchased: boolean,
|
|
|
|
nextListUri: string,
|
|
|
|
previousListUri: string,
|
2022-02-23 22:13:22 +01:00
|
|
|
doFetchRecommendedContent: (uri: string) => void,
|
2022-03-15 17:28:55 +01:00
|
|
|
doUriInitiatePlay: (playingOptions: PlayingUri, isPlayable: ?boolean, isFloating: ?boolean) => void,
|
2022-02-23 22:13:22 +01:00
|
|
|
doSetPlayingUri: ({ uri?: ?string }) => void,
|
|
|
|
isCurrentClaimLive?: boolean,
|
2022-04-04 14:13:15 +02:00
|
|
|
videoAspectRatio: number,
|
2022-04-29 15:54:14 +02:00
|
|
|
socketConnection: { connected: ?boolean },
|
2022-03-15 17:48:57 +01:00
|
|
|
isLivestreamClaim: boolean,
|
2022-03-23 19:24:16 +01:00
|
|
|
geoRestriction: ?GeoRestriction,
|
2022-04-04 14:13:15 +02:00
|
|
|
appDrawerOpen: boolean,
|
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
|
|
|
playingCollection: Collection,
|
|
|
|
hasClaimInQueue: boolean,
|
|
|
|
mainPlayerDimensions: { height: number, width: number },
|
|
|
|
firstCollectionItemUrl: ?string,
|
|
|
|
isMature: boolean,
|
2022-03-15 17:28:55 +01:00
|
|
|
doCommentSocketConnect: (string, string, string) => void,
|
|
|
|
doCommentSocketDisconnect: (string, string) => void,
|
2022-04-29 15:54:14 +02:00
|
|
|
doClearPlayingUri: () => void,
|
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
|
|
|
doClearQueueList: () => void,
|
|
|
|
doOpenModal: (id: string, {}) => void,
|
2018-03-26 23:32:43 +02:00
|
|
|
};
|
2017-04-23 11:56:50 +02:00
|
|
|
|
2020-04-14 01:48:11 +02:00
|
|
|
export default function FileRenderFloating(props: Props) {
|
2020-04-29 22:50:06 +02:00
|
|
|
const {
|
2022-03-15 17:28:55 +01:00
|
|
|
claimId,
|
2022-03-16 12:35:58 +01:00
|
|
|
channelUrl,
|
2020-04-29 22:50:06 +02:00
|
|
|
uri,
|
|
|
|
streamingUrl,
|
|
|
|
title,
|
|
|
|
isFloating,
|
|
|
|
floatingPlayerEnabled,
|
|
|
|
renderMode,
|
2020-10-20 19:10:02 +02:00
|
|
|
playingUri,
|
|
|
|
primaryUri,
|
2021-01-08 16:21:27 +01:00
|
|
|
videoTheaterMode,
|
2021-09-02 22:05:32 +02:00
|
|
|
collectionId,
|
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
|
|
|
collectionSidebarId,
|
2021-09-10 19:27:21 +02:00
|
|
|
costInfo,
|
|
|
|
claimWasPurchased,
|
|
|
|
nextListUri,
|
|
|
|
previousListUri,
|
2022-04-29 15:54:14 +02:00
|
|
|
socketConnection,
|
2022-03-15 17:48:57 +01:00
|
|
|
isLivestreamClaim,
|
2022-02-23 22:13:22 +01:00
|
|
|
doFetchRecommendedContent,
|
|
|
|
doUriInitiatePlay,
|
|
|
|
doSetPlayingUri,
|
|
|
|
isCurrentClaimLive,
|
2022-04-04 14:13:15 +02:00
|
|
|
videoAspectRatio,
|
2022-03-23 19:24:16 +01:00
|
|
|
geoRestriction,
|
2022-04-04 14:13:15 +02:00
|
|
|
appDrawerOpen,
|
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
|
|
|
playingCollection,
|
|
|
|
hasClaimInQueue,
|
|
|
|
mainPlayerDimensions,
|
|
|
|
firstCollectionItemUrl,
|
|
|
|
isMature,
|
2022-03-15 17:28:55 +01:00
|
|
|
doCommentSocketConnect,
|
|
|
|
doCommentSocketDisconnect,
|
2022-04-29 15:54:14 +02:00
|
|
|
doClearPlayingUri,
|
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
|
|
|
doClearQueueList,
|
|
|
|
doOpenModal,
|
2020-04-29 22:50:06 +02:00
|
|
|
} = props;
|
2022-02-23 22:13:22 +01:00
|
|
|
|
2019-12-18 06:27:08 +01:00
|
|
|
const isMobile = useIsMobile();
|
2022-04-06 23:01:26 +02:00
|
|
|
const isTabletLandscape = useIsLandscapeScreen() && !isMobile;
|
2022-04-06 14:01:29 +02:00
|
|
|
const isLandscapeRotated = useIsMobileLandscape();
|
2021-09-24 17:53:17 +02:00
|
|
|
|
2022-04-05 14:59:06 +02:00
|
|
|
const initialMobileState = React.useRef(isMobile);
|
2022-04-04 14:13:15 +02:00
|
|
|
const initialPlayerHeight = React.useRef();
|
|
|
|
const resizedBetweenFloating = React.useRef();
|
|
|
|
|
2022-03-15 17:28:55 +01:00
|
|
|
const { uri: playingUrl, source: playingUriSource, primaryUri: playingPrimaryUri } = playingUri;
|
2022-04-04 14:13:15 +02:00
|
|
|
|
2022-02-23 22:13:22 +01:00
|
|
|
const isComment = playingUriSource === 'comment';
|
2022-04-04 14:13:15 +02:00
|
|
|
const mainFilePlaying = Boolean(!isFloating && primaryUri && isURIEqual(uri, primaryUri));
|
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
|
|
|
const noFloatingPlayer = !isFloating || !floatingPlayerEnabled;
|
2022-02-23 22:13:22 +01:00
|
|
|
|
|
|
|
const [fileViewerRect, setFileViewerRect] = React.useState();
|
|
|
|
const [wasDragging, setWasDragging] = React.useState(false);
|
|
|
|
const [doNavigate, setDoNavigate] = React.useState(false);
|
|
|
|
const [shouldPlayNext, setPlayNext] = React.useState(true);
|
|
|
|
const [countdownCanceled, setCountdownCanceled] = React.useState(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
|
|
|
const [forceDisable, setForceDisable] = React.useState(false);
|
|
|
|
const [position, setPosition] = usePersistedState('floating-file-viewer:position', DEFAULT_INITIAL_FLOATING_POS);
|
|
|
|
const relativePosRef = React.useRef(calculateRelativePos(position.x, position.y));
|
2022-04-26 21:53:59 +02:00
|
|
|
const noPlayerHeight = fileViewerRect?.height === 0;
|
2020-04-14 01:48:11 +02:00
|
|
|
|
2021-09-13 17:24:35 +02:00
|
|
|
const navigateUrl =
|
2022-03-15 17:28:55 +01:00
|
|
|
(playingPrimaryUri || playingUrl || '') + (collectionId ? generateListSearchUrlParams(collectionId) : '');
|
2021-09-02 22:05:32 +02:00
|
|
|
|
2021-09-10 19:27:21 +02:00
|
|
|
const isFree = costInfo && costInfo.cost === 0;
|
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
|
|
|
const isLoading = !costInfo || (!streamingUrl && !costInfo.cost);
|
2021-09-10 19:27:21 +02:00
|
|
|
const canViewFile = isFree || claimWasPurchased;
|
2022-02-23 22:13:22 +01:00
|
|
|
const isPlayable = RENDER_MODES.FLOATING_MODES.includes(renderMode) || isCurrentClaimLive;
|
2022-03-15 17:18:08 +01:00
|
|
|
const isReadyToPlay = isCurrentClaimLive || (isPlayable && streamingUrl);
|
2020-09-10 13:52:42 +02:00
|
|
|
|
2022-04-21 09:31:58 +02:00
|
|
|
const theaterMode = renderMode === 'video' || renderMode === 'audio' ? videoTheaterMode : false;
|
2022-04-20 18:05:01 +02:00
|
|
|
|
2022-02-23 22:13:22 +01:00
|
|
|
// ****************************************************************************
|
|
|
|
// FUNCTIONS
|
|
|
|
// ****************************************************************************
|
2020-09-10 13:52:42 +02:00
|
|
|
|
2021-09-10 19:27:21 +02:00
|
|
|
const handleResize = React.useCallback(() => {
|
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
|
|
|
const filePageElement = document.querySelector(`.${PRIMARY_PLAYER_WRAPPER_CLASS}`);
|
|
|
|
|
|
|
|
const playingElement = mainFilePlaying
|
|
|
|
? filePageElement
|
2020-10-20 19:10:02 +02:00
|
|
|
: document.querySelector(`.${INLINE_PLAYER_WRAPPER_CLASS}`);
|
|
|
|
|
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
|
|
|
const element = playingElement || filePageElement;
|
|
|
|
|
2021-09-13 17:24:35 +02:00
|
|
|
if (!element) return;
|
2020-10-20 19:10:02 +02:00
|
|
|
|
|
|
|
const rect = element.getBoundingClientRect();
|
|
|
|
|
2021-09-13 17:24:35 +02:00
|
|
|
// getBoundingClientRect returns a DomRect, not an object
|
2020-11-06 22:25:47 +01:00
|
|
|
const objectRect = {
|
|
|
|
top: rect.top,
|
|
|
|
right: rect.right,
|
|
|
|
bottom: rect.bottom,
|
|
|
|
left: rect.left,
|
|
|
|
width: rect.width,
|
|
|
|
height: rect.height,
|
2020-11-09 19:36:35 +01:00
|
|
|
// $FlowFixMe
|
|
|
|
x: rect.x,
|
2020-11-06 22:25:47 +01:00
|
|
|
};
|
|
|
|
|
2022-04-05 14:59:06 +02:00
|
|
|
// replace the initial value every time the window is resized if isMobile is true,
|
|
|
|
// since it could be a portrait -> landscape rotation switch, or if it was a mobile - desktop
|
|
|
|
// switch, so use the ref to compare the initial state
|
|
|
|
const resizedEnoughForMobileSwitch = isMobile !== initialMobileState.current;
|
|
|
|
if (videoAspectRatio && (!initialPlayerHeight.current || isMobile || resizedEnoughForMobileSwitch)) {
|
2022-04-04 14:13:15 +02:00
|
|
|
const heightForRect = getPossiblePlayerHeight(videoAspectRatio * rect.width, isMobile);
|
|
|
|
initialPlayerHeight.current = heightForRect;
|
|
|
|
}
|
|
|
|
|
2020-10-20 19:10:02 +02:00
|
|
|
// $FlowFixMe
|
2020-11-06 22:25:47 +01:00
|
|
|
setFileViewerRect({ ...objectRect, windowOffset: window.pageYOffset });
|
2022-04-04 14:13:15 +02:00
|
|
|
}, [isMobile, mainFilePlaying, videoAspectRatio]);
|
2022-02-23 22:13:22 +01:00
|
|
|
|
|
|
|
const restoreToRelativePosition = React.useCallback(() => {
|
|
|
|
const SCROLL_BAR_PX = 12; // root: --body-scrollbar-width
|
|
|
|
const screenW = getScreenWidth() - SCROLL_BAR_PX;
|
|
|
|
const screenH = getScreenHeight();
|
|
|
|
|
|
|
|
const newX = Math.round(relativePosRef.current.x * screenW);
|
|
|
|
const newY = Math.round(relativePosRef.current.y * screenH);
|
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
|
|
|
const clampPosition = clampFloatingPlayerToScreen({ x: newX, y: newY });
|
2022-02-23 22:13:22 +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
|
|
|
if (![clampPosition.x, clampPosition.y].some(isNaN)) {
|
|
|
|
setPosition(clampPosition);
|
|
|
|
}
|
2022-02-23 22:13:22 +01:00
|
|
|
}, [setPosition]);
|
|
|
|
|
|
|
|
const clampToScreenOnResize = React.useCallback(
|
|
|
|
debounce(restoreToRelativePosition, DEBOUNCE_WINDOW_RESIZE_HANDLER_MS),
|
|
|
|
[]
|
|
|
|
);
|
|
|
|
|
|
|
|
// For playlists when pressing next/previous etc and switching players
|
|
|
|
function resetState() {
|
|
|
|
setCountdownCanceled(false);
|
|
|
|
setDoNavigate(false);
|
|
|
|
setPlayNext(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
// ****************************************************************************
|
|
|
|
// EFFECTS
|
|
|
|
// ****************************************************************************
|
|
|
|
|
|
|
|
usePlayNext(
|
|
|
|
isFloating,
|
|
|
|
collectionId,
|
|
|
|
shouldPlayNext,
|
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
|
|
|
nextListUri || firstCollectionItemUrl,
|
2022-02-23 22:13:22 +01:00
|
|
|
previousListUri,
|
|
|
|
doNavigate,
|
|
|
|
doUriInitiatePlay,
|
|
|
|
resetState
|
|
|
|
);
|
|
|
|
|
2022-03-15 17:28:55 +01:00
|
|
|
// Establish web socket connection for viewer count.
|
2022-02-23 22:13:22 +01:00
|
|
|
React.useEffect(() => {
|
2022-03-16 12:35:58 +01:00
|
|
|
if (!claimId || !channelUrl || !isCurrentClaimLive) return;
|
2022-03-15 17:28:55 +01:00
|
|
|
|
2022-03-16 12:35:58 +01:00
|
|
|
const channelName = formatLbryChannelName(channelUrl);
|
2022-03-15 17:28:55 +01:00
|
|
|
|
2022-03-16 12:35:58 +01:00
|
|
|
// Only connect if not yet connected, so for example clicked on an embed instead of accessing
|
|
|
|
// from the Livestream page
|
2022-04-29 15:54:14 +02:00
|
|
|
if (!socketConnection?.connected) {
|
|
|
|
doCommentSocketConnect(uri, channelName, claimId);
|
|
|
|
}
|
2022-03-15 17:28:55 +01:00
|
|
|
|
2022-03-16 12:35:58 +01:00
|
|
|
// This will be used to disconnect for every case, since this is the main player component
|
2022-04-29 15:54:14 +02:00
|
|
|
return () => {
|
|
|
|
if (socketConnection?.connected) {
|
|
|
|
doCommentSocketDisconnect(claimId, channelName);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}, [
|
|
|
|
channelUrl,
|
|
|
|
claimId,
|
|
|
|
doCommentSocketConnect,
|
|
|
|
doCommentSocketDisconnect,
|
|
|
|
isCurrentClaimLive,
|
|
|
|
socketConnection,
|
|
|
|
uri,
|
|
|
|
]);
|
2022-03-15 17:28:55 +01:00
|
|
|
|
|
|
|
React.useEffect(() => {
|
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
|
|
|
if (playingPrimaryUri || playingUrl || noPlayerHeight || collectionSidebarId) {
|
2020-10-20 19:10:02 +02:00
|
|
|
handleResize();
|
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
|
|
|
setCountdownCanceled(false);
|
2019-08-13 07:35:13 +02: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
|
|
|
}, [handleResize, playingPrimaryUri, theaterMode, playingUrl, noPlayerHeight, collectionSidebarId]);
|
2019-08-13 07:35:13 +02:00
|
|
|
|
2022-02-23 22:13:22 +01:00
|
|
|
// Listen to main-window resizing and adjust the floating player position accordingly:
|
|
|
|
React.useEffect(() => {
|
2022-04-04 14:13:15 +02:00
|
|
|
// intended to only run once: when floating player switches between true - false
|
|
|
|
// otherwise handleResize() can run twice when this effect re-runs, so use
|
|
|
|
// resizedBetweenFloating ref
|
2022-02-23 22:13:22 +01:00
|
|
|
if (isFloating) {
|
|
|
|
// Ensure player is within screen when 'isFloating' changes.
|
|
|
|
restoreToRelativePosition();
|
2022-04-04 14:13:15 +02:00
|
|
|
resizedBetweenFloating.current = false;
|
|
|
|
} else if (!resizedBetweenFloating.current) {
|
2022-02-23 22:13:22 +01:00
|
|
|
handleResize();
|
2022-04-04 14:13:15 +02:00
|
|
|
resizedBetweenFloating.current = true;
|
2022-02-23 22:13:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function onWindowResize() {
|
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
|
|
|
if (isFloating) clampToScreenOnResize();
|
|
|
|
if (collectionSidebarId || !isFloating) handleResize();
|
2022-02-23 22:13:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
window.addEventListener('resize', onWindowResize);
|
2022-04-04 14:13:15 +02:00
|
|
|
if (!isFloating && !isMobile) onFullscreenChange(window, 'add', handleResize);
|
2020-10-20 19:10:02 +02:00
|
|
|
|
2019-12-19 21:43:49 +01:00
|
|
|
return () => {
|
2022-02-23 22:13:22 +01:00
|
|
|
window.removeEventListener('resize', onWindowResize);
|
2022-04-04 14:13:15 +02:00
|
|
|
if (!isFloating && !isMobile) onFullscreenChange(window, 'remove', handleResize);
|
2019-12-19 21:43:49 +01:00
|
|
|
};
|
2020-04-01 20:43:50 +02:00
|
|
|
|
2022-02-23 22:13:22 +01:00
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
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
|
|
|
}, [clampToScreenOnResize, handleResize, isFloating, collectionSidebarId]);
|
2022-02-23 22:13:22 +01:00
|
|
|
|
|
|
|
React.useEffect(() => {
|
|
|
|
// Initial update for relativePosRef:
|
|
|
|
relativePosRef.current = calculateRelativePos(position.x, position.y);
|
|
|
|
|
|
|
|
// only on mount
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
React.useEffect(() => {
|
|
|
|
if (isFloating && isComment) {
|
|
|
|
// When the player begins floating, remove the comment source
|
|
|
|
// so that it doesn't try to resize again in case of going back
|
|
|
|
// to the origin's comment section and fail to position correctly
|
|
|
|
doSetPlayingUri({ ...playingUri, source: null });
|
2021-03-19 16:04:12 +01:00
|
|
|
}
|
2022-02-23 22:13:22 +01:00
|
|
|
}, [doSetPlayingUri, isComment, isFloating, playingUri]);
|
2021-09-10 19:27:21 +02:00
|
|
|
|
2022-02-23 22:13:22 +01:00
|
|
|
React.useEffect(() => {
|
|
|
|
if (isFloating) doFetchRecommendedContent(uri);
|
|
|
|
}, [doFetchRecommendedContent, isFloating, uri]);
|
2021-03-19 16:04:12 +01:00
|
|
|
|
2022-02-23 22:13:22 +01:00
|
|
|
React.useEffect(() => {
|
2022-04-04 14:13:15 +02:00
|
|
|
return () => {
|
|
|
|
// basically if switched videos (playingUrl change or unmount),
|
|
|
|
// erase the data so it can be re-calculated
|
|
|
|
if (playingUrl) {
|
|
|
|
initialPlayerHeight.current = undefined;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}, [playingUrl]);
|
2021-09-10 19:27:21 +02:00
|
|
|
|
2022-04-29 15:54:14 +02:00
|
|
|
React.useEffect(() => {
|
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
|
|
|
if (primaryUri && uri && primaryUri !== uri && !floatingPlayerEnabled && playingUrl) {
|
2022-04-29 15:54:14 +02:00
|
|
|
doClearPlayingUri();
|
|
|
|
}
|
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
|
|
|
}, [doClearPlayingUri, floatingPlayerEnabled, playingUrl, primaryUri, uri]);
|
2022-04-29 15:54:14 +02:00
|
|
|
|
2021-09-10 19:27:21 +02:00
|
|
|
if (
|
2022-03-23 19:24:16 +01:00
|
|
|
geoRestriction ||
|
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
|
|
|
(!isPlayable && !collectionSidebarId) ||
|
|
|
|
(!uri && !collectionSidebarId) ||
|
2022-02-23 22:13:22 +01:00
|
|
|
(isFloating && noFloatingPlayer) ||
|
2022-03-15 17:48:57 +01:00
|
|
|
(collectionId && !isFloating && ((!canViewFile && !nextListUri) || countdownCanceled)) ||
|
|
|
|
(isLivestreamClaim && !isCurrentClaimLive)
|
2021-09-10 19:27:21 +02:00
|
|
|
) {
|
2020-04-01 20:43:50 +02:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2022-02-23 22:13:22 +01:00
|
|
|
// ****************************************************************************
|
|
|
|
// RENDER
|
|
|
|
// ****************************************************************************
|
|
|
|
|
2021-09-13 17:24:35 +02:00
|
|
|
function handleDragStart() {
|
2020-08-27 08:02:43 +02:00
|
|
|
// Not really necessary, but reset just in case 'handleStop' didn't fire.
|
|
|
|
setWasDragging(false);
|
|
|
|
}
|
|
|
|
|
2020-09-09 04:14:51 +02:00
|
|
|
function handleDragMove(e, ui) {
|
2019-08-14 05:04:08 +02:00
|
|
|
const { x, y } = position;
|
2021-11-15 22:13:48 +01:00
|
|
|
const newX = ui.x;
|
|
|
|
const newY = ui.y;
|
|
|
|
|
2021-11-08 12:51:03 +01:00
|
|
|
// Mark as dragging if the position changed and we were not dragging before.
|
|
|
|
if (!wasDragging && (newX !== x || newY !== y)) {
|
|
|
|
setWasDragging(true);
|
|
|
|
}
|
2019-08-14 05:04:08 +02:00
|
|
|
}
|
|
|
|
|
2021-11-15 22:13:48 +01:00
|
|
|
function handleDragStop(e, ui) {
|
2022-02-23 22:13:22 +01:00
|
|
|
if (wasDragging) setWasDragging(false);
|
|
|
|
const { x, y } = ui;
|
|
|
|
let newPos = { x, y };
|
2021-11-15 22:13:48 +01:00
|
|
|
|
|
|
|
if (newPos.x !== position.x || newPos.y !== position.y) {
|
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
|
|
|
newPos = clampFloatingPlayerToScreen(newPos);
|
2022-02-23 22:13:22 +01:00
|
|
|
|
2021-11-15 22:13:48 +01:00
|
|
|
setPosition(newPos);
|
|
|
|
relativePosRef.current = calculateRelativePos(newPos.x, newPos.y);
|
2020-08-27 08:02:43 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-02 08:28:14 +02:00
|
|
|
return (
|
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
|
|
|
<>
|
|
|
|
{(uri && videoAspectRatio) || collectionSidebarId ? (
|
|
|
|
<PlayerGlobalStyles
|
|
|
|
videoAspectRatio={videoAspectRatio}
|
|
|
|
theaterMode={theaterMode}
|
|
|
|
appDrawerOpen={appDrawerOpen && !isLandscapeRotated && !isTabletLandscape}
|
|
|
|
initialPlayerHeight={initialPlayerHeight}
|
|
|
|
isFloating={isFloating}
|
|
|
|
fileViewerRect={fileViewerRect || mainPlayerDimensions}
|
|
|
|
mainFilePlaying={mainFilePlaying}
|
|
|
|
isLandscapeRotated={isLandscapeRotated}
|
|
|
|
isTabletLandscape={isTabletLandscape}
|
|
|
|
/>
|
|
|
|
) : null}
|
|
|
|
|
|
|
|
{uri && isPlayable && (
|
|
|
|
<Draggable
|
|
|
|
onDrag={handleDragMove}
|
|
|
|
onStart={handleDragStart}
|
|
|
|
onStop={handleDragStop}
|
|
|
|
defaultPosition={position}
|
|
|
|
position={isFloating ? position : { x: 0, y: 0 }}
|
|
|
|
bounds="parent"
|
|
|
|
handle=".draggable"
|
|
|
|
cancel=".button"
|
|
|
|
disabled={noFloatingPlayer || forceDisable}
|
|
|
|
>
|
|
|
|
<div
|
|
|
|
className={classnames([CONTENT_VIEWER_CLASS], {
|
|
|
|
[FLOATING_PLAYER_CLASS]: isFloating,
|
|
|
|
'content__viewer--inline': !isFloating,
|
|
|
|
'content__viewer--secondary': isComment,
|
|
|
|
'content__viewer--theater-mode': theaterMode && mainFilePlaying && !isCurrentClaimLive && !isMobile,
|
|
|
|
'content__viewer--disable-click': wasDragging,
|
|
|
|
'content__viewer--mobile': isMobile && !isLandscapeRotated && !playingUriSource,
|
|
|
|
})}
|
|
|
|
style={
|
|
|
|
!isFloating && fileViewerRect
|
|
|
|
? {
|
|
|
|
width: fileViewerRect.width,
|
|
|
|
height: appDrawerOpen ? `${getMaxLandscapeHeight()}px` : fileViewerRect.height,
|
|
|
|
left: fileViewerRect.x,
|
|
|
|
top:
|
|
|
|
isMobile && !playingUriSource
|
|
|
|
? HEADER_HEIGHT_MOBILE
|
|
|
|
: fileViewerRect.windowOffset + fileViewerRect.top - HEADER_HEIGHT,
|
|
|
|
}
|
|
|
|
: {}
|
|
|
|
}
|
|
|
|
>
|
|
|
|
<div className={classnames('content__wrapper', { 'content__wrapper--floating': isFloating })}>
|
|
|
|
{isFloating && (
|
|
|
|
<Button
|
|
|
|
title={__('Close')}
|
|
|
|
onClick={() => {
|
|
|
|
if (hasClaimInQueue) {
|
|
|
|
doOpenModal(MODALS.CONFIRM, {
|
|
|
|
title: __('Close Player'),
|
|
|
|
subtitle: __('Are you sure you want to close the player and clear the current Queue?'),
|
|
|
|
onConfirm: (closeModal) => {
|
|
|
|
doClearPlayingUri();
|
|
|
|
doClearQueueList();
|
|
|
|
closeModal();
|
|
|
|
},
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
doClearPlayingUri();
|
|
|
|
}
|
|
|
|
}}
|
|
|
|
icon={ICONS.REMOVE}
|
|
|
|
button="primary"
|
|
|
|
className="content__floating-close"
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
|
|
|
|
{isReadyToPlay && !isMature ? (
|
|
|
|
<FileRender className={classnames({ draggable: !isMobile })} uri={uri} />
|
|
|
|
) : isLoading ? (
|
|
|
|
<LoadingScreen status={__('Loading')} />
|
|
|
|
) : (
|
|
|
|
(!collectionId || !canViewFile || isMature) && (
|
|
|
|
<div className="content__loading">
|
|
|
|
<AutoplayCountdown
|
|
|
|
uri={uri}
|
|
|
|
nextRecommendedUri={nextListUri || firstCollectionItemUrl}
|
|
|
|
doNavigate={() => setDoNavigate(true)}
|
|
|
|
doReplay={() => doUriInitiatePlay({ uri, collection: { collectionId } }, false, isFloating)}
|
|
|
|
doPrevious={
|
|
|
|
!previousListUri
|
|
|
|
? undefined
|
|
|
|
: () => {
|
|
|
|
setPlayNext(false);
|
|
|
|
setDoNavigate(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
onCanceled={() => setCountdownCanceled(true)}
|
|
|
|
skipPaid
|
|
|
|
skipMature
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
)}
|
|
|
|
|
|
|
|
{isFloating && (
|
|
|
|
<div className={classnames('content__info', { draggable: !isMobile })}>
|
|
|
|
<div className="content-info__text">
|
|
|
|
<div className="claim-preview__title" title={title || uri}>
|
|
|
|
<Button
|
|
|
|
label={title || uri}
|
|
|
|
navigate={navigateUrl}
|
|
|
|
button="link"
|
|
|
|
className="content__floating-link"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<UriIndicator link uri={uri} />
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{playingCollection && collectionSidebarId !== collectionId && (
|
|
|
|
<PlaylistCard
|
|
|
|
id={collectionId}
|
|
|
|
uri={uri}
|
|
|
|
disableClickNavigation
|
|
|
|
doDisablePlayerDrag={setForceDisable}
|
|
|
|
isFloating
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
)}
|
2021-07-06 11:02:05 +02:00
|
|
|
</div>
|
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
|
|
|
</div>
|
|
|
|
</Draggable>
|
|
|
|
)}
|
|
|
|
</>
|
2019-08-02 08:28:14 +02:00
|
|
|
);
|
2017-04-23 11:56:50 +02:00
|
|
|
}
|
2022-04-04 14:13:15 +02:00
|
|
|
|
|
|
|
type GlobalStylesProps = {
|
|
|
|
videoAspectRatio: number,
|
2022-04-20 18:05:01 +02:00
|
|
|
theaterMode: boolean,
|
2022-04-04 14:13:15 +02:00
|
|
|
appDrawerOpen: boolean,
|
|
|
|
initialPlayerHeight: ElementRef<any>,
|
|
|
|
isFloating: boolean,
|
|
|
|
fileViewerRect: any,
|
|
|
|
mainFilePlaying: boolean,
|
2022-04-06 14:01:29 +02:00
|
|
|
isLandscapeRotated: boolean,
|
2022-04-06 23:01:26 +02:00
|
|
|
isTabletLandscape: boolean,
|
2022-04-04 14:13:15 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
const PlayerGlobalStyles = (props: GlobalStylesProps) => {
|
|
|
|
const {
|
|
|
|
videoAspectRatio,
|
2022-04-20 18:05:01 +02:00
|
|
|
theaterMode,
|
2022-04-04 14:13:15 +02:00
|
|
|
appDrawerOpen,
|
|
|
|
initialPlayerHeight,
|
|
|
|
isFloating,
|
|
|
|
fileViewerRect,
|
|
|
|
mainFilePlaying,
|
2022-04-06 14:01:29 +02:00
|
|
|
isLandscapeRotated,
|
2022-04-06 23:01:26 +02:00
|
|
|
isTabletLandscape,
|
2022-04-04 14:13:15 +02:00
|
|
|
} = props;
|
|
|
|
|
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
|
|
|
const justChanged = React.useRef();
|
|
|
|
|
2022-04-04 14:13:15 +02:00
|
|
|
const isMobile = useIsMobile();
|
|
|
|
const isMobilePlayer = isMobile && !isFloating; // to avoid miniplayer -> file page only
|
|
|
|
|
|
|
|
const heightForViewer = getPossiblePlayerHeight(videoAspectRatio * fileViewerRect.width, isMobile);
|
|
|
|
const widthForViewer = heightForViewer / videoAspectRatio;
|
|
|
|
const maxLandscapeHeight = getMaxLandscapeHeight(isMobile ? undefined : widthForViewer);
|
|
|
|
const heightResult = appDrawerOpen ? `${maxLandscapeHeight}px` : `${heightForViewer}px`;
|
2022-04-05 15:09:21 +02:00
|
|
|
const amountNeededToCenter = getAmountNeededToCenterVideo(heightForViewer, maxLandscapeHeight);
|
2022-04-04 14:13:15 +02:00
|
|
|
|
2022-04-05 15:09:21 +02:00
|
|
|
// forceDefaults = no styles should be applied to any of these conditions
|
|
|
|
// !mainFilePlaying = embeds on markdown (comments or posts)
|
2022-04-20 18:05:01 +02:00
|
|
|
const forceDefaults = !mainFilePlaying || theaterMode || isFloating || isMobile;
|
2022-04-05 15:09:21 +02:00
|
|
|
|
2022-04-04 14:13:15 +02:00
|
|
|
const videoGreaterThanLandscape = heightForViewer > maxLandscapeHeight;
|
|
|
|
|
|
|
|
// Handles video shrink + center on mobile view
|
|
|
|
// direct DOM manipulation due to performance for every scroll
|
|
|
|
React.useEffect(() => {
|
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
|
|
|
if (!isMobilePlayer || !mainFilePlaying || isLandscapeRotated || isTabletLandscape) return;
|
2022-04-04 14:13:15 +02:00
|
|
|
|
|
|
|
const viewer = document.querySelector(`.${CONTENT_VIEWER_CLASS}`);
|
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
|
|
|
if (viewer) {
|
|
|
|
if (!appDrawerOpen && heightForViewer) viewer.style.height = `${heightForViewer}px`;
|
|
|
|
|
|
|
|
if (!appDrawerOpen) {
|
|
|
|
const htmlEl = document.querySelector('html');
|
|
|
|
if (htmlEl) htmlEl.scrollTop = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
justChanged.current = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (appDrawerOpen) return;
|
2022-04-04 14:13:15 +02:00
|
|
|
|
|
|
|
function handleScroll() {
|
|
|
|
const rootEl = getRootEl();
|
|
|
|
|
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
|
|
|
if (justChanged.current) {
|
|
|
|
justChanged.current = false;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-04-04 14:13:15 +02:00
|
|
|
const viewer = document.querySelector(`.${CONTENT_VIEWER_CLASS}`);
|
|
|
|
const videoNode = document.querySelector('.vjs-tech');
|
|
|
|
const touchOverlay = document.querySelector('.vjs-touch-overlay');
|
|
|
|
|
|
|
|
if (rootEl && viewer) {
|
|
|
|
const scrollTop = window.pageYOffset || rootEl.scrollTop;
|
|
|
|
const isHigherThanLandscape = scrollTop < initialPlayerHeight.current - maxLandscapeHeight;
|
|
|
|
|
|
|
|
if (videoNode) {
|
|
|
|
if (isHigherThanLandscape) {
|
|
|
|
if (initialPlayerHeight.current > maxLandscapeHeight) {
|
|
|
|
const result = initialPlayerHeight.current - scrollTop;
|
|
|
|
const amountNeededToCenter = getAmountNeededToCenterVideo(videoNode.offsetHeight, result);
|
|
|
|
|
|
|
|
videoNode.style.top = `${amountNeededToCenter}px`;
|
|
|
|
if (touchOverlay) touchOverlay.style.height = `${result}px`;
|
|
|
|
viewer.style.height = `${result}px`;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (touchOverlay) touchOverlay.style.height = `${maxLandscapeHeight}px`;
|
|
|
|
viewer.style.height = `${maxLandscapeHeight}px`;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
window.addEventListener('scroll', handleScroll);
|
|
|
|
|
|
|
|
return () => {
|
|
|
|
const touchOverlay = document.querySelector('.vjs-touch-overlay');
|
|
|
|
if (touchOverlay) touchOverlay.removeAttribute('style');
|
|
|
|
|
|
|
|
window.removeEventListener('scroll', handleScroll);
|
|
|
|
};
|
2022-04-06 14:01:29 +02:00
|
|
|
}, [
|
|
|
|
appDrawerOpen,
|
|
|
|
heightForViewer,
|
|
|
|
isMobilePlayer,
|
|
|
|
mainFilePlaying,
|
|
|
|
maxLandscapeHeight,
|
|
|
|
initialPlayerHeight,
|
|
|
|
isLandscapeRotated,
|
2022-04-06 23:01:26 +02:00
|
|
|
isTabletLandscape,
|
2022-04-06 14:01:29 +02:00
|
|
|
]);
|
2022-04-04 14:13:15 +02:00
|
|
|
|
2022-04-05 15:09:21 +02:00
|
|
|
React.useEffect(() => {
|
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
|
|
|
if (videoGreaterThanLandscape && isMobilePlayer) {
|
2022-04-05 15:09:21 +02:00
|
|
|
const videoNode = document.querySelector('.vjs-tech');
|
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
|
|
|
if (videoNode) {
|
|
|
|
const top = appDrawerOpen ? amountNeededToCenter : 0;
|
|
|
|
videoNode.style.top = `${top}px`;
|
|
|
|
}
|
2022-04-05 15:09:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (isMobile && isFloating) {
|
|
|
|
const viewer = document.querySelector(`.${CONTENT_VIEWER_CLASS}`);
|
|
|
|
if (viewer) viewer.removeAttribute('style');
|
|
|
|
const touchOverlay = document.querySelector('.vjs-touch-overlay');
|
|
|
|
if (touchOverlay) touchOverlay.removeAttribute('style');
|
|
|
|
const videoNode = document.querySelector('.vjs-tech');
|
|
|
|
if (videoNode) videoNode.removeAttribute('style');
|
|
|
|
}
|
|
|
|
}, [amountNeededToCenter, appDrawerOpen, isFloating, isMobile, isMobilePlayer, videoGreaterThanLandscape]);
|
|
|
|
|
2022-04-06 23:01:26 +02:00
|
|
|
React.useEffect(() => {
|
|
|
|
if (isTabletLandscape) {
|
|
|
|
const videoNode = document.querySelector('.vjs-tech');
|
|
|
|
if (videoNode) videoNode.removeAttribute('style');
|
|
|
|
const touchOverlay = document.querySelector('.vjs-touch-overlay');
|
|
|
|
if (touchOverlay) touchOverlay.removeAttribute('style');
|
|
|
|
}
|
|
|
|
}, [isTabletLandscape]);
|
|
|
|
|
2022-04-04 14:13:15 +02:00
|
|
|
// -- render styles --
|
|
|
|
|
|
|
|
// declaring some style objects as variables makes it easier for repeated cases
|
|
|
|
const transparentBackground = {
|
|
|
|
background: videoGreaterThanLandscape && mainFilePlaying && !forceDefaults ? 'transparent !important' : undefined,
|
|
|
|
};
|
2022-04-05 14:59:06 +02:00
|
|
|
const maxHeight = {
|
2022-04-20 18:05:01 +02:00
|
|
|
maxHeight: !theaterMode && !isMobile ? 'var(--desktop-portrait-player-max-height)' : undefined,
|
2022-04-05 14:59:06 +02:00
|
|
|
};
|
2022-04-04 14:13:15 +02:00
|
|
|
|
|
|
|
return (
|
|
|
|
<Global
|
|
|
|
styles={{
|
|
|
|
[`.${PRIMARY_PLAYER_WRAPPER_CLASS}`]: {
|
2022-04-26 21:53:59 +02:00
|
|
|
height:
|
|
|
|
!theaterMode && mainFilePlaying && fileViewerRect?.height > 0 ? `${heightResult} !important` : undefined,
|
2022-04-20 18:05:01 +02:00
|
|
|
opacity: !theaterMode && mainFilePlaying ? '0 !important' : undefined,
|
2022-04-04 14:13:15 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
'.file-render--video': {
|
|
|
|
...transparentBackground,
|
|
|
|
...maxHeight,
|
|
|
|
|
|
|
|
video: maxHeight,
|
|
|
|
},
|
|
|
|
'.content__wrapper': transparentBackground,
|
2022-04-06 23:01:26 +02:00
|
|
|
'.video-js': {
|
|
|
|
...transparentBackground,
|
|
|
|
|
|
|
|
'.vjs-touch-overlay': {
|
|
|
|
maxHeight: isTabletLandscape ? 'var(--desktop-portrait-player-max-height) !important' : undefined,
|
|
|
|
},
|
|
|
|
},
|
2022-04-04 14:13:15 +02:00
|
|
|
|
|
|
|
'.vjs-fullscreen': {
|
|
|
|
video: {
|
|
|
|
top: 'unset !important',
|
|
|
|
height: '100% !important',
|
|
|
|
},
|
|
|
|
'.vjs-touch-overlay': {
|
|
|
|
height: '100% !important',
|
|
|
|
maxHeight: 'unset !important',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
'.vjs-tech': {
|
|
|
|
opacity: '1',
|
|
|
|
height:
|
|
|
|
isMobilePlayer && ((appDrawerOpen && videoGreaterThanLandscape) || videoGreaterThanLandscape)
|
|
|
|
? 'unset !important'
|
|
|
|
: '100%',
|
|
|
|
position: 'absolute',
|
|
|
|
top: isFloating ? '0px !important' : undefined,
|
|
|
|
},
|
|
|
|
|
|
|
|
[`.${CONTENT_VIEWER_CLASS}`]: {
|
2022-04-06 14:01:29 +02:00
|
|
|
height:
|
|
|
|
(!forceDefaults || isLandscapeRotated) && (!isMobile || isMobilePlayer)
|
|
|
|
? `${heightResult} !important`
|
|
|
|
: undefined,
|
2022-04-04 14:13:15 +02:00
|
|
|
...maxHeight,
|
|
|
|
},
|
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
|
|
|
|
|
|
|
'.playlist-card': {
|
|
|
|
maxHeight:
|
|
|
|
!isMobile && !theaterMode && mainFilePlaying
|
|
|
|
? `${heightForViewer}px`
|
|
|
|
: isMobile
|
|
|
|
? '100%'
|
|
|
|
: fileViewerRect
|
|
|
|
? `${fileViewerRect.height}px`
|
|
|
|
: undefined,
|
|
|
|
},
|
2022-04-04 14:13:15 +02:00
|
|
|
}}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|