From 6f747f72a364cd57443e681669449592a3751ba0 Mon Sep 17 00:00:00 2001 From: Dymon18 Date: Tue, 24 Jun 2025 15:32:32 +0800 Subject: [PATCH 1/4] add placeholder Lectures page and link it to sidebar [#41] --- src/components/Sidebar/Sidebar.astro | 2 +- src/pages/lectures.astro | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 src/pages/lectures.astro diff --git a/src/components/Sidebar/Sidebar.astro b/src/components/Sidebar/Sidebar.astro index 9091a9c4..c7707654 100644 --- a/src/components/Sidebar/Sidebar.astro +++ b/src/components/Sidebar/Sidebar.astro @@ -28,7 +28,7 @@ const sections = [ icon: "mdi mdi-video", title: "Lectures", disabled: false, - link: "https://www.youtube.com/playlist?list=PLY7TEz3ZRQHTnY56q2uJtdXg-bl-c0sDk", + link: "/lectures", }, { icon: "mdi mdi-creation", title: "Sandbox", disabled: true }, // { icon: "mdi mdi-beaker", title: "Experiments", disabled: true }, diff --git a/src/pages/lectures.astro b/src/pages/lectures.astro new file mode 100644 index 00000000..96eebd3c --- /dev/null +++ b/src/pages/lectures.astro @@ -0,0 +1,13 @@ +--- +import Back from "@components/Back/Back.astro"; +import { default as Layout } from "src/layouts/Content/Content.astro"; +--- + + +
+ +
+ +

📚 Lectures

+

This is a placeholder page for archived lectures. YAML integration coming soon.

+
From 0b0064881128823aa25700471e852749acc127f7 Mon Sep 17 00:00:00 2001 From: Dymon18 Date: Tue, 24 Jun 2025 16:08:15 +0800 Subject: [PATCH 2/4] feat: load lectures from src/data/lectures.yml and style page like other sections [#41] --- package-lock.json | 2 ++ package.json | 1 + src/components/Sidebar/Sidebar.astro | 1 + src/data/lectures.yml | 7 ++++ src/pages/lectures.astro | 50 ++++++++++++++++++++++++++-- 5 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 src/data/lectures.yml diff --git a/package-lock.json b/package-lock.json index a3642697..6a677547 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,6 +14,7 @@ "astro": "^4.11.1", "axios": "^1.7.7", "fs": "^0.0.1-security", + "js-yaml": "^4.1.0", "katex": "^0.16.10", "mathjax": "^3.2.2", "mathjax-full": "^3.2.2", @@ -7424,6 +7425,7 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "license": "MIT", "dependencies": { "argparse": "^2.0.1" }, diff --git a/package.json b/package.json index 6922cfb9..70be73e0 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "astro": "^4.11.1", "axios": "^1.7.7", "fs": "^0.0.1-security", + "js-yaml": "^4.1.0", "katex": "^0.16.10", "mathjax": "^3.2.2", "mathjax-full": "^3.2.2", diff --git a/src/components/Sidebar/Sidebar.astro b/src/components/Sidebar/Sidebar.astro index c7707654..a89b8dca 100644 --- a/src/components/Sidebar/Sidebar.astro +++ b/src/components/Sidebar/Sidebar.astro @@ -28,6 +28,7 @@ const sections = [ icon: "mdi mdi-video", title: "Lectures", disabled: false, + // link: "https://www.youtube.com/playlist?list=PLY7TEz3ZRQHTnY56q2uJtdXg-bl-c0sDk", link: "/lectures", }, { icon: "mdi mdi-creation", title: "Sandbox", disabled: true }, diff --git a/src/data/lectures.yml b/src/data/lectures.yml new file mode 100644 index 00000000..ced9f2f6 --- /dev/null +++ b/src/data/lectures.yml @@ -0,0 +1,7 @@ +- course: COMP 2804 + title: Fall 2020 Lecture + link: https://www.youtube.com/playlist?list=PLY7TEz3ZRQHTnY56q2uJtdXg-bl-c0sDk + +- course: COMP 2804 + title: KPOP Demon Hunters Playlist + link: https://www.youtube.com/playlist?list=PLxA687tYuMWhg-QcZRiO2eCzkQNN1rEBI diff --git a/src/pages/lectures.astro b/src/pages/lectures.astro index 96eebd3c..271ece82 100644 --- a/src/pages/lectures.astro +++ b/src/pages/lectures.astro @@ -1,13 +1,59 @@ --- import Back from "@components/Back/Back.astro"; import { default as Layout } from "src/layouts/Content/Content.astro"; +import RowCard from "@components/RowCard/RowCard.astro"; +import fs from "fs"; +import path from "path"; +import yaml from "js-yaml"; + +const filePath = path.resolve("src/data/lectures.yml"); +const file = fs.readFileSync(filePath, "utf8"); +const lectures = yaml.load(file); + +const grouped = {}; +for (const lec of lectures) { + if (!grouped[lec.course]) grouped[lec.course] = []; + grouped[lec.course].push(lec); +} ---
- +

📚 Lectures

-

This is a placeholder page for archived lectures. YAML integration coming soon.

+

Playlists of recorded lecture videos categorized by course.

+ +
+ + { + Object.entries(grouped).map(([course, list]) => ( + <> +

{course}

+
+ { + list.map((lec) => ( + + + + )) + } +
+
+ + )) + }
+ + From 3be59911a47a58121ffd5ab752700d59fd19dd5c Mon Sep 17 00:00:00 2001 From: Dymon18 Date: Tue, 24 Jun 2025 16:19:39 +0800 Subject: [PATCH 3/4] style: fix formatting in lectures.astro to pass Prettier check [#41] --- src/pages/lectures.astro | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/pages/lectures.astro b/src/pages/lectures.astro index 271ece82..8edda97a 100644 --- a/src/pages/lectures.astro +++ b/src/pages/lectures.astro @@ -32,15 +32,13 @@ for (const lec of lectures) { <>

{course}

- { - list.map((lec) => ( - - - - )) - } + {list.map((lec) => ( + + + + ))}
-
+
)) } From 8d644bfe4a10e377fd842fce89accd7699608b6a Mon Sep 17 00:00:00 2001 From: Dymon18 Date: Mon, 30 Jun 2025 11:15:53 +0800 Subject: [PATCH 4/4] Remove placeholder content from lectures.yml as per feedback --- src/data/lectures.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/data/lectures.yml b/src/data/lectures.yml index ced9f2f6..f785a7db 100644 --- a/src/data/lectures.yml +++ b/src/data/lectures.yml @@ -1,7 +1,3 @@ - course: COMP 2804 title: Fall 2020 Lecture link: https://www.youtube.com/playlist?list=PLY7TEz3ZRQHTnY56q2uJtdXg-bl-c0sDk - -- course: COMP 2804 - title: KPOP Demon Hunters Playlist - link: https://www.youtube.com/playlist?list=PLxA687tYuMWhg-QcZRiO2eCzkQNN1rEBI