Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Aaron Powell
2026-02-26 16:33:14 +11:00
committed by GitHub
parent 0637cad186
commit d73c0bb1f3
7 changed files with 37 additions and 14 deletions

View File

@@ -6,13 +6,23 @@ import { fundamentalsOrder, referenceOrder } from '../../config/learning-hub';
const base = import.meta.env.BASE_URL;
const articles = await getCollection('learning-hub');
const fundamentalsOrderIndex = {};
fundamentalsOrder.forEach((id, index) => {
fundamentalsOrderIndex[id] = index;
});
const referenceOrderIndex = {};
referenceOrder.forEach((id, index) => {
referenceOrderIndex[id] = index;
});
const fundamentals = articles
.filter((a) => fundamentalsOrder.includes(a.id))
.sort((a, b) => fundamentalsOrder.indexOf(a.id) - fundamentalsOrder.indexOf(b.id));
.sort((a, b) => fundamentalsOrderIndex[a.id] - fundamentalsOrderIndex[b.id]);
const reference = articles
.filter((a) => referenceOrder.includes(a.id))
.sort((a, b) => referenceOrder.indexOf(a.id) - referenceOrder.indexOf(b.id));
.sort((a, b) => referenceOrderIndex[a.id] - referenceOrderIndex[b.id]);
---
<BaseLayout title="Learning Hub" description="Curated articles and walkthroughs to help you unlock everything you can do with GitHub Copilot" activeNav="learning-hub">