diff --git a/components/Venue/venue.js b/components/Venue/venue.js index dae60cba..85a138e0 100644 --- a/components/Venue/venue.js +++ b/components/Venue/venue.js @@ -3,28 +3,39 @@ 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} - +
+
cfp is open
+ + +
-
+
{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 affa96a8..6e7b1136 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 ? "" : }