diff --git a/components/event/EventCard.js b/components/event/EventCard.js index 9c567a5a7f0..9a54e8faa79 100644 --- a/components/event/EventCard.js +++ b/components/event/EventCard.js @@ -1,4 +1,5 @@ import Link from "next/link"; +import { FaMicrophoneAlt } from "react-icons/fa"; import { MdOutlineOnlinePrediction, MdOutlinePeople, @@ -28,6 +29,10 @@ export default function EventCard({ event, username }) { )} {event.isInPerson && } + {event.date.cfpClose && + new Date(event.date.cfpClose) > new Date() && ( + + )}
diff --git a/components/event/EventKey.js b/components/event/EventKey.js index 6d94064fa75..967f25fff0a 100644 --- a/components/event/EventKey.js +++ b/components/event/EventKey.js @@ -1,41 +1,60 @@ import { IconContext } from "react-icons"; +import { FaListUl, FaMicrophoneAlt } from "react-icons/fa"; import { MdOutlineOnlinePrediction, MdOutlinePeople } from "react-icons/md"; -export default function EventKey({ events }) { - const inPersonEvents = events.filter(event => event.isInPerson).length; - const virtualEvents = events.filter(event => event.isVirtual).length; +export default function EventKey({ categorisedEvents, onToggleEventType }) { + const filters = [ + { + title: "Show all", + description: "List all events with no filters", + key: "all", + icon: FaListUl, + }, + { + title: "CFP open", + description: "You can submit a talk to this conference", + key: "cfpOpen", + icon: FaMicrophoneAlt, + }, + { + title: "In person", + description: "These are in person events", + key: "inPerson", + icon: MdOutlinePeople, + }, + { + title: "Virtual", + description: "Held virtually online event", + key: "virtual", + icon: MdOutlineOnlinePrediction, + }, + ]; + return (
-
-
- - - -
-
-
-
{inPersonEvents}
-
-
-
- - - -
-
-
+ ))}
); } diff --git a/components/user/UserEvents.js b/components/user/UserEvents.js index 255287d2121..56fb7c70b46 100644 --- a/components/user/UserEvents.js +++ b/components/user/UserEvents.js @@ -1,15 +1,31 @@ +import { useState } from "react"; + import EventCard from "../event/EventCard"; import Alert from "../Alert"; import EventKey from "../event/EventKey"; export default function UserEvents({ data }) { + const [eventType, seteventType] = useState("all"); + let categorisedEvents = { + all: data.events, + virtual: data.events.filter((event) => event.isVirtual === true), + inPerson: data.events.filter((event) => event.isInPerson === true), + cfpOpen: data.events.filter((event) => + event.date.cfpClose ? new Date(event.date.cfpClose) > new Date() : false + ), + }; + return (
- + seteventType(newValue)} + /> + {!data.events && }
    {data.events && - data.events.map((event, index) => ( + categorisedEvents[eventType].map((event, index) => ( ))}
diff --git a/data/eddiejaoude/events/2023-09-18-talk-infobip.json b/data/eddiejaoude/events/2023-09-18-talk-infobip.json index 1c7dc3a552a..cbbb1a70d9e 100644 --- a/data/eddiejaoude/events/2023-09-18-talk-infobip.json +++ b/data/eddiejaoude/events/2023-09-18-talk-infobip.json @@ -6,7 +6,8 @@ "description": "This is not another developer event. This is an experience that brings together the global tech community for two days of learning, networking, and creating new memories. This is a gathering of professionals, founders, leaders, disruptors, and dreamers. This is Infobip Shift. And we want to Shift Your World.", "date": { "start": "2023-09-18T10:00:00.000+00:00", - "end": "2023-09-19T18:00:00.000+00:00" + "end": "2023-09-19T18:00:00.000+00:00", + "cfpClose": "2023-05-15T18:00:00.000+00:00" }, "url": "https://shift.infobip.com" } diff --git a/data/juliafmorgado/events/2023-02-07-civo-navigate.json b/data/juliafmorgado/events/2023-02-07-civo-navigate.json index e449c05a788..c270ef3103a 100644 --- a/data/juliafmorgado/events/2023-02-07-civo-navigate.json +++ b/data/juliafmorgado/events/2023-02-07-civo-navigate.json @@ -1,11 +1,11 @@ { - "isInPerson": true, - "color": "red", - "name": "CIVO Navigate", - "description": "A two-day conference in **Tampa, FL**, revolving around topics such as **Kubernetes**, **Edge Computing**, **Machine Learning**, **Dev/GitOps**, **Observability**, **Security**, and **Cloud Native Transformation**, where I will be delivering a workshop on Open Source developer tool **Acorn**.", - "date": { - "start": "2023-02-07T08:30:00.000-05:00", - "end": "2023-02-08T17:40:00.000-05:00" - }, - "url": "https://civo.com/navigate" + "isInPerson": true, + "color": "red", + "name": "CIVO Navigate", + "description": "A two-day conference in **Tampa, FL**, revolving around topics such as **Kubernetes**, **Edge Computing**, **Machine Learning**, **Dev/GitOps**, **Observability**, **Security**, and **Cloud Native Transformation**, where I will be delivering a workshop on Open Source developer tool **Acorn**.", + "date": { + "start": "2023-02-07T08:30:00.000-05:00", + "end": "2023-02-08T17:40:00.000-05:00" + }, + "url": "https://civo.com/navigate" } diff --git a/pages/docs/how-to-guides/events.mdx b/pages/docs/how-to-guides/events.mdx index c762c8ed347..7e9095bbf64 100644 --- a/pages/docs/how-to-guides/events.mdx +++ b/pages/docs/how-to-guides/events.mdx @@ -1,5 +1,5 @@ import DocsLayout from "../../../components/layouts/DocsLayout.js"; -import ClipboardCopy from "../../../components/ClipboardCopy" +import ClipboardCopy from "../../../components/ClipboardCopy"; ## Events @@ -31,7 +31,8 @@ _If you need help on how to edit this file, please see the [Editing guide](/docs "description": "In this livestream I will be going reviewing your **Open Source projects** and profiles! I will be joined by **Amanda**, a Developer Advocate.", "date": { "start": "2022-12-09T16:00:00.000+00:00", - "end": "2022-12-09T17:00:00.000+00:00" + "end": "2022-12-09T17:00:00.000+00:00", + "cfpClose": "2022-10-09T17:00:00.000+00:00" }, "url": "https://www.youtube.com/watch?v=iqIFD02OkVE" } @@ -45,6 +46,7 @@ _If you need help on how to edit this file, please see the [Editing guide](/docs | name | Name of the event | | description | More details about the event, this can include markdown | | date | Start and end date plus time of the event | +| cfpClose | [optional] The date of when the CFP to submit a talk closes | | url | Where can people learn more about the event | 4. Now you can commit your file and create a Pull Request. For more details please see [Editing guide](/docs/how-to-guides/editing) diff --git a/pages/events.js b/pages/events.js index 2f90b63df07..ede85b1aaa3 100644 --- a/pages/events.js +++ b/pages/events.js @@ -1,4 +1,5 @@ import Head from "next/head"; +import { useState } from "react"; import EventCard from "../components/event/EventCard"; import Alert from "../components/Alert"; @@ -20,6 +21,16 @@ export async function getServerSideProps(context) { } export default function Events({ events }) { + const [eventType, seteventType] = useState("all"); + let categorisedEvents = { + all: events, + virtual: events.filter((event) => event.isVirtual === true), + inPerson: events.filter((event) => event.isInPerson === true), + cfpOpen: data.events.filter((event) => + event.date.cfpClose ? new Date(event.date.cfpClose) > new Date() : false + ), + }; + return ( <> @@ -30,11 +41,14 @@ export default function Events({ events }) {

Community events

- + seteventType(newValue)} + /> {!events.length && }
    - {events.map((event, index) => ( + {categorisedEvents[eventType].map((event, index) => ( ))}