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';
|
2022-04-01 16:56:18 +02:00
|
|
|
import ClaimPreviewProgress from 'component/claimPreviewProgress';
|
2020-01-20 17:47:03 +01:00
|
|
|
import FileThumbnail from 'component/fileThumbnail';
|
|
|
|
import UriIndicator from 'component/uriIndicator';
|
2022-04-15 13:02:51 +02:00
|
|
|
import Icon from 'component/common/icon';
|
2020-01-20 17:47:03 +01:00
|
|
|
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';
|
2022-02-11 19:50:55 +01:00
|
|
|
// import SubscribeButton from 'component/subscribeButton';
|
2020-01-20 17:47:03 +01:00
|
|
|
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';
|
2022-03-15 20:07:31 +01:00
|
|
|
import FileHideRecommendation from 'component/fileHideRecommendation';
|
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';
|
2022-04-15 13:02:51 +02:00
|
|
|
import * as ICONS from 'constants/icons';
|
2022-03-15 20:07:31 +01:00
|
|
|
import { FYP_ID } from 'constants/urlParams';
|
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,
|
2022-03-15 20:07:31 +01:00
|
|
|
fypId?: 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-04-15 13:02:51 +02:00
|
|
|
livestreamViewerCount: ?number,
|
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,
|
2022-04-15 13:02:51 +02:00
|
|
|
livestreamViewerCount,
|
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,
|
2022-03-15 20:07:31 +01:00
|
|
|
fypId,
|
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;
|
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 =
|
2022-03-15 20:07:31 +01:00
|
|
|
formatLbryUrlForWeb(canonicalUrl || uri || '/') +
|
|
|
|
(listId ? generateListSearchUrlParams(listId) : '') +
|
|
|
|
(fypId ? `?${FYP_ID}=${fypId}` : ''); // sigh...
|
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-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 (
|
2022-03-11 12:53:49 +01:00
|
|
|
<li
|
|
|
|
className={classnames('placeholder claim-preview--tile', {
|
|
|
|
'swipe-list__item claim-preview--horizontal-tile': swipeLayout,
|
|
|
|
})}
|
|
|
|
>
|
2022-02-11 19:50:55 +01:00
|
|
|
<div className="media__thumb">
|
2021-07-19 03:42:04 +02:00
|
|
|
<img src={PlaceholderTx} alt="Placeholder" />
|
|
|
|
</div>
|
2020-01-20 17:47:03 +01:00
|
|
|
<div className="placeholder__wrapper">
|
2022-02-11 19:50:55 +01:00
|
|
|
<div className="claim-tile__title" />
|
|
|
|
<div className="claim-tile__title_b" />
|
2021-10-17 10:36:14 +02:00
|
|
|
<div
|
2022-02-11 19:50:55 +01:00
|
|
|
className={classnames('claim-tile__info', {
|
2021-10-17 10:36:14 +02:00
|
|
|
contains_view_count: shouldShowViewCount,
|
|
|
|
})}
|
2022-02-11 19:50:55 +01:00
|
|
|
>
|
|
|
|
<div className="channel-thumbnail" />
|
|
|
|
<div className="claim-tile__about">
|
|
|
|
<div className="button__content" />
|
|
|
|
<div className="claim-tile__about--counts" />
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-01-20 17:47:03 +01:00
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-04-28 11:48:13 +02:00
|
|
|
let liveProperty = null;
|
2022-04-15 13:02:51 +02:00
|
|
|
if (isLivestream) {
|
|
|
|
if (isLivestreamActive === true && livestreamViewerCount) {
|
|
|
|
liveProperty = (claim) => (
|
|
|
|
<span className="livestream__viewer-count">
|
|
|
|
{livestreamViewerCount} <Icon icon={ICONS.EYE} />
|
|
|
|
</span>
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
liveProperty = (claim) => <>LIVE</>;
|
|
|
|
}
|
2021-04-28 11:48:13 +02:00
|
|
|
}
|
|
|
|
|
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>
|
2022-03-15 20:07:31 +01:00
|
|
|
{fypId && (
|
|
|
|
<div className="claim-preview__hover-actions">
|
|
|
|
{isStream && <FileHideRecommendation focusable={false} uri={repostedContentUri} />}
|
|
|
|
</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 */}
|
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>
|
2022-04-01 16:56:18 +02:00
|
|
|
<ClaimPreviewProgress uri={uri} />
|
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
|
|
|
</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">
|
2022-02-25 15:04:23 +01:00
|
|
|
<UriIndicator uri={uri} />
|
2021-07-15 00:12:07 +02:00
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
</h2>
|
|
|
|
</NavLink>
|
2022-03-16 04:34:32 +01:00
|
|
|
<ClaimMenuList uri={uri} collectionId={listId} fypId={fypId} 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 ? (
|
2022-02-11 19:50:55 +01:00
|
|
|
// <div className="claim-tile__about--channel">
|
|
|
|
// <SubscribeButton uri={repostedChannelUri || uri} />
|
|
|
|
// </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>
|
2022-03-09 19:05:37 +01:00
|
|
|
<ChannelThumbnail uri={channelUri} xsmall checkMembership={false} />
|
2020-01-31 17:43:14 +01:00
|
|
|
</UriIndicator>
|
|
|
|
|
|
|
|
<div className="claim-tile__about">
|
2022-02-25 15:04:23 +01:00
|
|
|
<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);
|