Added lastUpdated field for OH

This commit is contained in:
Karen Chen
2026-02-09 01:10:20 -05:00
parent 9b93464726
commit 3f93d98ea9
3 changed files with 14 additions and 9 deletions

View File

@@ -3,7 +3,10 @@
import Link from 'components/Link.svelte';
import Button from 'components/Button.svelte';
let { sponsors } = $props<{ sponsors: Sponsors[] }>();
let { sponsors, lastUpdated } = $props<{
sponsors: Sponsors[];
lastUpdated?: string | null;
}>();
</script>
<div class="container mx-auto px-4">
@@ -17,7 +20,7 @@
and our community.
</p>
<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"
></div>
<div class="mt-6">

View File

@@ -15,12 +15,13 @@ const homepageQuery = `{
"position": member->position
}
},
"_ohLastUpdated": *[_type=="officeHours"] | order(_updatedAt desc)[0]._updatedAt,
"sponsors": *[_type=="sponsors"]{
name,
url,
"logo": logo.asset->url+"?h=100&fm=webp"
},
"_lastUpdated": *[_type=="officeHours"] | order(_updatedAt desc)[0]._updatedAt
"_sponsorsLastUpdated": *[_type=="sponsors"] | order(_updatedAt desc)[0]._updatedAt
}`;
export const load = async ({ url }) => {
@@ -38,6 +39,7 @@ export const load = async ({ url }) => {
allOHs: officeHourResp,
sponsors: sponsorsResp,
canonical: url.href,
ohLastUpdated: homePageResp._lastUpdated ?? null
ohLastUpdated: homePageResp._ohLastUpdated ?? null,
sponsorsLastUpdated: homePageResp._sponsorsLastUpdated ?? null
};
};

View File

@@ -69,14 +69,14 @@
<Section from="from-ecsess-900" to="to-ecsess-700" via="via-ecsess-650">
<div class="w-full">
<h2 class="text-2xl font-bold" id="office-hours">Lounge Office Hours</h2>
<p class="text-ecsess-200 mb-4">
<p class="text-ecsess-200">
Come visit us in our student lounge at ENGTR 1060 to grab a coffee (free), play Mario Kart, or
just chat about anything!
</p>
{#if data.ohLastUpdated}
<p class="text-ecsess-200/70 mb-0.5 text-sm italic">
Last updated: {new Date(data.ohLastUpdated).toLocaleString()}
</p>
<span class="text-ecsess-200/70 mb-4 inline-block italic">
Last updated: {new Date(data.ohLastUpdated).toISOString().slice(0, 10).replaceAll('-', '/')}
</span>
{/if}
<OhSchedule allOhs={data.allOHs} />
</div>
@@ -84,7 +84,7 @@
<!-- Sponsors -->
<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>
<!-- Affiliated Clubs -->