Skip to content

Commit

Permalink
Displaying only future events, in ascending start date order
Browse files Browse the repository at this point in the history
  • Loading branch information
Daveed authored and dvidsilva committed Jan 30, 2025
1 parent e3d55cc commit f7c289a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
2 changes: 2 additions & 0 deletions src/pages/events/confirmation.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import Layout from "../../layouts/Layout.astro";
import { getRecordById, getRecordBySlug } from "../../lib/strapi";
// @TODO : Retrieve event data
// @TODO: Change RSVP id to UUID & retrieve record
const event = {
id: 6,
Name: "Brooklyn Tech Expo, Feb 2025",
Expand Down
28 changes: 17 additions & 11 deletions src/pages/events/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,21 @@ import { markketplace } from "@config";
const stores = await getCollection("stores");
let events = await getCollection("events");
const today = new Date();
events = events
.filter(event => new Date(event.data.startDate) > today)
.sort((a, b) => {
return (
new Date(a.data.startDate).getTime() -
new Date(b.data.startDate).getTime()
);
});
// @TODO: separate future and past events
const store: { data: Store } = stores.find(
(store: any) => store.data.slug === markketplace.STORE_SLUG
(store: any) => store.data?.slug === markketplace?.STORE_SLUG
) as any;
const pages = await getCollection("pages");
Expand All @@ -49,7 +62,7 @@ const { currentPage, totalPages } = Astro.props;
description,
}}
>
<Header store={store} />
<Header store={store as any as { data: Store }} />
<main id="main-content">
<section id="about" class="mb-10 prose-img:border-0">
{
Expand Down Expand Up @@ -78,16 +91,9 @@ const { currentPage, totalPages } = Astro.props;
frontmatter={{
author: "x",
title: data.Name || data.SEO?.metaTitle || "---",
pubDatetime: new Date(data.createdAt),
modDatetime: new Date(data.updatedAt),
pubDatetime: new Date(data.startDate),
modDatetime: new Date(data.startDate),
description: data.SEO?.metaDescription || data.Description || "",
SEO: {
...data.SEO,
metaTitle: data.SEO?.metaTitle || data.Name || "Store",
socialImage: {
url: data.SEO?.socialImage?.url || data.Thumbnail?.url,
},
},
}}
/>
))
Expand Down

0 comments on commit f7c289a

Please sign in to comment.