Revert "Add fallback thumbnail for streams"

This reverts commit 0423d30a4e.
This commit is contained in:
Sean Yesmunt 2021-02-18 02:13:54 -05:00
parent 0a8d43e932
commit 9442d586ee
5 changed files with 10 additions and 21 deletions

View file

@ -41,8 +41,7 @@ const config = {
PINNED_URI_2: process.env.PINNED_URI_2, PINNED_URI_2: process.env.PINNED_URI_2,
PINNED_LABEL_2: process.env.PINNED_LABEL_2, PINNED_LABEL_2: process.env.PINNED_LABEL_2,
KNOWN_APP_DOMAINS: process.env.KNOWN_APP_DOMAINS ? process.env.KNOWN_APP_DOMAINS.split(',') : [], KNOWN_APP_DOMAINS: process.env.KNOWN_APP_DOMAINS ? process.env.KNOWN_APP_DOMAINS.split(',') : [],
CHANNEL_THUMBNAIL_FALLBACK: process.env.CHANNEL_THUMBNAIL_FALLBACK, THUMBNAIL_FALLBACK: process.env.THUMBNAIL_FALLBACK,
STREAM_THUMBNAIL_FALLBACK: process.env.STREAM_THUMBNAIL_FALLBACK,
}; };
config.URL_LOCAL = `http://localhost:${config.WEB_SERVER_PORT}`; config.URL_LOCAL = `http://localhost:${config.WEB_SERVER_PORT}`;

View file

@ -53,9 +53,8 @@
"electron-updater": "^4.2.4", "electron-updater": "^4.2.4",
"express": "^4.17.1", "express": "^4.17.1",
"if-env": "^1.0.4", "if-env": "^1.0.4",
"remove-markdown": "^0.3.0", "remark-breaks": "^2.0.1",
"react-image": "^4.0.3", "remove-markdown": "^0.3.0",
"remark-breaks": "^2.0.1",
"tempy": "^0.6.0", "tempy": "^0.6.0",
"videojs-logo": "^2.1.4" "videojs-logo": "^2.1.4"
}, },

View file

