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)
|
payment: string; // event payment link (e.g., Zeffy)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type FAQ = {
|
||||||
|
question: string;
|
||||||
|
answer: string;
|
||||||
|
}
|
||||||
|
|
||||||
import type { InputValue } from '@portabletext/svelte';
|
import type { InputValue } from '@portabletext/svelte';
|
||||||
|
|
||||||
export type HomepageCMSResponse = {
|
export type HomepageCMSResponse = {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import type { HomepageCMSResponse, OhCMSResponse } from '$lib/schemas';
|
|||||||
|
|
||||||
const homepageQuery = `*[_type == "homepage"]{
|
const homepageQuery = `*[_type == "homepage"]{
|
||||||
"description": description[],
|
"description": description[],
|
||||||
"councilPhoto": councilPhoto.asset->url,
|
"councilPhoto": councilPhoto.asset->url+"?h=1200&fm=webp",
|
||||||
"faqs": faqs[]{ question, answer },
|
"faqs": faqs[]{ question, answer },
|
||||||
}[0]`;
|
}[0]`;
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +1,26 @@
|
|||||||
|
import type { CouncilMember } from '$lib/schemas';
|
||||||
import { getFromCMS } from '$lib/utils.js';
|
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,
|
name,
|
||||||
email,
|
email,
|
||||||
position,
|
position,
|
||||||
positionDescription,
|
positionDescription,
|
||||||
"image": image.asset->url,
|
"image": image.asset->url+"?h=200&fm=webp",
|
||||||
yearProgram
|
yearProgram
|
||||||
}`;
|
}`;
|
||||||
|
|
||||||
const councilGoofyPicQuery = `*[_type == "homepage"]{
|
const councilGoofyPicQuery = `*[_type == "homepage"]{
|
||||||
"url": councilGoofyPic.asset->url+"?h=1000&fm=webp"
|
"url": councilGoofyPic.asset->url+"?h=1200&fm=webp"
|
||||||
}[0]`;
|
}[0]`;
|
||||||
|
|
||||||
export const load = async () => {
|
export const load = async () => {
|
||||||
|
let councilMembers: CouncilMember[] = await getFromCMS(councilQuery);
|
||||||
return {
|
return {
|
||||||
members: await getFromCMS(query),
|
members: councilMembers,
|
||||||
councilGoofyPic: await getFromCMS(councilGoofyPicQuery),
|
councilGoofyPic: await getFromCMS(councilGoofyPicQuery)
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user