Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions .vitepress/components/SolutionHider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import { onMounted } from 'vue'
import { useRoute } from 'vitepress'

const FIRST_LAB = new Date('2025-02-18T11:00:00+01:00').getTime();
// time when last lab in the first week ends
const SHOW_FIRST_SOLS = new Date('2025-02-20T18:00:00+01:00').getTime();

const route = useRoute()

Expand All @@ -13,15 +14,15 @@
for (const details of detailsElements) {
const summary = details.querySelector('summary');
const summaryContent = summary ? summary.outerHTML : '';
details.innerHTML = `${summaryContent} Solutions will be revealed at ${reveal_date}.`;
details.innerHTML = `${summaryContent} Solutions will be revealed after labs on ${reveal_date}.`;
}
}
function handlePageChange() {
const now = new Date(Date.now()).getTime();
const page_week_no = parseInt(route.path.match(/\d+/)[0]) - 1;
const millis_in_day = 24 * 60 * 60 * 1000;
const reveal_at = FIRST_LAB + (3 + 7 * page_week_no) * millis_in_day;
const days_left = Math.floor((reveal_at - now) / millis_in_day);
const reveal_at = SHOW_FIRST_SOLS + 7 * page_week_no * millis_in_day;
const days_left = (reveal_at - now) / millis_in_day;
const should_reveal = days_left <= 0;

if (!should_reveal) {
Expand All @@ -31,4 +32,4 @@
</script>

<template>
</template>
</template>