diff --git a/.github/fetch_includes.sh b/.github/fetch_includes.sh index 47be8e78d..4ed3fc9ad 100644 --- a/.github/fetch_includes.sh +++ b/.github/fetch_includes.sh @@ -5,7 +5,7 @@ MODULES_UPDATE_URL="https://raw.githubusercontent.com/nesi/modules-list/main/rss GLOSSARY_URL="https://raw.githubusercontent.com/nesi/nesi-wordlist/main/outputs/glossary.md" DICTIONARY_URL="https://raw.githubusercontent.com/nesi/nesi-wordlist/main/outputs/dictionary.txt" SNIPPETS_URL="https://raw.githubusercontent.com/nesi/nesi-wordlist/main/outputs/snippets.md" -ICAL_URL="https://calendar.google.com/calendar/ical/c_hen6rr02et39kat2hmuamidots@group.calendar.google.com/public/basic.ics" +ICAL_URL="https://outlook.office365.com/owa/calendar/3d4e3c7b28ca4549803470b109cba86a@reannz.co.nz/0830583db389420aaa843dc231af48d810099982634588501079/calendar.ics" mkdir -p docs/assets/glossary @@ -18,3 +18,4 @@ python3 .github/workflows/link_apps_pages.py wget -q -O overrides/partials/glossary.html "${GLOSSARY_URL}" wget -q -O docs/assets/glossary/dictionary.txt "${DICTIONARY_URL}" wget -q -O docs/assets/glossary/snippets.md "${SNIPPETS_URL}" + diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 82271590b..37df036f1 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -173,4 +173,4 @@ jobs: fetch-depth: 0 - run: pip3 install -r requirements.txt - run: ./checks/run_test_build.py - - run: python3 checks/run_aria_check.py + - run: export NO_MKDOCS_2_WARNING="1"; python3 checks/run_aria_check.py diff --git a/.github/workflows/demo_deploy.yml b/.github/workflows/demo_deploy.yml index 4c0a8e344..81fbfc9dd 100644 --- a/.github/workflows/demo_deploy.yml +++ b/.github/workflows/demo_deploy.yml @@ -1,7 +1,7 @@ name: Deploy PR branches on: pull_request: - branches-ignore: "assets-update" + branches-ignore: ["assets-update"] env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} TARGET_REPO: "mkdocs-demo-deploy" @@ -10,6 +10,7 @@ env: DEPLOY_URL: "https://callumwalley.github.io/mkdocs-demo-deploy" HEAD: ${{ github.event.pull_request.head.ref }} GH_REPO: ${{ github.repository }} + NO_MKDOCS_2_WARNING: "1" permissions: write-all jobs: demo-deploy: diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index bebe9d639..5c48f7adb 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -8,6 +8,8 @@ on: env: PYTHON_VERSION: 3.14.2 GH_TOKEN: ${{ github.token }} + NO_MKDOCS_2_WARNING: "1" + permissions: contents: write pull-requests: write diff --git a/.vscode/tasks.json b/.vscode/tasks.json index c725ad437..4a3a0202c 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -82,7 +82,7 @@ "reveal":"never", "showReuseMessage": false }, - "command": "./checks/run_test_build.py", + "command": "export NO_MKDOCS_2_WARNING=1 && ./checks/run_test_build.py", "problemMatcher": { "severity": "info", "pattern": { @@ -163,7 +163,7 @@ "reveal":"never", "showReuseMessage": false }, - "command": "mkdocs serve --dirty" + "command": "export NO_MKDOCS_2_WARNING=1 && mkdocs serve --dirty" }, ] } diff --git a/docs/Getting_Started/Weekly_Online_Office_Hours.md b/docs/Getting_Started/Weekly_Online_Office_Hours.md index 6576c9115..e79194190 100644 --- a/docs/Getting_Started/Weekly_Online_Office_Hours.md +++ b/docs/Getting_Started/Weekly_Online_Office_Hours.md @@ -19,9 +19,11 @@ description: | ## Office Hours Dates -Click on the links below to view the upcoming office hours: - - + +
Loading Calendar...
+Weekly Online Office Hour on today, starting ${d.toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'})}. Drop in for any queries.`, "calendar-banner"); - - } else { - addBanner(`
Weekly Online Office Hour on now. Join Zoom Meeting Now for any queries.
`, "calendar-banner"); + try { + const jcal = ICAL.parse(text); + const comp = new ICAL.Component(jcal); + const vevents = comp.getAllSubcomponents('vevent'); + for (const vevent of vevents) { + const dtstart = vevent.getFirstPropertyValue('dtstart'); + const date = dtstart.toJSDate(); + // if today + if (now.toDateString() == date.toDateString()) { + // if not finished. + if (now.getTime() < date.getTime() + 3600000) { + // if not started + if (now < date) { + addBanner(`Weekly Online Office Hour on today, starting ${date.toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'})}. Drop in for any queries.`, "calendar-banner"); + } else { + addBanner(`
Weekly Online Office Hour on now. Join Zoom Meeting Now for any queries.
`, "calendar-banner"); + } } + break; } - break; } + } catch (error) { + console.warn("ICAL parsing failed", error); } } @@ -81,14 +83,15 @@ function format8601(str){ const dateStringFormatted = str.substring(0, 4) + '-' + str.substring(4, 6) + '-' + - str.substring(6, 8) + - str.substring(8, 9) + + str.substring(6, 8) + 'T' + str.substring(9, 11) + ':' + str.substring(11, 13) + ':' + - str.substring(13, 15) + - str.substring(15, 16); + str.substring(13, 15) + '+12:00'; return new Date(dateStringFormatted); } + +showOfficeBanner(); + // Remove me later // showOfficeBanner().then(() => { // if (!document.getElementById("calendar-banner")){ diff --git a/docs/assets/javascripts/officeHours.js b/docs/assets/javascripts/officeHours.js new file mode 100644 index 000000000..5b6cfee29 --- /dev/null +++ b/docs/assets/javascripts/officeHours.js @@ -0,0 +1,59 @@ +async function displayOfficeHoursCalendar() { + const calendarDiv = document.getElementById('office-hours-calendar'); + const calendarP = document.getElementById('office-hours-calendar-message'); + if (!calendarDiv) return; + + const text = await fetch("/assets/training_calendar.ics") + .then(r => r.ok ? r.text() : ""); + if (!text) { + calendarP.innerHTML = 'Failed to load calendar.'; + return; + } + + try { + const jcal = ICAL.parse(text); + const comp = new ICAL.Component(jcal); + const events = comp.getAllSubcomponents('vevent').map(vevent => { + const summary = vevent.getFirstPropertyValue('summary'); + const dtstart = vevent.getFirstPropertyValue('dtstart'); + const description = (vevent.getFirstPropertyValue('description') || '').replace(/\\n/g, '\n').replace(/\\,/g, ','); + const urlMatch = description.match(/(https?:\/\/[^\s]+)/); + const start = dtstart.toJSDate(); + return { + title: summary, + start, + description, + meetingLink: urlMatch ? urlMatch[1] : MEETING_LINK, + day: start.toLocaleDateString('en-US', { weekday: 'long' }), + date: start.toLocaleDateString('en-US', { month: 'short', day: 'numeric' }), + time: start.toLocaleTimeString('en-US', { hour: '2-digit', minute: '2-digit' }) + }; + }); + + // Sort events by date + events.sort((a, b) => a.start - b.start); + + // Create table + const tableWrap = document.createElement('div'); + tableWrap.className = 'md-typeset__table' + const table = document.createElement('table'); + let rows = ''; + events.forEach(event => { + rows += ` +Error loading Calendar.