From b38df06447fbdc3b43636cbc9645dbcc4f2053b3 Mon Sep 17 00:00:00 2001 From: piber-dev Date: Mon, 14 Oct 2024 10:10:02 +0200 Subject: [PATCH 1/5] UX updates add desired functionality from issue 389, update text, add buttoms, from mockup found on issue 389, fix references to events page, --- .../community-pages/event-card.astro | 2 +- src/components/community-pages/nav-config.ts | 2 +- src/components/footer/footer.astro | 2 +- src/components/header/popovers/links.tsx | 2 +- .../Community_Page/events/archived.mdx | 9 +++ src/content/Community_Page/events/index.mdx | 2 +- .../events/{upcoming.astro => archived.astro} | 68 +++++++++++-------- src/pages/community/events/index.astro | 40 +++++++---- 8 files changed, 81 insertions(+), 46 deletions(-) create mode 100644 src/content/Community_Page/events/archived.mdx rename src/pages/community/events/{upcoming.astro => archived.astro} (56%) diff --git a/src/components/community-pages/event-card.astro b/src/components/community-pages/event-card.astro index bcae0df0..65de07dc 100644 --- a/src/components/community-pages/event-card.astro +++ b/src/components/community-pages/event-card.astro @@ -46,7 +46,7 @@ const { card } = Astro.props;

{card.description}{" "}

