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 2461d83
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions src/pages/events/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,26 @@ import { markketplace } from "@config";
const stores = await getCollection("stores");
let events = await getCollection("events");
<<<<<<< HEAD
const store: { data: Store } = stores.find(
(store: any) => store.data.slug === markketplace.STORE_SLUG
=======
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
>>>>>>> 167df79 (Displaying only future events, in ascending start date order)
) as any;
const pages = await getCollection("pages");
Expand All @@ -49,7 +67,11 @@ const { currentPage, totalPages } = Astro.props;
description,
}}
>
<<<<<<< HEAD
<Header store={store} />
=======
<Header store={store as any as { data: Store }} />
>>>>>>> 167df79 (Displaying only future events, in ascending start date order)
<main id="main-content">
<section id="about" class="mb-10 prose-img:border-0">
{
Expand Down Expand Up @@ -78,16 +100,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 2461d83

Please sign in to comment.