Fix past events rendered twice (#245)
continuous-integration/drone/push Build is passing Details

Closes #238

Co-authored-by: Jared He <66887902+jaredjhe@users.noreply.github.com>
Reviewed-on: #245
Reviewed-by: Aditya Thakral <a3thakra@csclub.uwaterloo.ca>
Co-authored-by: j285he <j285he@localhost>
Co-committed-by: j285he <j285he@localhost>
This commit is contained in:
Jared He 2021-08-31 23:19:33 -04:00
parent a0d0b8e843
commit 966129adf8
1 changed files with 11 additions and 20 deletions

View File

@ -83,9 +83,18 @@ export default function Term(props: Props) {
</div>
</section>
)}
{hasPastEvents && props.isCurrentTerm && (
{hasPastEvents && (
<section>
{props.isCurrentTerm ? (
<h1>Past Events</h1>
) : (
<h1>
Events Archive:
<span className={styles.blue}>
{` ${capitalize(props.term)} ${props.year}`}
</span>
</h1>
)}
<div className={styles.miniEventCards}>
{props.pastEvents.map(({ content, metadata }) => (
<MiniEventCard
@ -98,14 +107,6 @@ export default function Term(props: Props) {
</div>
</section>
)}
{hasPastEvents && !props.isCurrentTerm && (
<h1>
Events Archive:
<span className={styles.blue}>
{` ${capitalize(props.term)} ${props.year}`}
</span>
</h1>
)}
{!hasFutureEvents && !hasPastEvents && (
<>
<h1>Events</h1>
@ -114,16 +115,6 @@ export default function Term(props: Props) {
later!
</>
)}
<div className={styles.miniEventCards}>
{props.pastEvents.map(({ content, metadata }) => (
<MiniEventCard
{...metadata}
date={new Date(metadata.date)}
description={<MDXRemote {...content} />}
key={metadata.name + metadata.date.toString()}
/>
))}
</div>
</div>
);
}