Schemas update + Image optimization
Resolves: https://github.com/mcgill-ecsess/ECSESS/issues/20
This commit is contained in:
@@ -11,6 +11,11 @@ export type EventPost = {
|
||||
payment: string; // event payment link (e.g., Zeffy)
|
||||
};
|
||||
|
||||
export type FAQ = {
|
||||
question: string;
|
||||
answer: string;
|
||||
}
|
||||
|
||||
import type { InputValue } from '@portabletext/svelte';
|
||||
|
||||
export type HomepageCMSResponse = {
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { HomepageCMSResponse, OhCMSResponse } from '$lib/schemas';
|
||||
|
||||
const homepageQuery = `*[_type == "homepage"]{
|
||||
"description": description[],
|
||||
"councilPhoto": councilPhoto.asset->url,
|
||||
"councilPhoto": councilPhoto.asset->url+"?h=1200&fm=webp",
|
||||
"faqs": faqs[]{ question, answer },
|
||||
}[0]`;
|
||||
|
||||
|
||||
@@ -1,21 +1,26 @@
|
||||
import type { CouncilMember } from '$lib/schemas';
|
||||
import { getFromCMS } from '$lib/utils.js';
|
||||
|
||||
const query = `*[_type == "members"]{
|
||||
// Note: council member image has height of 200px for
|
||||
// CouncilCard: image is `size-32` ~ 128px
|
||||
// CouncilCardPopUp: image is `size-42` ~ 168px
|
||||
const councilQuery = `*[_type == "members"]{
|
||||
name,
|
||||
email,
|
||||
position,
|
||||
positionDescription,
|
||||
"image": image.asset->url,
|
||||
"image": image.asset->url+"?h=200&fm=webp",
|
||||
yearProgram
|
||||
}`;
|
||||
|
||||
const councilGoofyPicQuery = `*[_type == "homepage"]{
|
||||
"url": councilGoofyPic.asset->url+"?h=1000&fm=webp"
|
||||
"url": councilGoofyPic.asset->url+"?h=1200&fm=webp"
|
||||
}[0]`;
|
||||
|
||||
export const load = async () => {
|
||||
let councilMembers: CouncilMember[] = await getFromCMS(councilQuery);
|
||||
return {
|
||||
members: await getFromCMS(query),
|
||||
councilGoofyPic: await getFromCMS(councilGoofyPicQuery),
|
||||
members: councilMembers,
|
||||
councilGoofyPic: await getFromCMS(councilGoofyPicQuery)
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user