tweak location display logic

This commit is contained in:
Matthias Kretschmann 2024-04-21 14:38:01 +01:00
parent 519e587e5a
commit 4cdb1ed0c0
Signed by: m
GPG Key ID: 606EEEF3C479A91F
1 changed files with 29 additions and 26 deletions

View File

@ -42,33 +42,36 @@ export default function Location() {
return (
<div className={styles.wrapper}>
{!isPending && location?.now?.city ? (
{!isPending ? (
<Animation>
<Flag
country={{
code: location.now.country_code,
name: location.now.country
}}
/>
{location.now.city} <span>Now</span>
<div className={styles.next}>
{location?.next?.city && (
<>
{isDifferentCountry && (
<Flag
country={{
code: location.next.country_code,
name: location.next.country
}}
/>
)}
{location.next.city}{' '}
<span>
{relativeTime.from(new Date(location.next.date_start))}
</span>
</>
)}
</div>
{location?.now?.city ? (
<>
<Flag
country={{
code: location.now.country_code,
name: location.now.country
}}
/>
{location.now.city} <span>Now</span>
</>
) : null}
{location?.next?.city && (
<div className={styles.next}>
{isDifferentCountry && (
<Flag
country={{
code: location.next.country_code,
name: location.next.country
}}
/>
)}
{location.next.city}{' '}
<span>
{relativeTime.from(new Date(location.next.date_start))}
</span>
</div>
)}
</Animation>
) : null}
</div>