From be49adbe7bce49557dc4d85edab6e745e23127c8 Mon Sep 17 00:00:00 2001 From: Monu <142221687+monoMonu@users.noreply.github.com> Date: Mon, 11 Nov 2024 11:13:42 +0530 Subject: [PATCH] feat: handle past events (#289) * feat: Handle past events * Update venue.js remove explicit export from Venue/venue.js * remove "upcoming" tag * fix event text visibility issue * resolve conflict --------- Co-authored-by: V Thulisile Sibanda <66913810+thulieblack@users.noreply.github.com> Co-authored-by: Ace <40604284+AceTheCreator@users.noreply.github.com> Co-authored-by: asyncapi-bot --- components/Venue/venue.js | 25 +++++++++++++++++++------ pages/venue/[id].js | 23 ++++++++++++++--------- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/components/Venue/venue.js b/components/Venue/venue.js index 74c0b854..e3586677 100644 --- a/components/Venue/venue.js +++ b/components/Venue/venue.js @@ -3,29 +3,42 @@ import React from 'react'; import Link from 'next/link'; import Image from 'next/image'; +export function isEventEnded(date){ + const eventDate = date.split(" "); + const month = eventDate[0]; + const year = eventDate[eventDate.length-1]; + const startDay = eventDate[1].split("-")[0]; + return new Date(`${startDay} ${month} ${year}`) < Date.now() +} + + function Venue({ className, city }) { + + const eventEnded = isEventEnded(city.date); + const textColor = eventEnded ? "text-white": "text-white"; + return ( -
- {city.cfp?
cfp is open
:null} + {city.cfp?
cfp is open
:null} -
-
+
{city.name=='Online'?{city.name} {city.country}:{city.country}, {city.name}}
-
-
{city.date}
+
+
{city.date}
+ {eventEnded ? "ENDED" : ""}
diff --git a/pages/venue/[id].js b/pages/venue/[id].js index 0ea16371..97aac814 100644 --- a/pages/venue/[id].js +++ b/pages/venue/[id].js @@ -6,6 +6,7 @@ import Heading from '../../components/Typography/heading'; import Paragraph from '../../components/Typography/paragraph'; import speakers from '../../config/speakers.json'; import Sponsors from '../../components/Sponsors/sponsors'; +import { isEventEnded } from '../../components/Venue/venue'; import Agenda from '../../components/Agenda/agenda'; import Guidelines from '../../components/Speaker/guideline'; import CFPdata from "../../config/cfp-data.json" @@ -34,33 +35,37 @@ export async function getStaticPaths() { } function Venue({ city }) { + + const eventEnded = isEventEnded(city.date); + const textColor = eventEnded ? "text-gray-400": "text-white"; + return (
- {city.name=='Online'? + {city.name == 'Online' ? {city.name} {city.country} - : - - {city.name}, {city.country} - } + : + + {city.name}, {city.country} + } - {city.description} + {city.description} - + {city.address} - + {city.date} {city.ended ? (city.playlist && ): }