Added short URL title to visits header

This commit is contained in:
Alejandro Celaya
2021-03-05 15:44:15 +01:00
parent df87ad5867
commit 87a32b412f
4 changed files with 32 additions and 17 deletions

View File

@@ -17,6 +17,7 @@ const ShortUrlVisitsHeader = ({ shortUrlDetail, shortUrlVisits, goBack }: ShortU
const { visits } = shortUrlVisits;
const shortLink = shortUrl?.shortUrl ?? '';
const longLink = shortUrl?.longUrl ?? '';
const title = shortUrl?.title;
const renderDate = () => !shortUrl ? <small>Loading...</small> : (
<span>
@@ -39,9 +40,9 @@ const ShortUrlVisitsHeader = ({ shortUrlDetail, shortUrlVisits, goBack }: ShortU
<hr />
<div>Created: {renderDate()}</div>
<div>
Long URL:{' '}
{`${title ? 'Title' : 'Long URL'}: `}
{loading && <small>Loading...</small>}
{!loading && <ExternalLink href={longLink} />}
{!loading && <ExternalLink href={longLink}>{title ?? longLink}</ExternalLink>}
</div>
</VisitsHeader>
);