fix more type things
This commit is contained in:
@ -20,6 +20,7 @@ export const EventItem = ({
|
||||
size?: "small" | "medium" | "large";
|
||||
}) => {
|
||||
const nextOccurrence = getClosestOccurrence(event);
|
||||
const numOccurrences = event?.occurrences?.length ?? 0;
|
||||
|
||||
return (
|
||||
<li
|
||||
@ -42,9 +43,10 @@ export const EventItem = ({
|
||||
<h1 className={styles.title}>{event.title}</h1>
|
||||
{mode === "list" && nextOccurrence && (
|
||||
<p className={styles.details}>
|
||||
{event.occurrences.length === 1 &&
|
||||
{numOccurrences === 1 &&
|
||||
nextOccurrence?.start &&
|
||||
formatDate(nextOccurrence.start, commonDateFormat)}
|
||||
{event.occurrences.length > 1 && nextOccurrence && (
|
||||
{numOccurrences > 1 && nextOccurrence?.start && (
|
||||
<span>
|
||||
<em>Neste:</em>{" "}
|
||||
{formatDate(nextOccurrence.start, commonDateFormat)}
|
||||
@ -52,11 +54,13 @@ export const EventItem = ({
|
||||
)}
|
||||
</p>
|
||||
)}
|
||||
{mode === "calendar" && event.occurrence?.start && (
|
||||
<p className={styles.details}>
|
||||
{formatDate(event.occurrence?.start, "'kl.' HH:mm")}
|
||||
</p>
|
||||
)}
|
||||
{mode === "calendar" &&
|
||||
"occurrence" in event &&
|
||||
event.occurrence?.start && (
|
||||
<p className={styles.details}>
|
||||
{formatDate(event.occurrence?.start, "'kl.' HH:mm")}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
<Link href={`/arrangementer/${event.slug}`} className="hiddenLink">
|
||||
Mer om arrangementet {event.title}
|
||||
|
Reference in New Issue
Block a user