added affiliated clubs and updated events page
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
import OhSchedule from 'components/officehour/OHSchedule.svelte';
|
||||
import Link from 'components/Link.svelte';
|
||||
import SeoMetaTags from 'components/layout/SeoMetaTags.svelte';
|
||||
import SocialLinks from 'components/homepage/SocialLinks.svelte';
|
||||
import AffiliatedClubs from 'components/homepage/AffiliatedClubs.svelte';
|
||||
import { fade } from 'svelte/transition';
|
||||
|
||||
/** loading things from the server side */
|
||||
@@ -55,7 +55,6 @@
|
||||
</div>
|
||||
</Section>
|
||||
|
||||
<!-- Picture, FAQ -->
|
||||
<!-- Office Hours Calendar -->
|
||||
<Section black>
|
||||
<div class="w-full">
|
||||
@@ -64,6 +63,10 @@
|
||||
</div>
|
||||
</Section>
|
||||
|
||||
<!-- Affiliated Clubs -->
|
||||
<AffiliatedClubs />
|
||||
|
||||
<!-- FAQs and Sponsors -->
|
||||
<Section>
|
||||
<div class="grid w-full max-w-[80vw] grid-cols-1 gap-12 lg:grid-cols-2 lg:gap-24">
|
||||
<div>
|
||||
|
||||
@@ -1,3 +1,31 @@
|
||||
// import type { EventPost } from '$lib/schemas';
|
||||
// import { getFromCMS } from '$lib/utils.js';
|
||||
|
||||
// const eventQuery = `*[_type == "events"]{
|
||||
// name,
|
||||
// category,
|
||||
// date,
|
||||
// location,
|
||||
// description,
|
||||
// reglink,
|
||||
// paylink,
|
||||
// "thumbnail": thumbnail.asset->url+"?h=800&fm=webp",
|
||||
// "lastUpdated": _updatedAt,
|
||||
// }`;
|
||||
|
||||
// export const load = async ({ url }) => {
|
||||
// let listOfEvents: EventPost[] = await getFromCMS(eventQuery);
|
||||
|
||||
// let sortedEvents = listOfEvents.sort(
|
||||
// (a, b) => new Date(b.date).getTime() - new Date(a.date).getTime()
|
||||
// );
|
||||
|
||||
// return {
|
||||
// events: sortedEvents,
|
||||
// canonical: url.href
|
||||
// };
|
||||
// };
|
||||
|
||||
import type { EventPost } from '$lib/schemas';
|
||||
import { getFromCMS } from '$lib/utils.js';
|
||||
|
||||
@@ -13,9 +41,96 @@ const eventQuery = `*[_type == "events"]{
|
||||
"lastUpdated": _updatedAt,
|
||||
}`;
|
||||
|
||||
// Mock future events for testing
|
||||
const getMockFutureEvents = (): EventPost[] => {
|
||||
const today = new Date();
|
||||
const nextWeek = new Date(today);
|
||||
nextWeek.setDate(today.getDate() + 7);
|
||||
|
||||
const twoWeeks = new Date(today);
|
||||
twoWeeks.setDate(today.getDate() + 14);
|
||||
|
||||
const nextMonth = new Date(today);
|
||||
nextMonth.setMonth(today.getMonth() + 1);
|
||||
|
||||
return [
|
||||
{
|
||||
_id: 'mock-1',
|
||||
name: "Antoine's Smash Workshop",
|
||||
category: ['technical'],
|
||||
date: nextWeek.toISOString(),
|
||||
location: 'ECSESS Lounge',
|
||||
description: [
|
||||
{
|
||||
_type: 'block',
|
||||
children: [
|
||||
{
|
||||
_type: 'span',
|
||||
text: 'Antoine should reall get gud at smash'
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
reglink: 'https://example.com/register',
|
||||
paylink: null,
|
||||
thumbnail: null,
|
||||
lastUpdated: today.toISOString()
|
||||
},
|
||||
{
|
||||
_id: 'mock-2',
|
||||
name: 'ECSESS Annual Networking Night',
|
||||
category: ['professional', 'social'],
|
||||
date: twoWeeks.toISOString(),
|
||||
location: 'Trottier ',
|
||||
description: [
|
||||
{
|
||||
_type: 'block',
|
||||
children: [
|
||||
{
|
||||
_type: 'span',
|
||||
text: 'I love placeholder text!'
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
reglink: 'https://example.com/register',
|
||||
paylink: 'https://example.com/payment',
|
||||
thumbnail: null,
|
||||
lastUpdated: today.toISOString()
|
||||
},
|
||||
{
|
||||
_id: 'mock-3',
|
||||
name: 'Midterm Study Session',
|
||||
category: ['academic'],
|
||||
date: nextMonth.toISOString(),
|
||||
location: 'Trottier 5th floor',
|
||||
description: [
|
||||
{
|
||||
_type: 'block',
|
||||
children: [
|
||||
{
|
||||
_type: 'span',
|
||||
text: 'TIME TO LOCK THE FUCK IN'
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
reglink: null,
|
||||
paylink: null,
|
||||
thumbnail: null,
|
||||
lastUpdated: today.toISOString()
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
export const load = async ({ url }) => {
|
||||
let listOfEvents: EventPost[] = await getFromCMS(eventQuery);
|
||||
|
||||
// TEMPORARY: Add mock future events for testing the UI
|
||||
const mockEvents = getMockFutureEvents();
|
||||
listOfEvents = [...listOfEvents, ...mockEvents];
|
||||
// END TEMPORARY - Remove the above two lines when you have real future events
|
||||
|
||||
let sortedEvents = listOfEvents.sort(
|
||||
(a, b) => new Date(b.date).getTime() - new Date(a.date).getTime()
|
||||
);
|
||||
@@ -25,3 +140,5 @@ export const load = async ({ url }) => {
|
||||
canonical: url.href
|
||||
};
|
||||
};
|
||||
|
||||
// TODO: Remember to remove mock events once real future events are available in the CMS.
|
||||
|
||||
Reference in New Issue
Block a user