From 78422ccfb2d1255eb03b0c10c976595bf03807ea Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Wed, 3 Jun 2020 13:49:44 -0400 Subject: [PATCH] fix thumbnails on desktop --- static/app-strings.json | 5 +++-- ui/effects/use-get-thumbnail.js | 17 +++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/static/app-strings.json b/static/app-strings.json index 51e01245d..ecbb8dc4d 100644 --- a/static/app-strings.json +++ b/static/app-strings.json @@ -1201,5 +1201,6 @@ "LBRY takes privacy and choice seriously. Just a few questions before you enter the land of content freedom. ": "LBRY takes privacy and choice seriously. Just a few questions before you enter the land of content freedom. ", "Sending information to third parties (e.g. Google Analytics or Mixpanel) allows us to use detailed\n analytical reports to improve all aspects of LBRY.": "Sending information to third parties (e.g. Google Analytics or Mixpanel) allows us to use detailed\n analytical reports to improve all aspects of LBRY.", "Sharing information with LBRY, Inc. allows us to report to publishers how their content is doing, as\n well as track basic usage and performance. This is the minimum required to earn rewards from LBRY, Inc.": "Sharing information with LBRY, Inc. allows us to report to publishers how their content is doing, as\n well as track basic usage and performance. This is the minimum required to earn rewards from LBRY, Inc.", - "No information will be sent directly to LBRY, Inc. or third-parties about your usage. Note that as\n peer-to-peer software, your IP address and potentially other system information can be sent to other\n users, though this information is not stored permanently.": "No information will be sent directly to LBRY, Inc. or third-parties about your usage. Note that as\n peer-to-peer software, your IP address and potentially other system information can be sent to other\n users, though this information is not stored permanently." -} + "No information will be sent directly to LBRY, Inc. or third-parties about your usage. Note that as\n peer-to-peer software, your IP address and potentially other system information can be sent to other\n users, though this information is not stored permanently.": "No information will be sent directly to LBRY, Inc. or third-parties about your usage. Note that as\n peer-to-peer software, your IP address and potentially other system information can be sent to other\n users, though this information is not stored permanently.", + "%view_count% Views": "%view_count% Views" +} \ No newline at end of file diff --git a/ui/effects/use-get-thumbnail.js b/ui/effects/use-get-thumbnail.js index 0a8a71350..dda985b59 100644 --- a/ui/effects/use-get-thumbnail.js +++ b/ui/effects/use-get-thumbnail.js @@ -9,16 +9,15 @@ export default function useGetThumbnail( getFile: string => void, shouldHide: boolean ) { - // const hasClaim = claim !== undefined; + let thumbnailToUse; // $FlowFixMe const isImage = claim && claim.value && claim.value.stream_type === 'image'; // $FlowFixMe const isFree = claim && claim.value && (!claim.value.fee || Number(claim.value.fee.amount) <= 0); - let thumbnailToUse; + const thumbnailInClaim = claim && claim.value && claim.value.thumbnail && claim.value.thumbnail.url; // @if TARGET='web' - const thumbnailInClaim = claim && claim.value && claim.value.thumbnail && claim.value.thumbnail.url; if (thumbnailInClaim) { thumbnailToUse = thumbnailInClaim; } else if (claim && isImage && isFree) { @@ -26,12 +25,9 @@ export default function useGetThumbnail( } // @endif - const [thumbnail, setThumbnail] = React.useState(thumbnailToUse); - React.useEffect(() => { - setThumbnail(thumbnailToUse); - }, [thumbnailToUse]); - // @if TARGET='app' + thumbnailToUse = thumbnailInClaim; + // // Temporarily disabled until we can call get with "save_blobs: off" // @@ -46,5 +42,10 @@ export default function useGetThumbnail( // }, [hasClaim, isFree, isImage, streamingUrl, uri, shouldHide]); // @endif + const [thumbnail, setThumbnail] = React.useState(thumbnailToUse); + React.useEffect(() => { + setThumbnail(thumbnailToUse); + }, [thumbnailToUse]); + return thumbnail; }