always use thumbnail from claim if it exists on web

This commit is contained in:
Sean Yesmunt 2020-06-02 12:44:14 -04:00
parent a0ace5ca58
commit 48eac1188f
3 changed files with 5 additions and 6 deletions

View file

@ -5,7 +5,6 @@ import {
makeSelectIsUriResolving, makeSelectIsUriResolving,
makeSelectClaimIsMine, makeSelectClaimIsMine,
makeSelectClaimIsPending, makeSelectClaimIsPending,
makeSelectThumbnailForUri,
makeSelectCoverForUri, makeSelectCoverForUri,
makeSelectClaimIsNsfw, makeSelectClaimIsNsfw,
selectBlockedChannels, selectBlockedChannels,
@ -28,7 +27,6 @@ const select = (state, props) => ({
obscureNsfw: !selectShowMatureContent(state), obscureNsfw: !selectShowMatureContent(state),
claimIsMine: props.uri && makeSelectClaimIsMine(props.uri)(state), claimIsMine: props.uri && makeSelectClaimIsMine(props.uri)(state),
isResolvingUri: props.uri && makeSelectIsUriResolving(props.uri)(state), isResolvingUri: props.uri && makeSelectIsUriResolving(props.uri)(state),
thumbnail: props.uri && makeSelectThumbnailForUri(props.uri)(state),
cover: props.uri && makeSelectCoverForUri(props.uri)(state), cover: props.uri && makeSelectCoverForUri(props.uri)(state),
nsfw: props.uri && makeSelectClaimIsNsfw(props.uri)(state), nsfw: props.uri && makeSelectClaimIsNsfw(props.uri)(state),
blackListedOutpoints: selectBlackListedOutpoints(state), blackListedOutpoints: selectBlackListedOutpoints(state),

View file

@ -34,7 +34,6 @@ type Props = {
resolveUri: string => void, resolveUri: string => void,
isResolvingUri: boolean, isResolvingUri: boolean,
history: { push: string => void }, history: { push: string => void },
thumbnail: string,
title: string, title: string,
nsfw: boolean, nsfw: boolean,
placeholder: string, placeholder: string,
@ -71,7 +70,6 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
history, history,
uri, uri,
isResolvingUri, isResolvingUri,
thumbnail,
nsfw, nsfw,
resolveUri, resolveUri,
claim, claim,
@ -159,7 +157,7 @@ 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(uri, claim, streamingUrl, getFile, shouldHide) || thumbnail; const thumbnailUrl = useGetThumbnail(uri, claim, streamingUrl, getFile, shouldHide);
function handleContextMenu(e) { function handleContextMenu(e) {
// @if TARGET='app' // @if TARGET='app'

View file

@ -18,7 +18,10 @@ export default function useGetThumbnail(
let thumbnailToUse; let thumbnailToUse;
// @if TARGET='web' // @if TARGET='web'
if (claim && isImage && isFree) { const thumbnailInClaim = claim && claim.value && claim.value.thumbnail && claim.value.thumbnail.url;
if (thumbnailInClaim) {
thumbnailToUse = thumbnailInClaim;
} else if (claim && isImage && isFree) {
thumbnailToUse = generateStreamUrl(claim.name, claim.claim_id); thumbnailToUse = generateStreamUrl(claim.name, claim.claim_id);
} }
// @endif // @endif