Update links type for events
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import type { InputValue } from '@portabletext/svelte';
|
||||
|
||||
|
||||
export type EventPost = {
|
||||
id: string;
|
||||
name: string;
|
||||
@@ -8,14 +9,16 @@ export type EventPost = {
|
||||
time: string;
|
||||
location: string;
|
||||
thumbnail: string;
|
||||
reglink: string;
|
||||
category: string;
|
||||
paylink: string; // event payment link (e.g., Zeffy)
|
||||
links: [{
|
||||
title: string,
|
||||
kind: string, // payment, registration, general (enum `kind`)
|
||||
url: string
|
||||
}],
|
||||
};
|
||||
|
||||
export type Category = 'allEvents' | 'academic' | 'professional' | 'social' | 'technical';
|
||||
|
||||
|
||||
export type FAQ = {
|
||||
question: string;
|
||||
answer: string;
|
||||
|
||||
@@ -7,21 +7,24 @@ const eventQuery = `*[_type == "events"]{
|
||||
date,
|
||||
location,
|
||||
description,
|
||||
reglink,
|
||||
paylink,
|
||||
"links": links[]{
|
||||
"kind": kind,
|
||||
"title": title,
|
||||
"url": url
|
||||
},
|
||||
"thumbnail": thumbnail.asset->url+"?h=800&fm=webp",
|
||||
"lastUpdated": _updatedAt,
|
||||
}`;
|
||||
|
||||
export const load = async ({ url }) => {
|
||||
let listOfEvents: EventPost[] = await getFromCMS(eventQuery);
|
||||
let listOfEvents: EventPost[] = await getFromCMS(eventQuery);
|
||||
|
||||
let sortedEvents = listOfEvents.sort(
|
||||
(a, b) => new Date(b.date).getTime() - new Date(a.date).getTime()
|
||||
);
|
||||
let sortedEvents = listOfEvents.sort(
|
||||
(a, b) => new Date(b.date).getTime() - new Date(a.date).getTime()
|
||||
);
|
||||
|
||||
return {
|
||||
events: sortedEvents,
|
||||
canonical: url.href
|
||||
};
|
||||
return {
|
||||
events: sortedEvents,
|
||||
canonical: url.href
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user