Schemas update + Image optimization

Resolves: https://github.com/mcgill-ecsess/ECSESS/issues/20
This commit is contained in:
Antoine Phan
2025-07-19 16:36:00 -04:00
parent d8ead1038b
commit 50c07509d9
3 changed files with 16 additions and 6 deletions

View File

@@ -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]`;

View File

@@ -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)
};
};