hack together a thumbnail message on the channel page
This commit is contained in:
parent
b769a7c40b
commit
9801f43d3e
5 changed files with 38 additions and 10 deletions
|
@ -2,8 +2,6 @@
|
||||||
// On Desktop App, this will find .env.defaults and optional .env in root dir
|
// On Desktop App, this will find .env.defaults and optional .env in root dir
|
||||||
require('dotenv-defaults').config({ silent: false });
|
require('dotenv-defaults').config({ silent: false });
|
||||||
|
|
||||||
console.log('process.env.SIMPLE_SITE', process.env.SIMPLE_SITE);
|
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
MATOMO_URL: process.env.MATOMO_URL,
|
MATOMO_URL: process.env.MATOMO_URL,
|
||||||
MATOMO_ID: process.env.MATOMO_ID,
|
MATOMO_ID: process.env.MATOMO_ID,
|
||||||
|
|
|
@ -80,6 +80,7 @@ function ChannelForm(props: Props) {
|
||||||
} = props;
|
} = props;
|
||||||
const [nameError, setNameError] = React.useState(undefined);
|
const [nameError, setNameError] = React.useState(undefined);
|
||||||
const [bidError, setBidError] = React.useState('');
|
const [bidError, setBidError] = React.useState('');
|
||||||
|
const [coverError, setCoverError] = React.useState(false);
|
||||||
const { claim_id: claimId } = claim || {};
|
const { claim_id: claimId } = claim || {};
|
||||||
const [params, setParams]: [any, (any) => void] = React.useState(getChannelParams());
|
const [params, setParams]: [any, (any) => void] = React.useState(getChannelParams());
|
||||||
const { channelName } = parseURI(uri);
|
const { channelName } = parseURI(uri);
|
||||||
|
@ -228,7 +229,12 @@ function ChannelForm(props: Props) {
|
||||||
iconSize={18}
|
iconSize={18}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{params.coverUrl && <img className="channel-cover__custom" src={params.coverUrl} />}
|
{params.coverUrl &&
|
||||||
|
(coverError ? (
|
||||||
|
<div className="channel-cover__custom--waiting">{__('This will be visible in a few minutes.')}</div>
|
||||||
|
) : (
|
||||||
|
<img className="channel-cover__custom" src={params.coverUrl} onError={() => setCoverError(true)} />
|
||||||
|
))}
|
||||||
<div className="channel__primary-info">
|
<div className="channel__primary-info">
|
||||||
<div className="channel__edit-thumb">
|
<div className="channel__edit-thumb">
|
||||||
<Button
|
<Button
|
||||||
|
@ -252,6 +258,7 @@ function ChannelForm(props: Props) {
|
||||||
uri={uri}
|
uri={uri}
|
||||||
thumbnailPreview={params.thumbnailUrl}
|
thumbnailPreview={params.thumbnailUrl}
|
||||||
allowGifs
|
allowGifs
|
||||||
|
showDelayedMessage
|
||||||
/>
|
/>
|
||||||
<h1 className="channel__title">
|
<h1 className="channel__title">
|
||||||
{params.title || (channelName && '@' + channelName) || (params.name && '@' + params.name)}
|
{params.title || (channelName && '@' + channelName) || (params.name && '@' + params.name)}
|
||||||
|
|
|
@ -16,6 +16,7 @@ type Props = {
|
||||||
claim: ?ChannelClaim,
|
claim: ?ChannelClaim,
|
||||||
doResolveUri: string => void,
|
doResolveUri: string => void,
|
||||||
isResolving: boolean,
|
isResolving: boolean,
|
||||||
|
showDelayedMessage?: boolean,
|
||||||
};
|
};
|
||||||
|
|
||||||
function ChannelThumbnail(props: Props) {
|
function ChannelThumbnail(props: Props) {
|
||||||
|
@ -30,6 +31,7 @@ function ChannelThumbnail(props: Props) {
|
||||||
claim,
|
claim,
|
||||||
doResolveUri,
|
doResolveUri,
|
||||||
isResolving,
|
isResolving,
|
||||||
|
showDelayedMessage = false,
|
||||||
} = props;
|
} = props;
|
||||||
const [thumbError, setThumbError] = React.useState(false);
|
const [thumbError, setThumbError] = React.useState(false);
|
||||||
const shouldResolve = claim === undefined;
|
const shouldResolve = claim === undefined;
|
||||||
|
@ -74,12 +76,18 @@ function ChannelThumbnail(props: Props) {
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{showThumb && (
|
{showThumb && (
|
||||||
<img
|
<>
|
||||||
alt={__('Channel profile picture')}
|
{showDelayedMessage && thumbError ? (
|
||||||
className="channel-thumbnail__custom"
|
<div className="chanel-thumbnail--waiting">{__('This will be visible in a few minutes.')}</div>
|
||||||
src={!thumbError ? thumbnailPreview || thumbnail : Gerbil}
|
) : (
|
||||||
onError={() => setThumbError(true)} // if thumb fails (including due to https replace, show gerbil.
|
<img
|
||||||
/>
|
alt={__('Channel profile picture')}
|
||||||
|
className="channel-thumbnail__custom"
|
||||||
|
src={!thumbError ? thumbnailPreview || thumbnail : Gerbil}
|
||||||
|
onError={() => setThumbError(true)} // if thumb fails (including due to https replace, show gerbil.
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -20,7 +20,7 @@ class ModalConfirmThumbnailUpload extends React.PureComponent<Props> {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { closeModal, file } = this.props;
|
const { closeModal, file } = this.props;
|
||||||
console.log('file', file);
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
isOpen
|
isOpen
|
||||||
|
|
|
@ -34,6 +34,13 @@ $metadata-z-index: 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.channel-cover__custom--waiting {
|
||||||
|
background-color: var(--color-gray-5);
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
.channel-cover__gradient {
|
.channel-cover__gradient {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
@ -69,6 +76,14 @@ $metadata-z-index: 1;
|
||||||
width: 3rem;
|
width: 3rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.chanel-thumbnail--waiting {
|
||||||
|
background-color: var(--color-gray-5);
|
||||||
|
border-radius: var(--border-radius);
|
||||||
|
padding-top: 4rem;
|
||||||
|
padding-left: 1rem;
|
||||||
|
padding-right: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
.channel__thumbnail--channel-page {
|
.channel__thumbnail--channel-page {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
height: var(--channel-thumbnail-width);
|
height: var(--channel-thumbnail-width);
|
||||||
|
|
Loading…
Reference in a new issue