Added last updated time for OH (#100)
* Added last updated time for OH * Added lastUpdated field for OH * Added formatting date function for last updated
This commit is contained in:
@@ -3,7 +3,10 @@
|
|||||||
import Link from 'components/Link.svelte';
|
import Link from 'components/Link.svelte';
|
||||||
import Button from 'components/Button.svelte';
|
import Button from 'components/Button.svelte';
|
||||||
|
|
||||||
let { sponsors } = $props<{ sponsors: Sponsors[] }>();
|
let { sponsors, lastUpdated } = $props<{
|
||||||
|
sponsors: Sponsors[];
|
||||||
|
lastUpdated?: string | null;
|
||||||
|
}>();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="container mx-auto px-4">
|
<div class="container mx-auto px-4">
|
||||||
@@ -17,7 +20,7 @@
|
|||||||
and our community.
|
and our community.
|
||||||
</p>
|
</p>
|
||||||
<div
|
<div
|
||||||
class="via-ecsess-150/40 mx-auto mt-6 h-px w-32 bg-linear-to-r from-transparent to-transparent"
|
class="via-ecsess-150/40 mx-auto mt-2 h-px w-32 bg-linear-to-r from-transparent to-transparent"
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
></div>
|
></div>
|
||||||
<div class="mt-6">
|
<div class="mt-6">
|
||||||
|
|||||||
@@ -15,13 +15,19 @@ const homepageQuery = `{
|
|||||||
"position": member->position
|
"position": member->position
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"ohLastUpdated": *[_type=="officeHours"] | order(_updatedAt desc)[0]._updatedAt,
|
||||||
"sponsors": *[_type=="sponsors"]{
|
"sponsors": *[_type=="sponsors"]{
|
||||||
name,
|
name,
|
||||||
url,
|
url,
|
||||||
"logo": logo.asset->url+"?h=100&fm=webp"
|
"logo": logo.asset->url+"?h=100&fm=webp"
|
||||||
}
|
},
|
||||||
|
"sponsorsLastUpdated": *[_type=="sponsors"] | order(_updatedAt desc)[0]._updatedAt
|
||||||
}`;
|
}`;
|
||||||
|
|
||||||
|
function formattingDate(date: Date) {
|
||||||
|
return date.toISOString().slice(0, 10).replaceAll('-', '/');
|
||||||
|
}
|
||||||
|
|
||||||
export const load = async ({ url }) => {
|
export const load = async ({ url }) => {
|
||||||
/**
|
/**
|
||||||
* @description Response data type based on the combined query above.
|
* @description Response data type based on the combined query above.
|
||||||
@@ -36,6 +42,8 @@ export const load = async ({ url }) => {
|
|||||||
councilPhoto: councilPhotoUrl,
|
councilPhoto: councilPhotoUrl,
|
||||||
allOHs: officeHourResp,
|
allOHs: officeHourResp,
|
||||||
sponsors: sponsorsResp,
|
sponsors: sponsorsResp,
|
||||||
canonical: url.href
|
canonical: url.href,
|
||||||
|
ohLastUpdated: formattingDate(new Date(homePageResp.ohLastUpdated)),
|
||||||
|
sponsorsLastUpdated: formattingDate(new Date(homePageResp.sponsorsLastUpdated))
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -69,9 +69,15 @@
|
|||||||
<Section from="from-ecsess-900" to="to-ecsess-700" via="via-ecsess-650">
|
<Section from="from-ecsess-900" to="to-ecsess-700" via="via-ecsess-650">
|
||||||
<div class="w-full">
|
<div class="w-full">
|
||||||
<h2 class="text-2xl font-bold" id="office-hours">Lounge Office Hours</h2>
|
<h2 class="text-2xl font-bold" id="office-hours">Lounge Office Hours</h2>
|
||||||
<p class="text-ecsess-200 mb-8">
|
<p class="text-ecsess-200">
|
||||||
Come visit us in our student lounge at ENGTR 1060 to grab a coffee (free), play Mario Kart, or
|
Come visit us in our student lounge at ENGTR 1060 to grab a coffee (free), play Mario Kart, or
|
||||||
just chat about anything!
|
just chat about anything!
|
||||||
|
{#if data.ohLastUpdated}
|
||||||
|
<br />
|
||||||
|
<span class="text-ecsess-200/70 mb-4 inline-block italic">
|
||||||
|
Last updated: {data.ohLastUpdated}
|
||||||
|
</span>
|
||||||
|
{/if}
|
||||||
</p>
|
</p>
|
||||||
<OhSchedule allOhs={data.allOHs} />
|
<OhSchedule allOhs={data.allOHs} />
|
||||||
</div>
|
</div>
|
||||||
@@ -79,7 +85,7 @@
|
|||||||
|
|
||||||
<!-- Sponsors -->
|
<!-- Sponsors -->
|
||||||
<Section from="from-ecsess-700" to="to-ecsess-800" via="via-ecsess-750">
|
<Section from="from-ecsess-700" to="to-ecsess-800" via="via-ecsess-750">
|
||||||
<Sponsors sponsors={data.sponsors} />
|
<Sponsors sponsors={data.sponsors} lastUpdated={data.sponsorsLastUpdated} />
|
||||||
</Section>
|
</Section>
|
||||||
|
|
||||||
<!-- Affiliated Clubs -->
|
<!-- Affiliated Clubs -->
|
||||||
|
|||||||
Reference in New Issue
Block a user