diff --git a/routes/[...slug].tsx b/routes/[...slug].tsx
index 529669d..0ef53f7 100644
--- a/routes/[...slug].tsx
+++ b/routes/[...slug].tsx
@@ -64,7 +64,7 @@ export default function CoursePage(
-
+
diff --git a/static/moaco.js b/static/monaco.js
similarity index 100%
rename from static/moaco.js
rename to static/monaco.js
index 416b1cb..0f26129 100644
--- a/static/moaco.js
+++ b/static/monaco.js
@@ -5,7 +5,6 @@ require.config({
});
require(["vs/editor/editor.main"], () => {
- document.getElementById("editor-loading").style.display = "none";
const isNord = localStorage.getItem("selectedTheme") === "nord";
const vsTheme = isNord ? "vs-light" : "vs-dark";
window.editor = monaco.editor.create(document.getElementById("editor"), {
@@ -16,4 +15,5 @@ require(["vs/editor/editor.main"], () => {
setInterval(() => {
editor.layout();
}, 10);
+ document.getElementById("editor-loading").style.display = "none";
});
diff --git a/utils/course.ts b/utils/course.ts
index 14a7067..fb457f3 100644
--- a/utils/course.ts
+++ b/utils/course.ts
@@ -4,6 +4,8 @@ import { extract } from "https://deno.land/std@0.151.0/encoding/front_matter.ts"
import { Course, CourseAttributes, CourseGroup } from "../utils/types.ts";
+export let CoursesCount = 0;
+
export async function getGroupJsonData(
groupPath: string,
): Promise<{ order: number; label: string; lableSlug: string } | undefined> {
@@ -66,6 +68,7 @@ export async function getCourses(
const slug = groupFile.name.replace(".md", "");
const coursePromise = getCourse(join(groupSlug, slug));
groupPromises.push(coursePromise);
+ CoursesCount++;
}
}
@@ -86,6 +89,7 @@ export async function getCourses(
} else if (file.name.endsWith(".md")) {
const slug = file.name.replace(".md", "");
nonGroupPromises.push(getCourse(slug));
+ CoursesCount++;
}
}
@@ -105,13 +109,5 @@ export async function getCourses(
}
export function getNumberOfCourses(courses: (Course | CourseGroup)[]) {
- let count = 0;
- for (const course of courses) {
- if ("courses" in course) {
- count += course.courses.length;
- } else {
- count++;
- }
- }
- return count;
-}
\ No newline at end of file
+ return CoursesCount;
+}