@ -2,9 +2,8 @@
import type { Node } from 'react'; import type { Node } from 'react';
import React, { useEffect, forwardRef } from 'react'; import React, { useEffect, forwardRef } from 'react';
import { NavLink, withRouter } from 'react-router-dom'; import { NavLink, withRouter } from 'react-router-dom';
import { useImage } from 'react-image';
import classnames from 'classnames'; import classnames from 'classnames';
import { CHANNEL_THUMBNAIL_FALLBACK, STREAM_THUMBNAIL_FALLBACK, SIMPLE_SITE } from 'config'; import { SIMPLE_SITE } from 'config';
import { parseURI, convertToShareLink } from 'lbry-redux'; import { parseURI, convertToShareLink } from 'lbry-redux';
import { openCopyLinkMenu } from 'util/context-menu'; import { openCopyLinkMenu } from 'util/context-menu';
import { formatLbryUrlForWeb } from 'util/url'; import { formatLbryUrlForWeb } from 'util/url';
@ -189,11 +188,6 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
// Weird placement warning // Weird placement warning
// Make sure this happens after we figure out if this claim needs to be hidden // Make sure this happens after we figure out if this claim needs to be hidden
const thumbnailUrl = useGetThumbnail(contentUri, claim, streamingUrl, getFile, shouldHide); const thumbnailUrl = useGetThumbnail(contentUri, claim, streamingUrl, getFile, shouldHide);
const isStream = claim && claim.value_type === 'stream';
const { src: thumbnailUrlWithFallback } = useImage({
srcList: [thumbnailUrl, isStream ? STREAM_THUMBNAIL_FALLBACK : CHANNEL_THUMBNAIL_FALLBACK],
useSuspense: false,
});
function handleContextMenu(e) { function handleContextMenu(e) {
// @if TARGET='app' // @if TARGET='app'
@ -288,7 +282,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
<> <>
{!pending ? ( {!pending ? (
<NavLink {...navLinkProps}> <NavLink {...navLinkProps}>
<FileThumbnail thumbnail={thumbnailUrlWithFallback}> <FileThumbnail thumbnail={thumbnailUrl}>
{/* @if TARGET='app' */} {/* @if TARGET='app' */}
{claim && ( {claim && (
<div className="claim-preview__hover-actions"> <div className="claim-preview__hover-actions">
@ -304,7 +298,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
</FileThumbnail> </FileThumbnail>
</NavLink> </NavLink>
) : ( ) : (
<FileThumbnail thumbnail={thumbnailUrlWithFallback} /> <FileThumbnail thumbnail={thumbnailUrl} />
)} )}
</> </>
)} )}

View file

@ -2,6 +2,7 @@
import type { Node } from 'react'; import type { Node } from 'react';
import { getThumbnailCdnUrl } from 'util/thumbnail'; import { getThumbnailCdnUrl } from 'util/thumbnail';
import React from 'react'; import React from 'react';
import { THUMBNAIL_FALLBACK } from 'config';
import FreezeframeWrapper from './FreezeframeWrapper'; import FreezeframeWrapper from './FreezeframeWrapper';
import Placeholder from './placeholder.png'; import Placeholder from './placeholder.png';
import classnames from 'classnames'; import classnames from 'classnames';
@ -14,10 +15,11 @@ type Props = {
claim: ?StreamClaim, claim: ?StreamClaim,
doResolveUri: string => void, doResolveUri: string => void,
className?: string, className?: string,
fallbackThumbnail?: string,
}; };
function FileThumbnail(props: Props) { function FileThumbnail(props: Props) {
const { claim, uri, doResolveUri, thumbnail: rawThumbnail, children, allowGifs = false, className } = props; const { claim, uri, doResolveUri, thumbnail: rawThumbnail, children, allowGifs = false, className, fallbackThumbnail = THUMBNAIL_FALLBACK } = props;
const passedThumbnail = rawThumbnail && rawThumbnail.trim().replace(/^http:\/\//i, 'https://'); const passedThumbnail = rawThumbnail && rawThumbnail.trim().replace(/^http:\/\//i, 'https://');
const thumbnailFromClaim = const thumbnailFromClaim =
uri && claim && claim.value && claim.value.thumbnail ? claim.value.thumbnail.url : undefined; uri && claim && claim.value && claim.value.thumbnail ? claim.value.thumbnail.url : undefined;
@ -50,7 +52,7 @@ function FileThumbnail(props: Props) {
return ( return (
<div <div
style={{ backgroundImage: `url('${cleanUrl}')` }} style={{ backgroundImage: `url('${cleanUrl}'), url('${fallbackThumbnail}')` }}
className={classnames('media__thumb', className, { className={classnames('media__thumb', className, {
'media__thumb--resolving': !hasResolvedClaim, 'media__thumb--resolving': !hasResolvedClaim,
})} })}

View file

@ -9201,11 +9201,6 @@ react-hot-loader@^4.11.1:
shallowequal "^1.1.0" shallowequal "^1.1.0"
source-map "^0.7.3" source-map "^0.7.3"
react-image@^4.0.3:
version "4.0.3"
resolved "https://registry.yarnpkg.com/react-image/-/react-image-4.0.3.tgz#6fa722877660b67295298a914bff1ed87ad2cf83"
integrity sha512-19MUK9u1qaw9xys8XEsVkSpVhHctEBUeYFvrLTe1PN+4w5Co13AN2WA7xtBshPM6SthsOj77SlDrEAeOaJpf7g==
react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.2: react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.2:
version "16.13.0" version "16.13.0"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.0.tgz#0f37c3613c34fe6b37cd7f763a0d6293ab15c527" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.0.tgz#0f37c3613c34fe6b37cd7f763a0d6293ab15c527"