2020-01-20 17:47:03 +01:00
|
|
|
// @flow
|
2021-12-22 17:12:44 +01:00
|
|
|
import React from 'react';
|
2020-01-20 17:47:03 +01:00
|
|
|
import classnames from 'classnames';
|
|
|
|
import { NavLink, withRouter } from 'react-router-dom';
|
|
|
|
import FileThumbnail from 'component/fileThumbnail';
|
|
|
|
import UriIndicator from 'component/uriIndicator';
|
|
|
|
import TruncatedText from 'component/common/truncated-text';
|
|
|
|
import DateTime from 'component/dateTime';
|
2021-12-22 17:12:44 +01:00
|
|
|
import LivestreamDateTime from 'component/livestreamDateTime';
|
2020-01-20 17:47:03 +01:00
|
|
|
import ChannelThumbnail from 'component/channelThumbnail';
|
2021-09-09 09:02:31 +02:00
|
|
|
import FileViewCountInline from 'component/fileViewCountInline';
|
2020-01-20 17:47:03 +01:00
|
|
|
import SubscribeButton from 'component/subscribeButton';
|
|
|
|
import useGetThumbnail from 'effects/use-get-thumbnail';
|
2021-09-10 19:27:21 +02:00
|
|
|
import { formatLbryUrlForWeb, generateListSearchUrlParams } from 'util/url';
|
2021-07-22 10:24:25 +02:00
|
|
|
import { formatClaimPreviewTitle } from 'util/formatAriaLabel';
|
2021-10-25 16:56:31 +02:00
|
|
|
import { parseURI } from 'util/lbryURI';
|
wip
wip
wip - everything but publish, autoplay, and styling
collection publishing
add channel to collection publish
cleanup
wip
bump
clear mass add after success
move collection item management controls
redirect replace to published collection id
bump
playlist selector on create
bump
use new collection add ui element
bump
wip
gitignore
add content json
wip
bump
context add to playlist
basic collections page style pass wip
wip: edits, buttons, styles...
change fileAuthor to claimAuthor
update, pending bugfixes, delete modal progress, collection header, other bugfixes
bump
cleaning
show page bugfix
builtin collection headers
no playlists, no grid title
wip
style tweaks
use normal looking claim previews for collection tiles
add collection changes
style library previews
collection menulist for delete/view on library
delete modal works for unpublished
rearrange collection publish tabs
clean up collection publishing and items
show on odysee
begin collectoin edit header and css renaming
better thumbnails
bump
fix collection publish redirect
view collection in menu does something
copy and thumbs
list previews, pending, context menus, list page
enter to add collection, lists page empty state
playable lists only, delete feature, bump
put fileListDownloaded back
better collection titles
improve collection claim details
fix horiz more icon
fix up channel page
style, copy, bump
refactor preview overlay properties,
fix reposts showing as floppydisk
add watch later toast,
small overlay properties on wunderbar results,
fix collection actions buttons
bump
cleanup
cleaning, refactoring
bump
preview thumb styling, cleanup
support discover page lists search
sync, bump
bump, fix sync more
enforce builtin order for now
new lists page empty state
try to indicate unpublished edits in lists
bump
fix autoplay and linting
consts, fix autoplay
bugs
fixes
cleanup
fix, bump
lists experimental ui, fixes
refactor listIndex out
hack in collection fallback thumb
bump
2021-02-06 08:03:51 +01:00
|
|
|
import PreviewOverlayProperties from 'component/previewOverlayProperties';
|
2020-01-25 20:42:39 +01:00
|
|
|
import FileDownloadLink from 'component/fileDownloadLink';
|
2021-06-18 17:22:44 +02:00
|
|
|
import FileWatchLaterLink from 'component/fileWatchLaterLink';
|
2020-01-31 17:43:14 +01:00
|
|
|
import ClaimRepostAuthor from 'component/claimRepostAuthor';
|
2021-03-03 19:50:16 +01:00
|
|
|
import ClaimMenuList from 'component/claimMenuList';
|
wip
wip
wip - everything but publish, autoplay, and styling
collection publishing
add channel to collection publish
cleanup
wip
bump
clear mass add after success
move collection item management controls
redirect replace to published collection id
bump
playlist selector on create
bump
use new collection add ui element
bump
wip
gitignore
add content json
wip
bump
context add to playlist
basic collections page style pass wip
wip: edits, buttons, styles...
change fileAuthor to claimAuthor
update, pending bugfixes, delete modal progress, collection header, other bugfixes
bump
cleaning
show page bugfix
builtin collection headers
no playlists, no grid title
wip
style tweaks
use normal looking claim previews for collection tiles
add collection changes
style library previews
collection menulist for delete/view on library
delete modal works for unpublished
rearrange collection publish tabs
clean up collection publishing and items
show on odysee
begin collectoin edit header and css renaming
better thumbnails
bump
fix collection publish redirect
view collection in menu does something
copy and thumbs
list previews, pending, context menus, list page
enter to add collection, lists page empty state
playable lists only, delete feature, bump
put fileListDownloaded back
better collection titles
improve collection claim details
fix horiz more icon
fix up channel page
style, copy, bump
refactor preview overlay properties,
fix reposts showing as floppydisk
add watch later toast,
small overlay properties on wunderbar results,
fix collection actions buttons
bump
cleanup
cleaning, refactoring
bump
preview thumb styling, cleanup
support discover page lists search
sync, bump
bump, fix sync more
enforce builtin order for now
new lists page empty state
try to indicate unpublished edits in lists
bump
fix autoplay and linting
consts, fix autoplay
bugs
fixes
cleanup
fix, bump
lists experimental ui, fixes
refactor listIndex out
hack in collection fallback thumb
bump
2021-02-06 08:03:51 +01:00
|
|
|
import CollectionPreviewOverlay from 'component/collectionPreviewOverlay';
|
2021-07-19 03:42:04 +02:00
|
|
|
// $FlowFixMe cannot resolve ...
|
|
|
|
import PlaceholderTx from 'static/img/placeholderTx.gif';
|
2021-03-03 19:50:16 +01:00
|
|
|
|
2020-01-20 17:47:03 +01:00
|
|
|
type Props = {
|
|
|
|
uri: string,
|
2021-07-16 02:44:51 +02:00
|
|
|
date?: any,
|
2020-01-20 17:47:03 +01:00
|
|
|
claim: ?Claim,
|
2021-07-16 01:12:11 +02:00
|
|
|
mediaDuration?: string,
|
2021-02-16 22:09:20 +01:00
|
|
|
resolveUri: (string) => void,
|
2020-01-20 17:47:03 +01:00
|
|
|
isResolvingUri: boolean,
|
2021-02-16 22:09:20 +01:00
|
|
|
history: { push: (string) => void },
|
2020-01-20 17:47:03 +01:00
|
|
|
thumbnail: string,
|
|
|
|
title: string,
|
|
|
|
placeholder: boolean,
|
2021-10-25 16:56:31 +02:00
|
|
|
banState: { blacklisted?: boolean, filtered?: boolean, muted?: boolean, blocked?: boolean },
|
2021-02-16 22:09:20 +01:00
|
|
|
getFile: (string) => void,
|
2020-01-20 17:47:03 +01:00
|
|
|
streamingUrl: string,
|
2020-02-13 22:25:14 +01:00
|
|
|
isMature: boolean,
|
|
|
|
showMature: boolean,
|
2021-03-03 19:50:16 +01:00
|
|
|
showHiddenByUser?: boolean,
|
2021-04-23 21:59:48 +02:00
|
|
|
properties?: (Claim) => void,
|
wip
wip
wip - everything but publish, autoplay, and styling
collection publishing
add channel to collection publish
cleanup
wip
bump
clear mass add after success
move collection item management controls
redirect replace to published collection id
bump
playlist selector on create
bump
use new collection add ui element
bump
wip
gitignore
add content json
wip
bump
context add to playlist
basic collections page style pass wip
wip: edits, buttons, styles...
change fileAuthor to claimAuthor
update, pending bugfixes, delete modal progress, collection header, other bugfixes
bump
cleaning
show page bugfix
builtin collection headers
no playlists, no grid title
wip
style tweaks
use normal looking claim previews for collection tiles
add collection changes
style library previews
collection menulist for delete/view on library
delete modal works for unpublished
rearrange collection publish tabs
clean up collection publishing and items
show on odysee
begin collectoin edit header and css renaming
better thumbnails
bump
fix collection publish redirect
view collection in menu does something
copy and thumbs
list previews, pending, context menus, list page
enter to add collection, lists page empty state
playable lists only, delete feature, bump
put fileListDownloaded back
better collection titles
improve collection claim details
fix horiz more icon
fix up channel page
style, copy, bump
refactor preview overlay properties,
fix reposts showing as floppydisk
add watch later toast,
small overlay properties on wunderbar results,
fix collection actions buttons
bump
cleanup
cleaning, refactoring
bump
preview thumb styling, cleanup
support discover page lists search
sync, bump
bump, fix sync more
enforce builtin order for now
new lists page empty state
try to indicate unpublished edits in lists
bump
fix autoplay and linting
consts, fix autoplay
bugs
fixes
cleanup
fix, bump
lists experimental ui, fixes
refactor listIndex out
hack in collection fallback thumb
bump
2021-02-06 08:03:51 +01:00
|
|
|
collectionId?: string,
|
2021-07-07 20:21:11 +02:00
|
|
|
showNoSourceClaims?: boolean,
|
|
|
|
isLivestream: boolean,
|
2021-09-29 21:04:43 +02:00
|
|
|
viewCount: string,
|
Livestream category improvements (#7115)
* ❌ Remove old method of displaying active livestreams
Completely remove it for now to make the commit deltas clearer.
We'll replace it with the new method at the end.
* Fetch and store active-livestream info in redux
* Tiles can now query active-livestream state from redux instead of getting from parent.
* ⏪ ClaimTilesDiscover: revert and cleanup
## Simplify
- Simplify to just `uris` instead of having multiple arrays (`uris`, `modifiedUris`, `prevUris`)
- The `prevUris` is for CLS prevention. With this removal, the CLS issue is back, but we'll handle it differently later.
- Temporarily disable the view-count fetching. Code is left there so that I don't forget.
## Fix
- `shouldPerformSearch` was never true when `prefixUris` is present. Corrected the logic.
- Aside: prefix and pin is so similar in function. Hm ....
* ClaimTilesDiscover: factor out options
## Change
Move the `option` code outside and passed in as a pre-calculated prop.
## Reason
To skip rendering while waiting for `claim_search`, we need to add `React.memo(areEqual)`. However, the flag that determines if we are fetching `claim_search` (fetchingClaimSearchByQuery[]) depends on the derived options as the key.
Instead of calculating `options` twice, we moved it to the props so both sides can use it.
It also makes the component a bit more readable.
The downside is that the prop-passing might not be clear.
* ClaimTilesDiscover: reduce ~17 renders at startup to just 2.
* ClaimTilesDiscover: fill with placeholder while waiting for claim_search
## Issue
Livestream claims are fetched seperately, so they might already exists. While claim_search is running, the list only consists of livestreams (collapsed).
## Fix
Fill up the space with placeholders to prevent layout shift.
* Add 'useFetchViewCount' to handle fetching from lists
This effect also stashes fetched uris, so that we won't re-fetch the same uris during the same instance (e.g. during infinite scroll).
* ⏪ ClaimListDiscover: revert and cleanup
## Revert
- Removed the 'finalUris' stuff that was meant to "pause" visual changes when fetching. I think it'll be cleaner to use React.memo to achieve that.
## Alterations
- Added `renderUri` to make it clear which array that this component will render.
- Re-do the way we fetch view counts now that 'finalUris' is gone. Not the best method, but at least correct for now.
* ClaimListDiscover: add prefixUris, similar to ClaimTilesDiscover
This will be initially used to append livestreams at the top.
* ✅ Re-enable active livestream tiles using the new method
* doFetchActiveLivestreams: add interval check
- Added a default minimum of 5 minutes between fetches. Clients can bypass this through `forceFetch` if needed.
* doFetchActiveLivestreams: add option check
We'll need to support different 'orderBy', so adding an "options check" when determining if we just made the same fetch.
* WildWest: limit livestream tiles + add ability to show more
Most likely this behavior will change in the future, so we'll leave `ClaimListDiscover` untouched and handle the logic at the page level.
This solution uses 2 `ClaimListDiscover` -- if the reduced livestream list is visible, it handles the header; else the normal list handles the header.
* Use better tile-count on larger screens.
Used the same method as how the homepage does it.
2021-09-24 16:26:21 +02:00
|
|
|
isLivestreamActive: boolean,
|
2022-01-06 22:13:26 +01:00
|
|
|
swipeLayout: boolean,
|
2020-01-20 17:47:03 +01:00
|
|
|
};
|
|
|
|
|
2021-09-29 21:04:43 +02:00
|
|
|
// preview image cards used in related video functionality, channel overview page and homepage
|
2020-01-20 17:47:03 +01:00
|
|
|
function ClaimPreviewTile(props: Props) {
|
|
|
|
const {
|
|
|
|
history,
|
|
|
|
uri,
|
2021-07-16 02:44:51 +02:00
|
|
|
date,
|
2020-01-20 17:47:03 +01:00
|
|
|
isResolvingUri,
|
|
|
|
thumbnail,
|
|
|
|
title,
|
|
|
|
resolveUri,
|
|
|
|
claim,
|
|
|
|
placeholder,
|
2021-10-25 16:56:31 +02:00
|
|
|
banState,
|
2020-01-20 17:47:03 +01:00
|
|
|
getFile,
|
|
|
|
streamingUrl,
|
2020-02-13 22:25:14 +01:00
|
|
|
isMature,
|
|
|
|
showMature,
|
2021-03-03 19:50:16 +01:00
|
|
|
showHiddenByUser,
|
2021-04-23 21:59:48 +02:00
|
|
|
properties,
|
2021-07-07 20:21:11 +02:00
|
|
|
showNoSourceClaims,
|
|
|
|
isLivestream,
|
Livestream category improvements (#7115)
* ❌ Remove old method of displaying active livestreams
Completely remove it for now to make the commit deltas clearer.
We'll replace it with the new method at the end.
* Fetch and store active-livestream info in redux
* Tiles can now query active-livestream state from redux instead of getting from parent.
* ⏪ ClaimTilesDiscover: revert and cleanup
## Simplify
- Simplify to just `uris` instead of having multiple arrays (`uris`, `modifiedUris`, `prevUris`)
- The `prevUris` is for CLS prevention. With this removal, the CLS issue is back, but we'll handle it differently later.
- Temporarily disable the view-count fetching. Code is left there so that I don't forget.
## Fix
- `shouldPerformSearch` was never true when `prefixUris` is present. Corrected the logic.
- Aside: prefix and pin is so similar in function. Hm ....
* ClaimTilesDiscover: factor out options
## Change
Move the `option` code outside and passed in as a pre-calculated prop.
## Reason
To skip rendering while waiting for `claim_search`, we need to add `React.memo(areEqual)`. However, the flag that determines if we are fetching `claim_search` (fetchingClaimSearchByQuery[]) depends on the derived options as the key.
Instead of calculating `options` twice, we moved it to the props so both sides can use it.
It also makes the component a bit more readable.
The downside is that the prop-passing might not be clear.
* ClaimTilesDiscover: reduce ~17 renders at startup to just 2.
* ClaimTilesDiscover: fill with placeholder while waiting for claim_search
## Issue
Livestream claims are fetched seperately, so they might already exists. While claim_search is running, the list only consists of livestreams (collapsed).
## Fix
Fill up the space with placeholders to prevent layout shift.
* Add 'useFetchViewCount' to handle fetching from lists
This effect also stashes fetched uris, so that we won't re-fetch the same uris during the same instance (e.g. during infinite scroll).
* ⏪ ClaimListDiscover: revert and cleanup
## Revert
- Removed the 'finalUris' stuff that was meant to "pause" visual changes when fetching. I think it'll be cleaner to use React.memo to achieve that.
## Alterations
- Added `renderUri` to make it clear which array that this component will render.
- Re-do the way we fetch view counts now that 'finalUris' is gone. Not the best method, but at least correct for now.
* ClaimListDiscover: add prefixUris, similar to ClaimTilesDiscover
This will be initially used to append livestreams at the top.
* ✅ Re-enable active livestream tiles using the new method
* doFetchActiveLivestreams: add interval check
- Added a default minimum of 5 minutes between fetches. Clients can bypass this through `forceFetch` if needed.
* doFetchActiveLivestreams: add option check
We'll need to support different 'orderBy', so adding an "options check" when determining if we just made the same fetch.
* WildWest: limit livestream tiles + add ability to show more
Most likely this behavior will change in the future, so we'll leave `ClaimListDiscover` untouched and handle the logic at the page level.
This solution uses 2 `ClaimListDiscover` -- if the reduced livestream list is visible, it handles the header; else the normal list handles the header.
* Use better tile-count on larger screens.
Used the same method as how the homepage does it.
2021-09-24 16:26:21 +02:00
|
|
|
isLivestreamActive,
|
wip
wip
wip - everything but publish, autoplay, and styling
collection publishing
add channel to collection publish
cleanup
wip
bump
clear mass add after success
move collection item management controls
redirect replace to published collection id
bump
playlist selector on create
bump
use new collection add ui element
bump
wip
gitignore
add content json
wip
bump
context add to playlist
basic collections page style pass wip
wip: edits, buttons, styles...
change fileAuthor to claimAuthor
update, pending bugfixes, delete modal progress, collection header, other bugfixes
bump
cleaning
show page bugfix
builtin collection headers
no playlists, no grid title
wip
style tweaks
use normal looking claim previews for collection tiles
add collection changes
style library previews
collection menulist for delete/view on library
delete modal works for unpublished
rearrange collection publish tabs
clean up collection publishing and items
show on odysee
begin collectoin edit header and css renaming
better thumbnails
bump
fix collection publish redirect
view collection in menu does something
copy and thumbs
list previews, pending, context menus, list page
enter to add collection, lists page empty state
playable lists only, delete feature, bump
put fileListDownloaded back
better collection titles
improve collection claim details
fix horiz more icon
fix up channel page
style, copy, bump
refactor preview overlay properties,
fix reposts showing as floppydisk
add watch later toast,
small overlay properties on wunderbar results,
fix collection actions buttons
bump
cleanup
cleaning, refactoring
bump
preview thumb styling, cleanup
support discover page lists search
sync, bump
bump, fix sync more
enforce builtin order for now
new lists page empty state
try to indicate unpublished edits in lists
bump
fix autoplay and linting
consts, fix autoplay
bugs
fixes
cleanup
fix, bump
lists experimental ui, fixes
refactor listIndex out
hack in collection fallback thumb
bump
2021-02-06 08:03:51 +01:00
|
|
|
collectionId,
|
2021-07-16 01:12:11 +02:00
|
|
|
mediaDuration,
|
2021-09-29 21:04:43 +02:00
|
|
|
viewCount,
|
2022-01-06 22:13:26 +01:00
|
|
|
swipeLayout = false,
|
2020-01-20 17:47:03 +01:00
|
|
|
} = props;
|
2020-01-31 17:43:14 +01:00
|
|
|
const isRepost = claim && claim.repost_channel_url;
|
wip
wip
wip - everything but publish, autoplay, and styling
collection publishing
add channel to collection publish
cleanup
wip
bump
clear mass add after success
move collection item management controls
redirect replace to published collection id
bump
playlist selector on create
bump
use new collection add ui element
bump
wip
gitignore
add content json
wip
bump
context add to playlist
basic collections page style pass wip
wip: edits, buttons, styles...
change fileAuthor to claimAuthor
update, pending bugfixes, delete modal progress, collection header, other bugfixes
bump
cleaning
show page bugfix
builtin collection headers
no playlists, no grid title
wip
style tweaks
use normal looking claim previews for collection tiles
add collection changes
style library previews
collection menulist for delete/view on library
delete modal works for unpublished
rearrange collection publish tabs
clean up collection publishing and items
show on odysee
begin collectoin edit header and css renaming
better thumbnails
bump
fix collection publish redirect
view collection in menu does something
copy and thumbs
list previews, pending, context menus, list page
enter to add collection, lists page empty state
playable lists only, delete feature, bump
put fileListDownloaded back
better collection titles
improve collection claim details
fix horiz more icon
fix up channel page
style, copy, bump
refactor preview overlay properties,
fix reposts showing as floppydisk
add watch later toast,
small overlay properties on wunderbar results,
fix collection actions buttons
bump
cleanup
cleaning, refactoring
bump
preview thumb styling, cleanup
support discover page lists search
sync, bump
bump, fix sync more
enforce builtin order for now
new lists page empty state
try to indicate unpublished edits in lists
bump
fix autoplay and linting
consts, fix autoplay
bugs
fixes
cleanup
fix, bump
lists experimental ui, fixes
refactor listIndex out
hack in collection fallback thumb
bump
2021-02-06 08:03:51 +01:00
|
|
|
const isCollection = claim && claim.value_type === 'collection';
|
|
|
|
const isStream = claim && claim.value_type === 'stream';
|
2021-06-18 17:22:44 +02:00
|
|
|
// $FlowFixMe
|
|
|
|
const isPlayable =
|
|
|
|
claim &&
|
|
|
|
// $FlowFixMe
|
|
|
|
claim.value &&
|
|
|
|
// $FlowFixMe
|
|
|
|
claim.value.stream_type &&
|
|
|
|
// $FlowFixMe
|
|
|
|
(claim.value.stream_type === 'audio' || claim.value.stream_type === 'video');
|
wip
wip
wip - everything but publish, autoplay, and styling
collection publishing
add channel to collection publish
cleanup
wip
bump
clear mass add after success
move collection item management controls
redirect replace to published collection id
bump
playlist selector on create
bump
use new collection add ui element
bump
wip
gitignore
add content json
wip
bump
context add to playlist
basic collections page style pass wip
wip: edits, buttons, styles...
change fileAuthor to claimAuthor
update, pending bugfixes, delete modal progress, collection header, other bugfixes
bump
cleaning
show page bugfix
builtin collection headers
no playlists, no grid title
wip
style tweaks
use normal looking claim previews for collection tiles
add collection changes
style library previews
collection menulist for delete/view on library
delete modal works for unpublished
rearrange collection publish tabs
clean up collection publishing and items
show on odysee
begin collectoin edit header and css renaming
better thumbnails
bump
fix collection publish redirect
view collection in menu does something
copy and thumbs
list previews, pending, context menus, list page
enter to add collection, lists page empty state
playable lists only, delete feature, bump
put fileListDownloaded back
better collection titles
improve collection claim details
fix horiz more icon
fix up channel page
style, copy, bump
refactor preview overlay properties,
fix reposts showing as floppydisk
add watch later toast,
small overlay properties on wunderbar results,
fix collection actions buttons
bump
cleanup
cleaning, refactoring
bump
preview thumb styling, cleanup
support discover page lists search
sync, bump
bump, fix sync more
enforce builtin order for now
new lists page empty state
try to indicate unpublished edits in lists
bump
fix autoplay and linting
consts, fix autoplay
bugs
fixes
cleanup
fix, bump
lists experimental ui, fixes
refactor listIndex out
hack in collection fallback thumb
bump
2021-02-06 08:03:51 +01:00
|
|
|
const collectionClaimId = isCollection && claim && claim.claim_id;
|
2020-01-20 17:47:03 +01:00
|
|
|
const shouldFetch = claim === undefined;
|
|
|
|
const thumbnailUrl = useGetThumbnail(uri, claim, streamingUrl, getFile, placeholder) || thumbnail;
|
2020-02-03 20:26:30 +01:00
|
|
|
const canonicalUrl = claim && claim.canonical_url;
|
2021-09-10 17:01:12 +02:00
|
|
|
const permanentUrl = claim && claim.permanent_url;
|
2022-01-12 20:14:12 +01:00
|
|
|
const repostedContentUri = claim && (claim.reposted_claim ? claim.reposted_claim.permanent_url : claim.permanent_url);
|
wip
wip
wip - everything but publish, autoplay, and styling
collection publishing
add channel to collection publish
cleanup
wip
bump
clear mass add after success
move collection item management controls
redirect replace to published collection id
bump
playlist selector on create
bump
use new collection add ui element
bump
wip
gitignore
add content json
wip
bump
context add to playlist
basic collections page style pass wip
wip: edits, buttons, styles...
change fileAuthor to claimAuthor
update, pending bugfixes, delete modal progress, collection header, other bugfixes
bump
cleaning
show page bugfix
builtin collection headers
no playlists, no grid title
wip
style tweaks
use normal looking claim previews for collection tiles
add collection changes
style library previews
collection menulist for delete/view on library
delete modal works for unpublished
rearrange collection publish tabs
clean up collection publishing and items
show on odysee
begin collectoin edit header and css renaming
better thumbnails
bump
fix collection publish redirect
view collection in menu does something
copy and thumbs
list previews, pending, context menus, list page
enter to add collection, lists page empty state
playable lists only, delete feature, bump
put fileListDownloaded back
better collection titles
improve collection claim details
fix horiz more icon
fix up channel page
style, copy, bump
refactor preview overlay properties,
fix reposts showing as floppydisk
add watch later toast,
small overlay properties on wunderbar results,
fix collection actions buttons
bump
cleanup
cleaning, refactoring
bump
preview thumb styling, cleanup
support discover page lists search
sync, bump
bump, fix sync more
enforce builtin order for now
new lists page empty state
try to indicate unpublished edits in lists
bump
fix autoplay and linting
consts, fix autoplay
bugs
fixes
cleanup
fix, bump
lists experimental ui, fixes
refactor listIndex out
hack in collection fallback thumb
bump
2021-02-06 08:03:51 +01:00
|
|
|
const listId = collectionId || collectionClaimId;
|
2021-09-10 19:27:21 +02:00
|
|
|
const navigateUrl =
|
|
|
|
formatLbryUrlForWeb(canonicalUrl || uri || '/') + (listId ? generateListSearchUrlParams(listId) : '');
|
2020-01-27 16:00:33 +01:00
|
|
|
const navLinkProps = {
|
2020-02-05 00:32:36 +01:00
|
|
|
to: navigateUrl,
|
2021-02-16 22:09:20 +01:00
|
|
|
onClick: (e) => e.stopPropagation(),
|
2020-01-27 16:00:33 +01:00
|
|
|
};
|
2020-01-20 17:47:03 +01:00
|
|
|
|
|
|
|
let isValid = false;
|
|
|
|
if (uri) {
|
|
|
|
try {
|
2021-07-20 19:55:39 +02:00
|
|
|
parseURI(uri);
|
2020-01-20 17:47:03 +01:00
|
|
|
isValid = true;
|
|
|
|
} catch (e) {
|
|
|
|
isValid = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const signingChannel = claim && claim.signing_channel;
|
2021-07-20 19:55:39 +02:00
|
|
|
const isChannel = claim && claim.value_type === 'channel';
|
2021-06-22 14:03:53 +02:00
|
|
|
const channelUri = !isChannel ? signingChannel && signingChannel.permanent_url : claim && claim.permanent_url;
|
2021-07-31 17:08:15 +02:00
|
|
|
const channelTitle = signingChannel && ((signingChannel.value && signingChannel.value.title) || signingChannel.name);
|
2021-09-10 17:01:12 +02:00
|
|
|
const repostedChannelUri = isRepost && isChannel ? permanentUrl || canonicalUrl : undefined;
|
2021-07-16 01:12:11 +02:00
|
|
|
|
|
|
|
// Aria-label value for claim preview
|
2021-07-22 10:24:25 +02:00
|
|
|
let ariaLabelData = isChannel ? title : formatClaimPreviewTitle(title, channelTitle, date, mediaDuration);
|
2020-01-20 17:47:03 +01:00
|
|
|
|
|
|
|
function handleClick(e) {
|
|
|
|
if (navigateUrl) {
|
|
|
|
history.push(navigateUrl);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
React.useEffect(() => {
|
|
|
|
if (isValid && !isResolvingUri && shouldFetch && uri) {
|
|
|
|
resolveUri(uri);
|
|
|
|
}
|
|
|
|
}, [isValid, isResolvingUri, uri, resolveUri, shouldFetch]);
|
|
|
|
|
|
|
|
let shouldHide = false;
|
|
|
|
|
2020-02-13 22:25:14 +01:00
|
|
|
if (isMature && !showMature) {
|
|
|
|
// Unfortunately needed until this is resolved
|
|
|
|
// https://github.com/lbryio/lbry-sdk/issues/2785
|
|
|
|
shouldHide = true;
|
2021-10-25 16:56:31 +02:00
|
|
|
} else {
|
|
|
|
shouldHide =
|
|
|
|
banState.blacklisted || banState.filtered || (!showHiddenByUser && (banState.muted || banState.blocked));
|
2020-01-20 19:55:28 +01:00
|
|
|
}
|
|
|
|
|
2021-07-07 20:21:11 +02:00
|
|
|
if (shouldHide || (isLivestream && !showNoSourceClaims)) {
|
2020-01-20 17:47:03 +01:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2021-09-29 21:04:43 +02:00
|
|
|
const isChannelPage = window.location.pathname.startsWith('/@');
|
|
|
|
|
|
|
|
const shouldShowViewCount = !(!viewCount || (claim && claim.repost_url) || isLivestream || !isChannelPage);
|
|
|
|
|
2021-03-17 20:49:49 +01:00
|
|
|
if (placeholder || (!claim && isResolvingUri)) {
|
2020-01-20 17:47:03 +01:00
|
|
|
return (
|
|
|
|
<li className={classnames('claim-preview--tile', {})}>
|
2021-07-19 03:42:04 +02:00
|
|
|
<div className="placeholder media__thumb">
|
|
|
|
<img src={PlaceholderTx} alt="Placeholder" />
|
|
|
|
</div>
|
2020-01-20 17:47:03 +01:00
|
|
|
<div className="placeholder__wrapper">
|
|
|
|
<div className="placeholder claim-tile__title" />
|
2021-10-17 10:36:14 +02:00
|
|
|
<div
|
|
|
|
className={classnames('claim-tile__info placeholder', {
|
|
|
|
contains_view_count: shouldShowViewCount,
|
|
|
|
})}
|
|
|
|
/>
|
2020-01-20 17:47:03 +01:00
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-04-28 11:48:13 +02:00
|
|
|
let liveProperty = null;
|
2021-12-16 22:59:13 +01:00
|
|
|
if (isLivestream === true) {
|
2021-04-28 11:48:13 +02:00
|
|
|
liveProperty = (claim) => <>LIVE</>;
|
|
|
|
}
|
|
|
|
|
2020-01-20 17:47:03 +01:00
|
|
|
return (
|
|
|
|
<li
|
|
|
|
onClick={handleClick}
|
|
|
|
className={classnames('card claim-preview--tile', {
|
2020-01-31 17:43:14 +01:00
|
|
|
'claim-preview__wrapper--channel': isChannel,
|
Livestream category improvements (#7115)
* ❌ Remove old method of displaying active livestreams
Completely remove it for now to make the commit deltas clearer.
We'll replace it with the new method at the end.
* Fetch and store active-livestream info in redux
* Tiles can now query active-livestream state from redux instead of getting from parent.
* ⏪ ClaimTilesDiscover: revert and cleanup
## Simplify
- Simplify to just `uris` instead of having multiple arrays (`uris`, `modifiedUris`, `prevUris`)
- The `prevUris` is for CLS prevention. With this removal, the CLS issue is back, but we'll handle it differently later.
- Temporarily disable the view-count fetching. Code is left there so that I don't forget.
## Fix
- `shouldPerformSearch` was never true when `prefixUris` is present. Corrected the logic.
- Aside: prefix and pin is so similar in function. Hm ....
* ClaimTilesDiscover: factor out options
## Change
Move the `option` code outside and passed in as a pre-calculated prop.
## Reason
To skip rendering while waiting for `claim_search`, we need to add `React.memo(areEqual)`. However, the flag that determines if we are fetching `claim_search` (fetchingClaimSearchByQuery[]) depends on the derived options as the key.
Instead of calculating `options` twice, we moved it to the props so both sides can use it.
It also makes the component a bit more readable.
The downside is that the prop-passing might not be clear.
* ClaimTilesDiscover: reduce ~17 renders at startup to just 2.
* ClaimTilesDiscover: fill with placeholder while waiting for claim_search
## Issue
Livestream claims are fetched seperately, so they might already exists. While claim_search is running, the list only consists of livestreams (collapsed).
## Fix
Fill up the space with placeholders to prevent layout shift.
* Add 'useFetchViewCount' to handle fetching from lists
This effect also stashes fetched uris, so that we won't re-fetch the same uris during the same instance (e.g. during infinite scroll).
* ⏪ ClaimListDiscover: revert and cleanup
## Revert
- Removed the 'finalUris' stuff that was meant to "pause" visual changes when fetching. I think it'll be cleaner to use React.memo to achieve that.
## Alterations
- Added `renderUri` to make it clear which array that this component will render.
- Re-do the way we fetch view counts now that 'finalUris' is gone. Not the best method, but at least correct for now.
* ClaimListDiscover: add prefixUris, similar to ClaimTilesDiscover
This will be initially used to append livestreams at the top.
* ✅ Re-enable active livestream tiles using the new method
* doFetchActiveLivestreams: add interval check
- Added a default minimum of 5 minutes between fetches. Clients can bypass this through `forceFetch` if needed.
* doFetchActiveLivestreams: add option check
We'll need to support different 'orderBy', so adding an "options check" when determining if we just made the same fetch.
* WildWest: limit livestream tiles + add ability to show more
Most likely this behavior will change in the future, so we'll leave `ClaimListDiscover` untouched and handle the logic at the page level.
This solution uses 2 `ClaimListDiscover` -- if the reduced livestream list is visible, it handles the header; else the normal list handles the header.
* Use better tile-count on larger screens.
Used the same method as how the homepage does it.
2021-09-24 16:26:21 +02:00
|
|
|
'claim-preview__live': isLivestreamActive,
|
2022-01-06 22:13:26 +01:00
|
|
|
'swipe-list__item claim-preview--horizontal-tile': swipeLayout,
|
2020-01-20 17:47:03 +01:00
|
|
|
})}
|
|
|
|
>
|
2021-07-20 19:14:28 +02:00
|
|
|
<NavLink {...navLinkProps} role="none" tabIndex={-1} aria-hidden>
|
2020-05-29 19:26:06 +02:00
|
|
|
<FileThumbnail thumbnail={thumbnailUrl} allowGifs>
|
2020-01-29 17:38:46 +01:00
|
|
|
{!isChannel && (
|
2020-01-29 19:58:43 +01:00
|
|
|
<React.Fragment>
|
2021-08-02 17:03:55 +02:00
|
|
|
<div className="claim-preview__hover-actions">
|
2022-01-12 20:14:12 +01:00
|
|
|
{isPlayable && <FileWatchLaterLink focusable={false} uri={repostedContentUri} />}
|
2021-08-04 15:45:24 +02:00
|
|
|
</div>
|
2021-08-25 17:44:08 +02:00
|
|
|
{/* @if TARGET='app' */}
|
2021-08-04 15:45:24 +02:00
|
|
|
<div className="claim-preview__hover-actions">
|
2021-09-09 09:02:31 +02:00
|
|
|
{isStream && <FileDownloadLink focusable={false} uri={canonicalUrl} hideOpenButton />}
|
2021-08-02 17:03:55 +02:00
|
|
|
</div>
|
2021-08-25 17:44:08 +02:00
|
|
|
{/* @endif */}
|
2021-06-18 17:22:44 +02:00
|
|
|
|
2020-08-04 19:50:33 +02:00
|
|
|
<div className="claim-preview__file-property-overlay">
|
wip
wip
wip - everything but publish, autoplay, and styling
collection publishing
add channel to collection publish
cleanup
wip
bump
clear mass add after success
move collection item management controls
redirect replace to published collection id
bump
playlist selector on create
bump
use new collection add ui element
bump
wip
gitignore
add content json
wip
bump
context add to playlist
basic collections page style pass wip
wip: edits, buttons, styles...
change fileAuthor to claimAuthor
update, pending bugfixes, delete modal progress, collection header, other bugfixes
bump
cleaning
show page bugfix
builtin collection headers
no playlists, no grid title
wip
style tweaks
use normal looking claim previews for collection tiles
add collection changes
style library previews
collection menulist for delete/view on library
delete modal works for unpublished
rearrange collection publish tabs
clean up collection publishing and items
show on odysee
begin collectoin edit header and css renaming
better thumbnails
bump
fix collection publish redirect
view collection in menu does something
copy and thumbs
list previews, pending, context menus, list page
enter to add collection, lists page empty state
playable lists only, delete feature, bump
put fileListDownloaded back
better collection titles
improve collection claim details
fix horiz more icon
fix up channel page
style, copy, bump
refactor preview overlay properties,
fix reposts showing as floppydisk
add watch later toast,
small overlay properties on wunderbar results,
fix collection actions buttons
bump
cleanup
cleaning, refactoring
bump
preview thumb styling, cleanup
support discover page lists search
sync, bump
bump, fix sync more
enforce builtin order for now
new lists page empty state
try to indicate unpublished edits in lists
bump
fix autoplay and linting
consts, fix autoplay
bugs
fixes
cleanup
fix, bump
lists experimental ui, fixes
refactor listIndex out
hack in collection fallback thumb
bump
2021-02-06 08:03:51 +01:00
|
|
|
<PreviewOverlayProperties uri={uri} properties={liveProperty || properties} />
|
|
|
|
</div>
|
|
|
|
</React.Fragment>
|
|
|
|
)}
|
|
|
|
{isCollection && (
|
|
|
|
<React.Fragment>
|
|
|
|
<div className="claim-preview__collection-wrapper">
|
|
|
|
<CollectionPreviewOverlay collectionId={listId} uri={uri} />
|
2020-01-29 19:58:43 +01:00
|
|
|
</div>
|
|
|
|
</React.Fragment>
|
2020-01-29 17:38:46 +01:00
|
|
|
)}
|
|
|
|
</FileThumbnail>
|
2020-01-20 17:47:03 +01:00
|
|
|
</NavLink>
|
2021-07-15 00:12:07 +02:00
|
|
|
<div className="claim-tile__header">
|
2021-07-16 01:12:11 +02:00
|
|
|
<NavLink aria-label={ariaLabelData} {...navLinkProps}>
|
2021-07-15 00:12:07 +02:00
|
|
|
<h2 className="claim-tile__title">
|
|
|
|
<TruncatedText text={title || (claim && claim.name)} lines={isChannel ? 1 : 2} />
|
|
|
|
{isChannel && (
|
|
|
|
<div className="claim-tile__about">
|
|
|
|
<UriIndicator uri={uri} />
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
</h2>
|
|
|
|
</NavLink>
|
2021-07-22 03:59:12 +02:00
|
|
|
<ClaimMenuList uri={uri} collectionId={listId} channelUri={channelUri} />
|
2021-07-15 00:12:07 +02:00
|
|
|
</div>
|
2020-01-31 17:43:14 +01:00
|
|
|
<div>
|
2021-10-17 10:36:14 +02:00
|
|
|
<div
|
|
|
|
className={classnames('claim-tile__info', {
|
|
|
|
contains_view_count: shouldShowViewCount,
|
|
|
|
})}
|
|
|
|
>
|
2020-01-31 17:43:14 +01:00
|
|
|
{isChannel ? (
|
|
|
|
<div className="claim-tile__about--channel">
|
2021-09-10 17:01:12 +02:00
|
|
|
<SubscribeButton uri={repostedChannelUri || uri} />
|
2020-01-20 17:47:03 +01:00
|
|
|
</div>
|
2020-01-31 17:43:14 +01:00
|
|
|
) : (
|
|
|
|
<React.Fragment>
|
2021-07-16 08:53:38 +02:00
|
|
|
<UriIndicator focusable={false} uri={uri} link hideAnonymous>
|
ChannelThumbnail improvements
- [x] (6332) The IntersectionObserver method of lazy-loading loads cached images visibly late on slower devices. Previously, it was also showing the "broken image" icon briefly, which we mended by placing a dummy transparent image as the initial src.
- Reverted that ugly transparent image fix.
- Use the browser's built-in `loading="lazy"` instead. Sorry, Safari.
- [x] Size-optimization did not take "device pixel ratio" into account.
- When resizing an image through the CDN, we can't just take the dimensions of the tag in pixels directly -- we need to take zooming into account, otherwise the image ends up blurry.
- Previously, we quickly disabled optimization for the channel avatar in the Channel Page because of this. Now that we know the root-cause, the change was reverted and we now go through the CDN with appropriate sizes. This also improves our Web Vital scores.
- [x] Size-optimization wasn't really implemented for all ChannelThumbnail instances.
- The CDN-optimized size was hardcoded to the largest instance, so small images like sidebar thumbnails are still loading images that are unnecessarily larger.
- There's a little-bit of hardcoding of values from CSS here, but I think it's a ok compromise (not something we change often). It also doesn't need to be exact -- the "device pixel ratio" calculate will ensure it's slightly larger than what we need.
- [x] Set `width` and `height` of `<img>` to improve CLS.
- Addresses Ligthhouse complaints, although technically the shifting was addressed at the `ClaimPreviewTile` level (sub-container dimensions are well defined).
- Notes: the values don't need to be the final CSS-adjusted sizes. It just needs to be in the right aspect ratio to help the browser pre-allocate space to avoid shifts.
- [x] Add option to disable lazy-load Channel Thumbnails
- The guidelines mentioned that items that are already in the viewport should not enable `loading="lazy"`.
- We have a few areas where it doesn't make sense to lazy-load (e.g. thumbnail in Header, channel selector dropdown, publish preview, etc.).
2021-07-05 07:20:40 +02:00
|
|
|
<ChannelThumbnail uri={channelUri} xsmall />
|
2020-01-31 17:43:14 +01:00
|
|
|
</UriIndicator>
|
|
|
|
|
|
|
|
<div className="claim-tile__about">
|
|
|
|
<UriIndicator uri={uri} link />
|
2021-09-09 09:02:31 +02:00
|
|
|
<div className="claim-tile__about--counts">
|
|
|
|
<FileViewCountInline uri={uri} isLivestream={isLivestream} />
|
2021-12-22 17:12:44 +01:00
|
|
|
{isLivestream && <LivestreamDateTime uri={uri} />}
|
2021-12-16 22:59:13 +01:00
|
|
|
{!isLivestream && <DateTime timeAgo uri={uri} />}
|
2021-09-09 09:02:31 +02:00
|
|
|
</div>
|
2020-01-31 17:43:14 +01:00
|
|
|
</div>
|
|
|
|
</React.Fragment>
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
{isRepost && (
|
|
|
|
<div className="claim-tile__repost-author">
|
|
|
|
<ClaimRepostAuthor uri={uri} />
|
|
|
|
</div>
|
2020-01-20 17:47:03 +01:00
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-10-25 16:56:31 +02:00
|
|
|
export default withRouter(ClaimPreviewTile);
|