Skip to content

Commit

Permalink
Merge branch 'master' into borderimage
Browse files Browse the repository at this point in the history
  • Loading branch information
TenzDelek authored Dec 15, 2024
2 parents bad03fd + 052353c commit 0d25d11
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
25 changes: 17 additions & 8 deletions components/Venue/venue.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,28 @@ 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()
export function getEventStatus(date){
const today = new Date();
const event = new Date(date);

if (event.toDateString() === today.toDateString()) {
return "Ongoing";
} else if (event > today) {
return "Upcoming";
} else {
return "Ended";
}
}

export function isEventEnded(date){
return getEventStatus(date) === "Ended";
}

function Venue({ className, city }) {

const eventEnded = isEventEnded(city.date);
const textColor = eventEnded ? "text-white": "text-white";
const eventStatus = getEventStatus(city.date);

return (
<Link href={`/venue/${city.name}`}>
Expand All @@ -37,8 +46,8 @@ function Venue({ className, city }) {
{city.name=='Online'?<span className='text-lg font-bold'>{city.name} {city.country}</span>:<span className='text-lg font-bold'>{city.country}, {city.name}</span>}
</div>
<div className='flex align-end flex-row justify-between pt-2'>
<div className='inline-block border border-gray-400 rounded-lg py-1 px-2 text-center'>{city.date}</div>
<span className=' text-white flex align-middle pt-2' style={{ fontSize: ".9em" }}>{eventEnded ? "ENDED" : ""}</span>
<div className='inline-block border border-gray-400 rounded-lg py-1 px-2 text-center sm:text-sm text-base'>{city.date}</div>
<span className=' text-white flex align-middle pt-2 sm:text-[0.8rem] sm:leading-4 text-base'>{eventStatus}</span>
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions config/city-lists.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"name": "Online",
"country": " Edition",
"date": "30th October 2024",
"date": "October 30, 2024",
"cfpdate":"Not announced yet",
"description": "Join us for the AsyncAPI Online Conference Edition as the community unites across the globe to share experiences, collaborate, and foster meaningful connections.",
"img": "/img/testMic.webp",
Expand All @@ -21,7 +21,7 @@
{
"name": "Helsinki",
"country": "Finland",
"date": "May 29 2024",
"date": "May 29, 2024",
"cfpdate":"Not announced yet",
"description": "Join us in Helsinki for the AsyncAPI Conference, where we will explore all things AsyncAPI and connect physical and digital worlds. Get excited as we delve into sustainable APIs for the Era of AI, Data Platforms, and Quantum Computing!.",
"img": "/img/finland.webp",
Expand Down
5 changes: 3 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0d25d11

Please sign in to comment.