pl-fe: only use logo if provided

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak
2024-09-12 11:16:53 +02:00
parent 6c208a5b91
commit d62e11a1dc
7 changed files with 39 additions and 32 deletions

View File

@@ -7,7 +7,7 @@ import MissingIndicator from 'pl-fe/components/missing-indicator';
import SiteLogo from 'pl-fe/components/site-logo';
import Status from 'pl-fe/components/status';
import { Spinner } from 'pl-fe/components/ui';
import { useAppDispatch, useAppSelector } from 'pl-fe/hooks';
import { useAppDispatch, useAppSelector, useLogo } from 'pl-fe/hooks';
import { iframeId } from 'pl-fe/iframe';
import { makeGetStatus } from 'pl-fe/selectors';
@@ -23,6 +23,7 @@ const EmbeddedStatus: React.FC<IEmbeddedStatus> = ({ params }) => {
const history = useHistory();
const getStatus = useCallback(makeGetStatus(), []);
const intl = useIntl();
const logoSrc = useLogo();
const status = useAppSelector(state => getStatus(state, { id: params.statusId }));
@@ -46,7 +47,7 @@ const EmbeddedStatus: React.FC<IEmbeddedStatus> = ({ params }) => {
}, '*');
}, [status, loading]);
const logo = (
const logo = logoSrc && (
<div className='ml-4 flex justify-center align-middle'>
<SiteLogo className='max-h-[20px] max-w-[112px]' />
</div>
@@ -56,7 +57,7 @@ const EmbeddedStatus: React.FC<IEmbeddedStatus> = ({ params }) => {
if (loading) {
return <Spinner />;
} else if (status) {
return <Status status={status} accountAction={logo} variant='default' />;
return <Status status={status} accountAction={logo || undefined} variant='default' />;
} else {
return <MissingIndicator nested />;
}