lbry-desktop/ui/component/channelThumbnail/view.jsx

130 lines
4.2 KiB
React
Raw Normal View History

2019-05-07 04:35:04 +02:00
// @flow
import React from 'react';
2019-05-11 21:06:22 +02:00
import { parseURI } from 'lbry-redux';
import classnames from 'classnames';
odysee fix replay select styling make meme a link Fix audio references get newest livestream claim in livestreamLink pin crackermilk fix livestream banner placement fix live page fix rebase fix rebase fix error nag fix darkmode blockquote style break word on livestream comment text fix dark mode snack fix live badge fix lint small fixes - word wrap, live badge wip Fix invisible snack in Odysee Light Theme Revert "wip" This reverts commit d17e477fe0e6633709ea30bdc403448825db4c71. Revert "small fixes - word wrap, live badge" This reverts commit 0e431d4038d774079c78f0de32238aac7260e4ca. fix blank pinned destiny fix badges and homepage again only get livestreams live for less than a day pinned hammy and olivia multi pin pin destiny updated pinned videos update tagline Update view.jsx pins updated destiny's video updated pinned videos removed destiny, added lie likes music pinned destiny and mason's woodshop removed hammy and olivia unpinned mason's woodshop removed pins added hammy and olivia pinned sam seder unpinned destiny and hammy and olivia Fix merge on ChannelThumbnails - sam seder, + hammy & olivia and passion for food update tagline (#6086) removed everyone, added kona and suba Theme color fixes (odysee) (#6089) * Cherry-pick master's 'base-theme.scss' * Non-functional cleanup (remove dups, re-order, etc.) * Dark: update positive Toast to --color-primary as well. This follows the intention of the refactoring, which I guess was (1) reduce the number of color names (2) reduce the number of customizations needed. The only issue I have with this is that the current Odysee primary color is pink, which can be intepreted as an error. The original (pre-refactoring color was green). For now, I follow the refactoring path. We can tweak this later. * Fix text color inside '--color-card-background-highlighted' Light: use base-theme (it was the same value anyway). Dark: use bright text. * Dark: add some contrast between the components The color for the background, header, card, placeholder, etc. is almost identical -- it looks like there are all in the same component. The almost-invisible border doesn't help. One would have to crank up the monitor's contrast setting to see separation of components. Brighten up the components a bit, somewhat following the same scale as lbry.tv's dark theme. Overall, I still think it's too dark. The Card's background color can still be brightened up further for better contrast, but I try not to make too drastic of a change for now. The original lbry.tv's gray theme is the most pleasant theme I've seen so far, but this is all subjective. changed pins removed kona and suba added destiny changed pins removed destiny pinned sgtducky changed pins removed sgtducky added hammy and olivia added chrissie mayr added the bite shot changed pins removed the bite shot added heads of tech changed pins removed hammy and olivia removed chrissie mayr changed pins removed heads of tech added crackermilk changed pins removed crackermilk added some ordinary gamer added passion for food changed pins removed some ordinary gamers removed passion for food added emmy hucker changed pins added game knights Update view.jsx Force rebuild changed pins removed emmy hucker changed pins removed game knights added crackermilk changed pins removed crackermilk added some ordinary gamer changed pins removed some ordinary gamers added passion for food added green renaissance changed pins removed passion for food removed green renaissance added expand love changed pins removed expand love added dr nora change tagline (#6122) there's so much room for activities comment out music changed pins removed dr nora added kona and suba changed pins removed kona and suba added destiny changed pins removed destiny added crackermilk changed pins removed crackermilk added someordinarygamers change tagline Drake, where's the door hole? changed pins unpinned someordinarygamers pinned kona and suba Add message for mature content changed pin changed pins removed creative model changed pins added bcpov added krish mohan added cigarvixen changed pins removed krish mohan added adrian logan bump fix footer change tagline just like the simulations changed pins removed: bcpov cigarvixen adrian logan added: someordinarygamers quick fix for reposts oops fix channel tabs changed pin removed someordinarygamers added kona and suba changed pins removed kona and suba added dirtyworkz added crackermilk
2021-06-11 19:47:56 +02:00
import Spaceman from './spaceman.png';
import Transparent from './transparent_1x1.png';
2020-05-28 19:07:04 +02:00
import FreezeframeWrapper from 'component/fileThumbnail/FreezeframeWrapper';
import ChannelStakedIndicator from 'component/channelStakedIndicator';
ChannelThumbnail fixes (#6075) * Restore "use cdn for channel thumbnails" This reverts commit e7adc607faa418ee78f1bbff6cca9904e9039323. * ChannelThumbnail: disable optimization in Channel Page and for GIFs ## Issue 5564: Don't use optimized URLs on channel pages (profile/banner) ## Notes This is not the best/full solution yet, but it is better than what we have to today (one step in the right direction). Optimized channel thumbnail size is currently hardcoded to a lowest common denominator. - Pro(s): - For images used in multiple places (different sizes) in a page, the total time needed to get the optimized version for each size is too much. Also, the optimizer seems to increase the size of the image in some cases. So, getting 1 image and re-using it is faster for this scenario. - Simpler code (no need to mount first -> get dimension -> load image) - Cons: - We aren't fully optimizing the size, so not really addressing Core Web Vitals score problem. - e.g. in the front page, we could have used a smaller image for the channel thumbnails. - We haven't address the problem with large screen sizes. * Restore channel selector This reverts b5cc0bb42de162137a3df1b1cebc0b01bd2cee27 * ChannelThumbnail: fix lazy-loading - Closes 6066: Revisit lazy-loading Channel thumbnails - Properly fixes 5933: Thumbnail lazy-load causes ChannelSelector icon to not update. - Add effect-dependency on `channelThumbnail` and `thumbError`. - Really perform the lazy-loading now. - `data-src` was not used, so it wasn't actually lazy loading previously.
2021-05-17 21:51:21 +02:00
import { getThumbnailCdnUrl } from 'util/thumbnail';
import useLazyLoading from 'effects/use-lazy-loading';
2019-05-07 04:35:04 +02:00
type Props = {
thumbnail: ?string,
uri: ?string,
2019-06-11 20:10:58 +02:00
className?: string,
thumbnailPreview: ?string,
obscure?: boolean,
2019-12-04 19:07:40 +01:00
small?: boolean,
2020-05-28 19:07:04 +02:00
allowGifs?: boolean,
2020-07-23 16:22:57 +02:00
claim: ?ChannelClaim,
doResolveUri: (string) => void,
2020-08-24 20:44:41 +02:00
isResolving: boolean,
showDelayedMessage?: boolean,
hideStakedIndicator?: boolean,
2021-04-23 21:59:48 +02:00
xsmall?: boolean,
ChannelThumbnail fixes (#6075) * Restore "use cdn for channel thumbnails" This reverts commit e7adc607faa418ee78f1bbff6cca9904e9039323. * ChannelThumbnail: disable optimization in Channel Page and for GIFs ## Issue 5564: Don't use optimized URLs on channel pages (profile/banner) ## Notes This is not the best/full solution yet, but it is better than what we have to today (one step in the right direction). Optimized channel thumbnail size is currently hardcoded to a lowest common denominator. - Pro(s): - For images used in multiple places (different sizes) in a page, the total time needed to get the optimized version for each size is too much. Also, the optimizer seems to increase the size of the image in some cases. So, getting 1 image and re-using it is faster for this scenario. - Simpler code (no need to mount first -> get dimension -> load image) - Cons: - We aren't fully optimizing the size, so not really addressing Core Web Vitals score problem. - e.g. in the front page, we could have used a smaller image for the channel thumbnails. - We haven't address the problem with large screen sizes. * Restore channel selector This reverts b5cc0bb42de162137a3df1b1cebc0b01bd2cee27 * ChannelThumbnail: fix lazy-loading - Closes 6066: Revisit lazy-loading Channel thumbnails - Properly fixes 5933: Thumbnail lazy-load causes ChannelSelector icon to not update. - Add effect-dependency on `channelThumbnail` and `thumbError`. - Really perform the lazy-loading now. - `data-src` was not used, so it wasn't actually lazy loading previously.
2021-05-17 21:51:21 +02:00
noOptimization?: boolean,
2019-05-07 04:35:04 +02:00
};
function ChannelThumbnail(props: Props) {
const {
thumbnail: rawThumbnail,
uri,
className,
thumbnailPreview: rawThumbnailPreview,
obscure,
small = false,
2021-04-23 21:59:48 +02:00
xsmall = false,
allowGifs = false,
2020-07-23 16:22:57 +02:00
claim,
doResolveUri,
2020-08-24 20:44:41 +02:00
isResolving,
showDelayedMessage = false,
hideStakedIndicator = false,
ChannelThumbnail fixes (#6075) * Restore "use cdn for channel thumbnails" This reverts commit e7adc607faa418ee78f1bbff6cca9904e9039323. * ChannelThumbnail: disable optimization in Channel Page and for GIFs ## Issue 5564: Don't use optimized URLs on channel pages (profile/banner) ## Notes This is not the best/full solution yet, but it is better than what we have to today (one step in the right direction). Optimized channel thumbnail size is currently hardcoded to a lowest common denominator. - Pro(s): - For images used in multiple places (different sizes) in a page, the total time needed to get the optimized version for each size is too much. Also, the optimizer seems to increase the size of the image in some cases. So, getting 1 image and re-using it is faster for this scenario. - Simpler code (no need to mount first -> get dimension -> load image) - Cons: - We aren't fully optimizing the size, so not really addressing Core Web Vitals score problem. - e.g. in the front page, we could have used a smaller image for the channel thumbnails. - We haven't address the problem with large screen sizes. * Restore channel selector This reverts b5cc0bb42de162137a3df1b1cebc0b01bd2cee27 * ChannelThumbnail: fix lazy-loading - Closes 6066: Revisit lazy-loading Channel thumbnails - Properly fixes 5933: Thumbnail lazy-load causes ChannelSelector icon to not update. - Add effect-dependency on `channelThumbnail` and `thumbError`. - Really perform the lazy-loading now. - `data-src` was not used, so it wasn't actually lazy loading previously.
2021-05-17 21:51:21 +02:00
noOptimization,
} = props;
const [thumbError, setThumbError] = React.useState(false);
2020-07-23 16:22:57 +02:00
const shouldResolve = claim === undefined;
const thumbnail = rawThumbnail && rawThumbnail.trim().replace(/^http:\/\//i, 'https://');
const thumbnailPreview = rawThumbnailPreview && rawThumbnailPreview.trim().replace(/^http:\/\//i, 'https://');
2020-05-28 19:07:04 +02:00
const channelThumbnail = thumbnail || thumbnailPreview;
ChannelThumbnail fixes (#6075) * Restore "use cdn for channel thumbnails" This reverts commit e7adc607faa418ee78f1bbff6cca9904e9039323. * ChannelThumbnail: disable optimization in Channel Page and for GIFs ## Issue 5564: Don't use optimized URLs on channel pages (profile/banner) ## Notes This is not the best/full solution yet, but it is better than what we have to today (one step in the right direction). Optimized channel thumbnail size is currently hardcoded to a lowest common denominator. - Pro(s): - For images used in multiple places (different sizes) in a page, the total time needed to get the optimized version for each size is too much. Also, the optimizer seems to increase the size of the image in some cases. So, getting 1 image and re-using it is faster for this scenario. - Simpler code (no need to mount first -> get dimension -> load image) - Cons: - We aren't fully optimizing the size, so not really addressing Core Web Vitals score problem. - e.g. in the front page, we could have used a smaller image for the channel thumbnails. - We haven't address the problem with large screen sizes. * Restore channel selector This reverts b5cc0bb42de162137a3df1b1cebc0b01bd2cee27 * ChannelThumbnail: fix lazy-loading - Closes 6066: Revisit lazy-loading Channel thumbnails - Properly fixes 5933: Thumbnail lazy-load causes ChannelSelector icon to not update. - Add effect-dependency on `channelThumbnail` and `thumbError`. - Really perform the lazy-loading now. - `data-src` was not used, so it wasn't actually lazy loading previously.
2021-05-17 21:51:21 +02:00
const isGif = channelThumbnail && channelThumbnail.endsWith('gif');
2019-12-07 16:56:00 +01:00
const showThumb = (!obscure && !!thumbnail) || thumbnailPreview;
ChannelThumbnail fixes (#6075) * Restore "use cdn for channel thumbnails" This reverts commit e7adc607faa418ee78f1bbff6cca9904e9039323. * ChannelThumbnail: disable optimization in Channel Page and for GIFs ## Issue 5564: Don't use optimized URLs on channel pages (profile/banner) ## Notes This is not the best/full solution yet, but it is better than what we have to today (one step in the right direction). Optimized channel thumbnail size is currently hardcoded to a lowest common denominator. - Pro(s): - For images used in multiple places (different sizes) in a page, the total time needed to get the optimized version for each size is too much. Also, the optimizer seems to increase the size of the image in some cases. So, getting 1 image and re-using it is faster for this scenario. - Simpler code (no need to mount first -> get dimension -> load image) - Cons: - We aren't fully optimizing the size, so not really addressing Core Web Vitals score problem. - e.g. in the front page, we could have used a smaller image for the channel thumbnails. - We haven't address the problem with large screen sizes. * Restore channel selector This reverts b5cc0bb42de162137a3df1b1cebc0b01bd2cee27 * ChannelThumbnail: fix lazy-loading - Closes 6066: Revisit lazy-loading Channel thumbnails - Properly fixes 5933: Thumbnail lazy-load causes ChannelSelector icon to not update. - Add effect-dependency on `channelThumbnail` and `thumbError`. - Really perform the lazy-loading now. - `data-src` was not used, so it wasn't actually lazy loading previously.
2021-05-17 21:51:21 +02:00
const thumbnailRef = React.useRef(null);
// Generate a random color class based on the first letter of the channel name
2019-12-04 19:07:40 +01:00
const { channelName } = parseURI(uri);
let initializer;
2019-12-04 19:07:40 +01:00
let colorClassName;
if (channelName) {
initializer = channelName.charCodeAt(0) - 65; // will be between 0 and 57
2019-12-04 19:07:40 +01:00
colorClassName = `channel-thumbnail__default--${Math.abs(initializer % 4)}`;
} else {
2019-12-04 19:07:40 +01:00
colorClassName = `channel-thumbnail__default--4`;
}
2020-07-23 16:22:57 +02:00
React.useEffect(() => {
if (shouldResolve && uri) {
doResolveUri(uri);
}
}, [doResolveUri, shouldResolve, uri]);
ChannelThumbnail fixes (#6075) * Restore "use cdn for channel thumbnails" This reverts commit e7adc607faa418ee78f1bbff6cca9904e9039323. * ChannelThumbnail: disable optimization in Channel Page and for GIFs ## Issue 5564: Don't use optimized URLs on channel pages (profile/banner) ## Notes This is not the best/full solution yet, but it is better than what we have to today (one step in the right direction). Optimized channel thumbnail size is currently hardcoded to a lowest common denominator. - Pro(s): - For images used in multiple places (different sizes) in a page, the total time needed to get the optimized version for each size is too much. Also, the optimizer seems to increase the size of the image in some cases. So, getting 1 image and re-using it is faster for this scenario. - Simpler code (no need to mount first -> get dimension -> load image) - Cons: - We aren't fully optimizing the size, so not really addressing Core Web Vitals score problem. - e.g. in the front page, we could have used a smaller image for the channel thumbnails. - We haven't address the problem with large screen sizes. * Restore channel selector This reverts b5cc0bb42de162137a3df1b1cebc0b01bd2cee27 * ChannelThumbnail: fix lazy-loading - Closes 6066: Revisit lazy-loading Channel thumbnails - Properly fixes 5933: Thumbnail lazy-load causes ChannelSelector icon to not update. - Add effect-dependency on `channelThumbnail` and `thumbError`. - Really perform the lazy-loading now. - `data-src` was not used, so it wasn't actually lazy loading previously.
2021-05-17 21:51:21 +02:00
useLazyLoading(thumbnailRef, 0.25, [showThumb, thumbError, channelThumbnail]);
if (isGif && !allowGifs) {
return (
<FreezeframeWrapper src={channelThumbnail} className={classnames('channel-thumbnail', className)}>
{!hideStakedIndicator && <ChannelStakedIndicator uri={uri} claim={claim} />}
</FreezeframeWrapper>
);
}
ChannelThumbnail fixes (#6075) * Restore "use cdn for channel thumbnails" This reverts commit e7adc607faa418ee78f1bbff6cca9904e9039323. * ChannelThumbnail: disable optimization in Channel Page and for GIFs ## Issue 5564: Don't use optimized URLs on channel pages (profile/banner) ## Notes This is not the best/full solution yet, but it is better than what we have to today (one step in the right direction). Optimized channel thumbnail size is currently hardcoded to a lowest common denominator. - Pro(s): - For images used in multiple places (different sizes) in a page, the total time needed to get the optimized version for each size is too much. Also, the optimizer seems to increase the size of the image in some cases. So, getting 1 image and re-using it is faster for this scenario. - Simpler code (no need to mount first -> get dimension -> load image) - Cons: - We aren't fully optimizing the size, so not really addressing Core Web Vitals score problem. - e.g. in the front page, we could have used a smaller image for the channel thumbnails. - We haven't address the problem with large screen sizes. * Restore channel selector This reverts b5cc0bb42de162137a3df1b1cebc0b01bd2cee27 * ChannelThumbnail: fix lazy-loading - Closes 6066: Revisit lazy-loading Channel thumbnails - Properly fixes 5933: Thumbnail lazy-load causes ChannelSelector icon to not update. - Add effect-dependency on `channelThumbnail` and `thumbError`. - Really perform the lazy-loading now. - `data-src` was not used, so it wasn't actually lazy loading previously.
2021-05-17 21:51:21 +02:00
let url = channelThumbnail;
// @if TARGET='web'
// Pass image urls through a compression proxy, except for GIFs.
if (thumbnail && !noOptimization && !(isGif && allowGifs)) {
url = getThumbnailCdnUrl({ thumbnail });
}
// @endif
2019-05-07 04:35:04 +02:00
return (
2019-05-11 21:06:22 +02:00
<div
2019-06-11 20:10:58 +02:00
className={classnames('channel-thumbnail', className, {
2019-08-02 17:11:31 +02:00
[colorClassName]: !showThumb,
2019-12-04 19:07:40 +01:00
'channel-thumbnail--small': small,
2021-04-23 21:59:48 +02:00
'channel-thumbnail--xsmall': xsmall,
2020-08-24 20:44:41 +02:00
'channel-thumbnail--resolving': isResolving,
2019-05-11 21:06:22 +02:00
})}
>
2020-01-30 21:55:45 +01:00
{!showThumb && (
<img
ChannelThumbnail fixes (#6075) * Restore "use cdn for channel thumbnails" This reverts commit e7adc607faa418ee78f1bbff6cca9904e9039323. * ChannelThumbnail: disable optimization in Channel Page and for GIFs ## Issue 5564: Don't use optimized URLs on channel pages (profile/banner) ## Notes This is not the best/full solution yet, but it is better than what we have to today (one step in the right direction). Optimized channel thumbnail size is currently hardcoded to a lowest common denominator. - Pro(s): - For images used in multiple places (different sizes) in a page, the total time needed to get the optimized version for each size is too much. Also, the optimizer seems to increase the size of the image in some cases. So, getting 1 image and re-using it is faster for this scenario. - Simpler code (no need to mount first -> get dimension -> load image) - Cons: - We aren't fully optimizing the size, so not really addressing Core Web Vitals score problem. - e.g. in the front page, we could have used a smaller image for the channel thumbnails. - We haven't address the problem with large screen sizes. * Restore channel selector This reverts b5cc0bb42de162137a3df1b1cebc0b01bd2cee27 * ChannelThumbnail: fix lazy-loading - Closes 6066: Revisit lazy-loading Channel thumbnails - Properly fixes 5933: Thumbnail lazy-load causes ChannelSelector icon to not update. - Add effect-dependency on `channelThumbnail` and `thumbError`. - Really perform the lazy-loading now. - `data-src` was not used, so it wasn't actually lazy loading previously.
2021-05-17 21:51:21 +02:00
ref={thumbnailRef}
2020-01-30 21:55:45 +01:00
alt={__('Channel profile picture')}
className="channel-thumbnail__default"
odysee fix replay select styling make meme a link Fix audio references get newest livestream claim in livestreamLink pin crackermilk fix livestream banner placement fix live page fix rebase fix rebase fix error nag fix darkmode blockquote style break word on livestream comment text fix dark mode snack fix live badge fix lint small fixes - word wrap, live badge wip Fix invisible snack in Odysee Light Theme Revert "wip" This reverts commit d17e477fe0e6633709ea30bdc403448825db4c71. Revert "small fixes - word wrap, live badge" This reverts commit 0e431d4038d774079c78f0de32238aac7260e4ca. fix blank pinned destiny fix badges and homepage again only get livestreams live for less than a day pinned hammy and olivia multi pin pin destiny updated pinned videos update tagline Update view.jsx pins updated destiny's video updated pinned videos removed destiny, added lie likes music pinned destiny and mason's woodshop removed hammy and olivia unpinned mason's woodshop removed pins added hammy and olivia pinned sam seder unpinned destiny and hammy and olivia Fix merge on ChannelThumbnails - sam seder, + hammy & olivia and passion for food update tagline (#6086) removed everyone, added kona and suba Theme color fixes (odysee) (#6089) * Cherry-pick master's 'base-theme.scss' * Non-functional cleanup (remove dups, re-order, etc.) * Dark: update positive Toast to --color-primary as well. This follows the intention of the refactoring, which I guess was (1) reduce the number of color names (2) reduce the number of customizations needed. The only issue I have with this is that the current Odysee primary color is pink, which can be intepreted as an error. The original (pre-refactoring color was green). For now, I follow the refactoring path. We can tweak this later. * Fix text color inside '--color-card-background-highlighted' Light: use base-theme (it was the same value anyway). Dark: use bright text. * Dark: add some contrast between the components The color for the background, header, card, placeholder, etc. is almost identical -- it looks like there are all in the same component. The almost-invisible border doesn't help. One would have to crank up the monitor's contrast setting to see separation of components. Brighten up the components a bit, somewhat following the same scale as lbry.tv's dark theme. Overall, I still think it's too dark. The Card's background color can still be brightened up further for better contrast, but I try not to make too drastic of a change for now. The original lbry.tv's gray theme is the most pleasant theme I've seen so far, but this is all subjective. changed pins removed kona and suba added destiny changed pins removed destiny pinned sgtducky changed pins removed sgtducky added hammy and olivia added chrissie mayr added the bite shot changed pins removed the bite shot added heads of tech changed pins removed hammy and olivia removed chrissie mayr changed pins removed heads of tech added crackermilk changed pins removed crackermilk added some ordinary gamer added passion for food changed pins removed some ordinary gamers removed passion for food added emmy hucker changed pins added game knights Update view.jsx Force rebuild changed pins removed emmy hucker changed pins removed game knights added crackermilk changed pins removed crackermilk added some ordinary gamer changed pins removed some ordinary gamers added passion for food added green renaissance changed pins removed passion for food removed green renaissance added expand love changed pins removed expand love added dr nora change tagline (#6122) there's so much room for activities comment out music changed pins removed dr nora added kona and suba changed pins removed kona and suba added destiny changed pins removed destiny added crackermilk changed pins removed crackermilk added someordinarygamers change tagline Drake, where's the door hole? changed pins unpinned someordinarygamers pinned kona and suba Add message for mature content changed pin changed pins removed creative model changed pins added bcpov added krish mohan added cigarvixen changed pins removed krish mohan added adrian logan bump fix footer change tagline just like the simulations changed pins removed: bcpov cigarvixen adrian logan added: someordinarygamers quick fix for reposts oops fix channel tabs changed pin removed someordinarygamers added kona and suba changed pins removed kona and suba added dirtyworkz added crackermilk
2021-06-11 19:47:56 +02:00
data-src={!thumbError && url ? url : Spaceman}
src={Transparent}
onError={() => setThumbError(true)} // if thumb fails (including due to https replace, show gerbil.
2020-01-30 21:55:45 +01:00
/>
)}
{showThumb && (
<>
{showDelayedMessage && thumbError ? (
<div className="chanel-thumbnail--waiting">{__('This will be visible in a few minutes.')}</div>
) : (
<img
ChannelThumbnail fixes (#6075) * Restore "use cdn for channel thumbnails" This reverts commit e7adc607faa418ee78f1bbff6cca9904e9039323. * ChannelThumbnail: disable optimization in Channel Page and for GIFs ## Issue 5564: Don't use optimized URLs on channel pages (profile/banner) ## Notes This is not the best/full solution yet, but it is better than what we have to today (one step in the right direction). Optimized channel thumbnail size is currently hardcoded to a lowest common denominator. - Pro(s): - For images used in multiple places (different sizes) in a page, the total time needed to get the optimized version for each size is too much. Also, the optimizer seems to increase the size of the image in some cases. So, getting 1 image and re-using it is faster for this scenario. - Simpler code (no need to mount first -> get dimension -> load image) - Cons: - We aren't fully optimizing the size, so not really addressing Core Web Vitals score problem. - e.g. in the front page, we could have used a smaller image for the channel thumbnails. - We haven't address the problem with large screen sizes. * Restore channel selector This reverts b5cc0bb42de162137a3df1b1cebc0b01bd2cee27 * ChannelThumbnail: fix lazy-loading - Closes 6066: Revisit lazy-loading Channel thumbnails - Properly fixes 5933: Thumbnail lazy-load causes ChannelSelector icon to not update. - Add effect-dependency on `channelThumbnail` and `thumbError`. - Really perform the lazy-loading now. - `data-src` was not used, so it wasn't actually lazy loading previously.
2021-05-17 21:51:21 +02:00
ref={thumbnailRef}
alt={__('Channel profile picture')}
className="channel-thumbnail__custom"
odysee fix replay select styling make meme a link Fix audio references get newest livestream claim in livestreamLink pin crackermilk fix livestream banner placement fix live page fix rebase fix rebase fix error nag fix darkmode blockquote style break word on livestream comment text fix dark mode snack fix live badge fix lint small fixes - word wrap, live badge wip Fix invisible snack in Odysee Light Theme Revert "wip" This reverts commit d17e477fe0e6633709ea30bdc403448825db4c71. Revert "small fixes - word wrap, live badge" This reverts commit 0e431d4038d774079c78f0de32238aac7260e4ca. fix blank pinned destiny fix badges and homepage again only get livestreams live for less than a day pinned hammy and olivia multi pin pin destiny updated pinned videos update tagline Update view.jsx pins updated destiny's video updated pinned videos removed destiny, added lie likes music pinned destiny and mason's woodshop removed hammy and olivia unpinned mason's woodshop removed pins added hammy and olivia pinned sam seder unpinned destiny and hammy and olivia Fix merge on ChannelThumbnails - sam seder, + hammy & olivia and passion for food update tagline (#6086) removed everyone, added kona and suba Theme color fixes (odysee) (#6089) * Cherry-pick master's 'base-theme.scss' * Non-functional cleanup (remove dups, re-order, etc.) * Dark: update positive Toast to --color-primary as well. This follows the intention of the refactoring, which I guess was (1) reduce the number of color names (2) reduce the number of customizations needed. The only issue I have with this is that the current Odysee primary color is pink, which can be intepreted as an error. The original (pre-refactoring color was green). For now, I follow the refactoring path. We can tweak this later. * Fix text color inside '--color-card-background-highlighted' Light: use base-theme (it was the same value anyway). Dark: use bright text. * Dark: add some contrast between the components The color for the background, header, card, placeholder, etc. is almost identical -- it looks like there are all in the same component. The almost-invisible border doesn't help. One would have to crank up the monitor's contrast setting to see separation of components. Brighten up the components a bit, somewhat following the same scale as lbry.tv's dark theme. Overall, I still think it's too dark. The Card's background color can still be brightened up further for better contrast, but I try not to make too drastic of a change for now. The original lbry.tv's gray theme is the most pleasant theme I've seen so far, but this is all subjective. changed pins removed kona and suba added destiny changed pins removed destiny pinned sgtducky changed pins removed sgtducky added hammy and olivia added chrissie mayr added the bite shot changed pins removed the bite shot added heads of tech changed pins removed hammy and olivia removed chrissie mayr changed pins removed heads of tech added crackermilk changed pins removed crackermilk added some ordinary gamer added passion for food changed pins removed some ordinary gamers removed passion for food added emmy hucker changed pins added game knights Update view.jsx Force rebuild changed pins removed emmy hucker changed pins removed game knights added crackermilk changed pins removed crackermilk added some ordinary gamer changed pins removed some ordinary gamers added passion for food added green renaissance changed pins removed passion for food removed green renaissance added expand love changed pins removed expand love added dr nora change tagline (#6122) there's so much room for activities comment out music changed pins removed dr nora added kona and suba changed pins removed kona and suba added destiny changed pins removed destiny added crackermilk changed pins removed crackermilk added someordinarygamers change tagline Drake, where's the door hole? changed pins unpinned someordinarygamers pinned kona and suba Add message for mature content changed pin changed pins removed creative model changed pins added bcpov added krish mohan added cigarvixen changed pins removed krish mohan added adrian logan bump fix footer change tagline just like the simulations changed pins removed: bcpov cigarvixen adrian logan added: someordinarygamers quick fix for reposts oops fix channel tabs changed pin removed someordinarygamers added kona and suba changed pins removed kona and suba added dirtyworkz added crackermilk
2021-06-11 19:47:56 +02:00
data-src={!thumbError && url ? url : Spaceman}
src={Transparent}
onError={() => setThumbError(true)} // if thumb fails (including due to https replace, show gerbil.
/>
)}
</>
2020-01-30 21:55:45 +01:00
)}
{!hideStakedIndicator && <ChannelStakedIndicator uri={uri} claim={claim} />}
2019-05-07 04:35:04 +02:00
</div>
);
}
export default ChannelThumbnail;