diff --git a/src/components/community-pages/nav-config.ts b/src/components/community-pages/nav-config.ts index 52e6f75f..0c5273e9 100644 --- a/src/components/community-pages/nav-config.ts +++ b/src/components/community-pages/nav-config.ts @@ -6,7 +6,7 @@ export const nav: any = [ }, { label: "Events", - link: "/community/events/upcoming", + link: "/community/events/", enabled: true, }, diff --git a/src/components/footer/footer.astro b/src/components/footer/footer.astro index 27ec4db5..2675771b 100644 --- a/src/components/footer/footer.astro +++ b/src/components/footer/footer.astro @@ -118,7 +118,7 @@ const links = [ { title: "Events", - link: "/community/events/upcoming", + link: "/community/events", }, ], }, diff --git a/src/components/header/popovers/links.tsx b/src/components/header/popovers/links.tsx index 8ab23cae..483224b5 100644 --- a/src/components/header/popovers/links.tsx +++ b/src/components/header/popovers/links.tsx @@ -13,7 +13,7 @@ export const communityItems = [ icon: CalendarHeart, title: "Events", - link: "/community/events/upcoming/", + link: "/community/events/", }, { icon: BadgeCheck, diff --git a/src/content/Community_Page/events/archived.mdx b/src/content/Community_Page/events/archived.mdx new file mode 100644 index 00000000..89a272c4 --- /dev/null +++ b/src/content/Community_Page/events/archived.mdx @@ -0,0 +1,9 @@ +--- +title: Akash Events +description: Here is the list of archived events + +pubDate: "2024-10-14" +disableTableOfContents: true +--- + + diff --git a/src/content/Community_Page/events/index.mdx b/src/content/Community_Page/events/index.mdx index f7bb1e0b..3ea0654d 100644 --- a/src/content/Community_Page/events/index.mdx +++ b/src/content/Community_Page/events/index.mdx @@ -1,6 +1,6 @@ --- title: Akash Events -description: Akash is coming to town! Check out all the upcoming events where you can connect with members of the Akash community IRL. +description: Here is the list of upcoming events pubDate: "2020-01-19" disableTableOfContents: true diff --git a/src/pages/community/events/upcoming.astro b/src/pages/community/events/archived.astro similarity index 56% rename from src/pages/community/events/upcoming.astro rename to src/pages/community/events/archived.astro index ce18baba..1f0b7046 100644 --- a/src/pages/community/events/upcoming.astro +++ b/src/pages/community/events/archived.astro @@ -1,16 +1,40 @@ --- import Tag from "@/components/ui/tag2.astro"; import Layout from "@/layouts/layout.astro"; -import { getCollection } from "astro:content"; +import { getCollection, getEntry } from "astro:content"; +import ButtonLink from "../../../components/ui/button-link.astro"; import EventCard from "@/components/community-pages/event-card.astro"; import TopMargin from "@/components/ui/top-margin.astro"; const cards = await getCollection("Community_Akash_Events_Page"); +const { data } = await getEntry("Community_Page", "events/archived"); const allCards = cards.map((card) => card.data); -const monthwise = allCards.reduce((acc: any, curr: any) => { +const eventDurationInMilliSeconds = 864000000; // 10 days +const archivePeriodInMilliSeconds = 31449600000; // 1 year +const currentOffsetDateTime = new Date(new Date() - eventDurationInMilliSeconds).getTime(); // offset into the past as event duration can last up to a week +const cutoffOffsetDateTime = new Date(new Date() - archivePeriodInMilliSeconds).getTime(); // cutoff time set into the past by the archive period variable for when events should not be shown in archive + +const archivedCards = allCards.filter((curr: any) => { + // skip all tbd events for the archive as we never went to those or they are in the future + if (curr.tbd) { + return false; + } + + const eventDate = new Date(curr.eventDate).getTime(); + + if (eventDate < cutoffOffsetDateTime) { + return false; + } + + return eventDate < currentOffsetDateTime; +}); + +const astroUrl = Astro.url; + +const monthwise = archivedCards.reduce((acc: any, curr: any) => { if (curr.tbd) { if (!acc["TBD"]) { acc["TBD"] = []; @@ -52,54 +76,34 @@ const sortedMonthwiseArray = monthwiseArray.sort((a, b) => { new Date(b.events[0].eventDate).getTime() ); }); - -const currentDate = new Date(); - -const filteredMonthwiseArray = sortedMonthwiseArray.map((item: any) => { - return { - month: item.month, - events: item.events.filter((event: any) => { - return new Date(event.eventDate).getTime() > currentDate.getTime(); - }), - }; -}); - -const filteredMonthwiseArray2 = filteredMonthwiseArray.filter((item: any) => { - return item.events.length > 0; -}); ---

- Akash Events + {data?.title}

- Here is the list of upcoming events + {data?.description}

- -
- All - - Upcoming -
{ - filteredMonthwiseArray2?.map((item: any) => ( + sortedMonthwiseArray?.map((item: any) => (
-

+

{item.month}

@@ -111,6 +115,14 @@ const filteredMonthwiseArray2 = filteredMonthwiseArray.filter((item: any) => { )) }
+ + See upcoming events +
diff --git a/src/pages/community/events/index.astro b/src/pages/community/events/index.astro index 121f850a..9fff1f9e 100644 --- a/src/pages/community/events/index.astro +++ b/src/pages/community/events/index.astro @@ -2,6 +2,7 @@ import Tag from "@/components/ui/tag2.astro"; import Layout from "@/layouts/layout.astro"; import { getCollection, getEntry } from "astro:content"; +import ButtonLink from "../../../components/ui/button-link.astro"; import EventCard from "@/components/community-pages/event-card.astro"; import TopMargin from "@/components/ui/top-margin.astro"; @@ -11,9 +12,25 @@ const { data } = await getEntry("Community_Page", "events"); const allCards = cards.map((card) => card.data); +const eventDurationInMilliSeconds = 864000000; // 10 days +const archivePeriodInMilliSeconds = 31449600000; // 1 year +const currentOffsetDateTime = new Date(new Date() - eventDurationInMilliSeconds).getTime(); // offset into the past as event duration can last up to a week +const cutoffOffsetDateTime = new Date(new Date() - archivePeriodInMilliSeconds).getTime(); // cutoff time set into the past by the archive period variable for when events should not be shown in archive + +const relevantCards = allCards.filter((curr: any) => { + // return true for all tbd events under the assumption that tbd events are set in the future don't always have a set date yet + if (curr.tbd) { + return true; + } + + const eventDate = new Date(curr.eventDate).getTime(); + + return eventDate > currentOffsetDateTime; +}); + const astroUrl = Astro.url; -const monthwise = allCards.reduce((acc: any, curr: any) => { +const monthwise = relevantCards.reduce((acc: any, curr: any) => { if (curr.tbd) { if (!acc["TBD"]) { acc["TBD"] = []; @@ -76,24 +93,13 @@ const sortedMonthwiseArray = monthwiseArray.sort((a, b) => {
- -
- - All - - - Upcoming -
{ sortedMonthwiseArray?.map((item: any) => (
-

+

{item.month}

@@ -105,6 +111,14 @@ const sortedMonthwiseArray = monthwiseArray.sort((a, b) => { )) }
+ + See past events in the archive +
From 34d99dd8d5c04ebe083e91b1f4e6d765e4ea7eed Mon Sep 17 00:00:00 2001 From: piber-dev Date: Mon, 14 Oct 2024 13:53:54 +0200 Subject: [PATCH 2/5] add UI updates --- .../Community_Page/events/archived.mdx | 2 +- src/content/Community_Page/events/index.mdx | 2 +- src/pages/community/events/archived.astro | 77 +++++-------------- src/pages/community/events/index.astro | 73 +++++------------- 4 files changed, 40 insertions(+), 114 deletions(-) diff --git a/src/content/Community_Page/events/archived.mdx b/src/content/Community_Page/events/archived.mdx index 89a272c4..565b6095 100644 --- a/src/content/Community_Page/events/archived.mdx +++ b/src/content/Community_Page/events/archived.mdx @@ -1,5 +1,5 @@ --- -title: Akash Events +title: Akash Events (Archive) description: Here is the list of archived events pubDate: "2024-10-14" diff --git a/src/content/Community_Page/events/index.mdx b/src/content/Community_Page/events/index.mdx index 3ea0654d..b27601e4 100644 --- a/src/content/Community_Page/events/index.mdx +++ b/src/content/Community_Page/events/index.mdx @@ -1,6 +1,6 @@ --- title: Akash Events -description: Here is the list of upcoming events +description: Explore the list of upcoming events pubDate: "2020-01-19" disableTableOfContents: true diff --git a/src/pages/community/events/archived.astro b/src/pages/community/events/archived.astro index 1f0b7046..1198b30a 100644 --- a/src/pages/community/events/archived.astro +++ b/src/pages/community/events/archived.astro @@ -34,36 +34,7 @@ const archivedCards = allCards.filter((curr: any) => { const astroUrl = Astro.url; -const monthwise = archivedCards.reduce((acc: any, curr: any) => { - if (curr.tbd) { - if (!acc["TBD"]) { - acc["TBD"] = []; - } - acc["TBD"].push(curr); - return acc; - } - - const month = new Date(curr.eventDate).toLocaleString("default", { - month: "long", - }); - if (!acc[month]) { - acc[month] = []; - } - acc[month].push(curr); - - return acc; -}, {}); - -const monthwiseArray = Object.keys(monthwise).map((month) => { - return { - month, - events: monthwise?.[month]?.sort((a: any, b: any) => { - return new Date(a.eventDate).getTime() - new Date(b.eventDate).getTime(); - }), - }; -}); - -const sortedMonthwiseArray = monthwiseArray.sort((a, b) => { +const sortedCards = archivedCards.sort((a, b) => { if (a.month === "TBD") { return 1; } @@ -72,8 +43,8 @@ const sortedMonthwiseArray = monthwiseArray.sort((a, b) => { } return ( - new Date(a.events[0].eventDate).getTime() - - new Date(b.events[0].eventDate).getTime() + new Date(a.eventDate).getTime() - + new Date(b.eventDate).getTime() ); }); --- @@ -82,47 +53,39 @@ const sortedMonthwiseArray = monthwiseArray.sort((a, b) => { title={data?.title} image="/meta-images/community.png" image="/meta-images/community.png" - description={"data?.description"} + description={data?.description} >
-
+

{data?.title}

{data?.description}

- -
-
+
{ - sortedMonthwiseArray?.map((item: any) => ( -
-

- {item.month} -

-
- {item.events.map((card: any) => ( - - ))} -
+
+ {sortedCards.map((card: any) => ( + + ))}
- )) } +
+ + See current and upcoming events + +
- - See upcoming events -
- + \ No newline at end of file diff --git a/src/pages/community/events/index.astro b/src/pages/community/events/index.astro index 9fff1f9e..494eca39 100644 --- a/src/pages/community/events/index.astro +++ b/src/pages/community/events/index.astro @@ -30,36 +30,7 @@ const relevantCards = allCards.filter((curr: any) => { const astroUrl = Astro.url; -const monthwise = relevantCards.reduce((acc: any, curr: any) => { - if (curr.tbd) { - if (!acc["TBD"]) { - acc["TBD"] = []; - } - acc["TBD"].push(curr); - return acc; - } - - const month = new Date(curr.eventDate).toLocaleString("default", { - month: "long", - }); - if (!acc[month]) { - acc[month] = []; - } - acc[month].push(curr); - - return acc; -}, {}); - -const monthwiseArray = Object.keys(monthwise).map((month) => { - return { - month, - events: monthwise?.[month]?.sort((a: any, b: any) => { - return new Date(a.eventDate).getTime() - new Date(b.eventDate).getTime(); - }), - }; -}); - -const sortedMonthwiseArray = monthwiseArray.sort((a, b) => { +const sortedCards = relevantCards.sort((a, b) => { if (a.month === "TBD") { return 1; } @@ -68,8 +39,8 @@ const sortedMonthwiseArray = monthwiseArray.sort((a, b) => { } return ( - new Date(a.events[0].eventDate).getTime() - - new Date(b.events[0].eventDate).getTime() + new Date(a.eventDate).getTime() - + new Date(b.eventDate).getTime() ); }); --- @@ -83,42 +54,34 @@ const sortedMonthwiseArray = monthwiseArray.sort((a, b) => {
-
+

{data?.title}

{data?.description}

- -
-
+
{ - sortedMonthwiseArray?.map((item: any) => ( -
-

- {item.month} -

-
- {item.events.map((card: any) => ( - - ))} -
+
+ {sortedCards.map((card: any) => ( + + ))}
- )) } +
+ + See past events in the archive + +
- - See past events in the archive -
From 77bf5ddfe33dda59acf117610f92591bf2d31add Mon Sep 17 00:00:00 2001 From: piber-dev Date: Tue, 15 Oct 2024 11:52:35 +0200 Subject: [PATCH 3/5] add mobile responsiveness add mobile responsiveness, remove fixed widths, re-use some of old styling, --- src/pages/community/events/archived.astro | 8 ++++---- src/pages/community/events/index.astro | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/pages/community/events/archived.astro b/src/pages/community/events/archived.astro index 1198b30a..a3afabae 100644 --- a/src/pages/community/events/archived.astro +++ b/src/pages/community/events/archived.astro @@ -56,9 +56,9 @@ const sortedCards = archivedCards.sort((a, b) => { description={data?.description} > -
+
-
+

{data?.title}

@@ -68,9 +68,9 @@ const sortedCards = archivedCards.sort((a, b) => {
-
+
{ -
+
{sortedCards.map((card: any) => ( ))} diff --git a/src/pages/community/events/index.astro b/src/pages/community/events/index.astro index 494eca39..28ae6706 100644 --- a/src/pages/community/events/index.astro +++ b/src/pages/community/events/index.astro @@ -52,9 +52,9 @@ const sortedCards = relevantCards.sort((a, b) => { description={data?.description} > -
+
-
+

{data?.title}

@@ -64,9 +64,9 @@ const sortedCards = relevantCards.sort((a, b) => {
-
+
{ -
+
{sortedCards.map((card: any) => ( ))} From c9d520b47bdd941c98ef7ebbbb9cfe91be467de7 Mon Sep 17 00:00:00 2001 From: piber-dev Date: Tue, 15 Oct 2024 14:48:45 +0200 Subject: [PATCH 4/5] add small fixes sort tbd events to end, add borders to bottom of pages, add redirect from old url to new url, --- src/pages/community/events/archived.astro | 8 +------- src/pages/community/events/index.astro | 7 ++++--- src/utils/redirects.ts | 2 +- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/pages/community/events/archived.astro b/src/pages/community/events/archived.astro index a3afabae..15e46751 100644 --- a/src/pages/community/events/archived.astro +++ b/src/pages/community/events/archived.astro @@ -35,13 +35,6 @@ const archivedCards = allCards.filter((curr: any) => { const astroUrl = Astro.url; const sortedCards = archivedCards.sort((a, b) => { - if (a.month === "TBD") { - return 1; - } - if (b.month === "TBD") { - return -1; - } - return ( new Date(a.eventDate).getTime() - new Date(b.eventDate).getTime() @@ -88,4 +81,5 @@ const sortedCards = archivedCards.sort((a, b) => {
+
\ No newline at end of file diff --git a/src/pages/community/events/index.astro b/src/pages/community/events/index.astro index 28ae6706..24bc0e3e 100644 --- a/src/pages/community/events/index.astro +++ b/src/pages/community/events/index.astro @@ -31,10 +31,10 @@ const relevantCards = allCards.filter((curr: any) => { const astroUrl = Astro.url; const sortedCards = relevantCards.sort((a, b) => { - if (a.month === "TBD") { + if (a.tbd) { return 1; } - if (b.month === "TBD") { + if (b.tbd) { return -1; } @@ -84,4 +84,5 @@ const sortedCards = relevantCards.sort((a, b) => {
- +
+ \ No newline at end of file diff --git a/src/utils/redirects.ts b/src/utils/redirects.ts index 458634c3..1a2287a6 100644 --- a/src/utils/redirects.ts +++ b/src/utils/redirects.ts @@ -4,7 +4,7 @@ export const redirects = { "/community": "/community/akash-insiders/", "/about": "/about/general-information/", "/blog/a/acc-akash-accelerationism": "/blog/a-acc-akash-accelerationism/", - + "/community/events/upcoming": "/community/events/", "/roadmap": "https://github.com/orgs/akash-network/projects/5/views/1?layout=roadmap", "/careers": "/", From 7dd4163fbef90020f577e3af88ae218c35a49263 Mon Sep 17 00:00:00 2001 From: piber-dev Date: Tue, 15 Oct 2024 18:57:16 +0200 Subject: [PATCH 5/5] add more consistent lines to most pages remove bottom border from deploy.astro file and both event pages and re-added it to CTA.astro instead which is present on all pages. --- src/components/CTA.astro | 2 +- src/layouts/layout.astro | 3 ++- src/pages/community/events/archived.astro | 1 - src/pages/community/events/index.astro | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/CTA.astro b/src/components/CTA.astro index c43574a7..fdcce580 100644 --- a/src/components/CTA.astro +++ b/src/components/CTA.astro @@ -38,7 +38,7 @@ if (pathname.startsWith("/ecosystem/providers")) { ? "hidden" : "" } - mt-10 flex flex-col items-center justify-around bg-white border-y px-[30px] py-[80px] text-center dark:bg-background2 md:mt-16 lg:py-[160px]`} + mt-10 flex flex-col items-center justify-around bg-white border-t px-[30px] py-[80px] text-center dark:bg-background2 md:mt-16 lg:py-[160px]`} >

-

+
+
diff --git a/src/pages/community/events/archived.astro b/src/pages/community/events/archived.astro index 15e46751..f0898003 100644 --- a/src/pages/community/events/archived.astro +++ b/src/pages/community/events/archived.astro @@ -81,5 +81,4 @@ const sortedCards = archivedCards.sort((a, b) => {
-
\ No newline at end of file diff --git a/src/pages/community/events/index.astro b/src/pages/community/events/index.astro index 24bc0e3e..045dd458 100644 --- a/src/pages/community/events/index.astro +++ b/src/pages/community/events/index.astro @@ -84,5 +84,5 @@ const sortedCards = relevantCards.sort((a, b) => {
-
- \ No newline at end of file + +
\ No newline at end of file