2020-01-20 17:47:03 +01:00
|
|
|
// @flow
|
|
|
|
import React from 'react';
|
|
|
|
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';
|
|
|
|
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-09-10 19:27:21 +02:00
|
|
|
import { parseURI, isURIEqual } from 'lbry-redux';
|
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,
|
|
|
|
blackListedOutpoints: Array<{
|
|
|
|
txid: string,
|
|
|
|
nout: number,
|
|
|
|
}>,
|
|
|
|
filteredOutpoints: Array<{
|
|
|
|
txid: string,
|
|
|
|
nout: number,
|
|
|
|
}>,
|
|
|
|
blockedChannelUris: Array<string>,
|
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-17 04:12:23 +02:00
|
|
|
isLivestreamActive: boolean,
|
2020-01-20 17:47:03 +01:00
|
|
|
};
|
|
|
|
|
2021-08-25 17:44:08 +02:00
|
|
|
// preview image cards used in related video functionality
|
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,
|
|
|
|
blackListedOutpoints,
|
|
|
|
filteredOutpoints,
|
|
|
|
getFile,
|
|
|
|
streamingUrl,
|
2020-01-20 19:55:28 +01:00
|
|
|
blockedChannelUris,
|
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,
|
2021-09-17 04:12:23 +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,
|
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;
|
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;
|
|
|
|
}
|
|
|
|
|
2020-01-20 17:47:03 +01:00
|
|
|
// This will be replaced once blocking is done at the wallet server level
|
|
|
|
if (claim && !shouldHide && blackListedOutpoints) {
|
|
|
|
shouldHide = blackListedOutpoints.some(
|
2021-02-16 22:09:20 +01:00
|
|
|
(outpoint) =>
|
2020-01-20 17:47:03 +01:00
|
|
|
(signingChannel && outpoint.txid === signingChannel.txid && outpoint.nout === signingChannel.nout) ||
|
|
|
|
(outpoint.txid === claim.txid && outpoint.nout === claim.nout)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
// We're checking to see if the stream outpoint
|
|
|
|
// or signing channel outpoint is in the filter list
|
|
|
|
if (claim && !shouldHide && filteredOutpoints) {
|
|
|
|
shouldHide = filteredOutpoints.some(
|
2021-02-16 22:09:20 +01:00
|
|
|
(outpoint) =>
|
2020-01-20 17:47:03 +01:00
|
|
|
(signingChannel && outpoint.txid === signingChannel.txid && outpoint.nout === signingChannel.nout) ||
|
|
|
|
(outpoint.txid === claim.txid && outpoint.nout === claim.nout)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-01-20 19:55:28 +01:00
|
|
|
// block stream claims
|
2021-03-03 19:50:16 +01:00
|
|
|
if (claim && !shouldHide && !showHiddenByUser && blockedChannelUris.length && signingChannel) {
|
2021-07-15 22:22:44 +02:00
|
|
|
shouldHide = blockedChannelUris.some((blockedUri) => isURIEqual(blockedUri, signingChannel.permanent_url));
|
2020-01-20 19:55:28 +01:00
|
|
|
}
|
|
|
|
// block channel claims if we can't control for them in claim search
|
|
|
|
// e.g. fetchRecommendedSubscriptions
|
2021-07-15 22:22:44 +02:00
|
|
|
if (claim && isChannel && !shouldHide && !showHiddenByUser && blockedChannelUris.length && signingChannel) {
|
|
|
|
shouldHide = blockedChannelUris.some((blockedUri) => isURIEqual(blockedUri, signingChannel.permanent_url));
|
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-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" />
|
|
|
|
<div className="placeholder claim-tile__info" />
|
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-04-28 11:48:13 +02:00
|
|
|
let liveProperty = null;
|
2021-09-17 04:12:23 +02:00
|
|
|
if (isLivestreamActive === 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,
|
2021-09-17 04:12:23 +02:00
|
|
|
'claim-preview__live': isLivestreamActive,
|
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">
|
2021-09-09 09:02:31 +02:00
|
|
|
{isPlayable && <FileWatchLaterLink focusable={false} uri={uri} />}
|
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>
|
|
|
|
<div className="claim-tile__info">
|
|
|
|
{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} />
|
|
|
|
<DateTime timeAgo uri={uri} />
|
|
|
|
</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-09-20 10:42:41 +02:00
|
|
|
export default React.memo<Props>(withRouter(ClaimPreviewTile), areEqual);
|
|
|
|
|
|
|
|
const BLOCKLIST_KEYS = ['blackListedOutpoints', 'filteredOutpoints', 'blockedChannelUris'];
|
|
|
|
const HANDLED_KEYS = [...BLOCKLIST_KEYS, 'date'];
|
|
|
|
|
|
|
|
function areEqual(prev: Props, next: Props) {
|
|
|
|
for (let i = 0; i < BLOCKLIST_KEYS.length; ++i) {
|
|
|
|
const key = BLOCKLIST_KEYS[i];
|
|
|
|
const a = prev[key];
|
|
|
|
const b = next[key];
|
|
|
|
|
|
|
|
if (((!a || !b) && a !== b) || (a && b && a.length !== b.length)) {
|
|
|
|
// The arrays are huge, so just compare the length instead of each entry.
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Number(prev.date) !== Number(next.date)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
const propKeys = Object.keys(next);
|
|
|
|
for (let i = 0; i < propKeys.length; ++i) {
|
|
|
|
const pk = propKeys[i];
|
|
|
|
if (!HANDLED_KEYS.includes(pk) && prev[pk] !== next[pk]) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|