default avatar config
This commit is contained in:
parent
032e17cecd
commit
8919182c0c
2 changed files with 5 additions and 2 deletions
|
@ -63,6 +63,7 @@ const config = {
|
||||||
ENABLE_MATURE: process.env.ENABLE_MATURE === 'true',
|
ENABLE_MATURE: process.env.ENABLE_MATURE === 'true',
|
||||||
CUSTOM_HOMEPAGE: process.env.CUSTOM_HOMEPAGE === 'true',
|
CUSTOM_HOMEPAGE: process.env.CUSTOM_HOMEPAGE === 'true',
|
||||||
SHOW_TAGS_INTRO: process.env.SHOW_TAGS_INTRO === 'true',
|
SHOW_TAGS_INTRO: process.env.SHOW_TAGS_INTRO === 'true',
|
||||||
|
AVATAR_DEFAULT: process.env.AVATAR_DEFAULT,
|
||||||
};
|
};
|
||||||
|
|
||||||
config.URL_LOCAL = `http://localhost:${config.WEB_SERVER_PORT}`;
|
config.URL_LOCAL = `http://localhost:${config.WEB_SERVER_PORT}`;
|
||||||
|
|
|
@ -6,6 +6,7 @@ import Gerbil from './gerbil.png';
|
||||||
import FreezeframeWrapper from 'component/fileThumbnail/FreezeframeWrapper';
|
import FreezeframeWrapper from 'component/fileThumbnail/FreezeframeWrapper';
|
||||||
import ChannelStakedIndicator from 'component/channelStakedIndicator';
|
import ChannelStakedIndicator from 'component/channelStakedIndicator';
|
||||||
import OptimizedImage from 'component/optimizedImage';
|
import OptimizedImage from 'component/optimizedImage';
|
||||||
|
import { AVATAR_DEFAULT } from 'config';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
thumbnail: ?string,
|
thumbnail: ?string,
|
||||||
|
@ -48,6 +49,7 @@ function ChannelThumbnail(props: Props) {
|
||||||
const channelThumbnail = thumbnail || thumbnailPreview;
|
const channelThumbnail = thumbnail || thumbnailPreview;
|
||||||
const isGif = channelThumbnail && channelThumbnail.endsWith('gif');
|
const isGif = channelThumbnail && channelThumbnail.endsWith('gif');
|
||||||
const showThumb = (!obscure && !!thumbnail) || thumbnailPreview;
|
const showThumb = (!obscure && !!thumbnail) || thumbnailPreview;
|
||||||
|
const defaultAvater = AVATAR_DEFAULT || Gerbil;
|
||||||
|
|
||||||
// Generate a random color class based on the first letter of the channel name
|
// Generate a random color class based on the first letter of the channel name
|
||||||
const { channelName } = parseURI(uri);
|
const { channelName } = parseURI(uri);
|
||||||
|
@ -86,7 +88,7 @@ function ChannelThumbnail(props: Props) {
|
||||||
<OptimizedImage
|
<OptimizedImage
|
||||||
alt={__('Channel profile picture')}
|
alt={__('Channel profile picture')}
|
||||||
className="channel-thumbnail__default"
|
className="channel-thumbnail__default"
|
||||||
src={!thumbError && channelThumbnail ? channelThumbnail : Gerbil}
|
src={!thumbError && channelThumbnail ? channelThumbnail : defaultAvater}
|
||||||
loading={noLazyLoad ? undefined : 'lazy'}
|
loading={noLazyLoad ? undefined : 'lazy'}
|
||||||
onError={() => setThumbError(true)} // if thumb fails (including due to https replace, show gerbil.
|
onError={() => setThumbError(true)} // if thumb fails (including due to https replace, show gerbil.
|
||||||
/>
|
/>
|
||||||
|
@ -99,7 +101,7 @@ function ChannelThumbnail(props: Props) {
|
||||||
<OptimizedImage
|
<OptimizedImage
|
||||||
alt={__('Channel profile picture')}
|
alt={__('Channel profile picture')}
|
||||||
className="channel-thumbnail__custom"
|
className="channel-thumbnail__custom"
|
||||||
src={!thumbError && channelThumbnail ? channelThumbnail : Gerbil}
|
src={!thumbError && channelThumbnail ? channelThumbnail : defaultAvater}
|
||||||
loading={noLazyLoad ? undefined : 'lazy'}
|
loading={noLazyLoad ? undefined : 'lazy'}
|
||||||
onError={() => setThumbError(true)} // if thumb fails (including due to https replace, show gerbil.
|
onError={() => setThumbError(true)} // if thumb fails (including due to https replace, show gerbil.
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in a new issue