Skip to content

Commit

Permalink
updating
Browse files Browse the repository at this point in the history
  • Loading branch information
TeaByte committed Jan 18, 2024
1 parent 0a025d3 commit 5d527df
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
8 changes: 3 additions & 5 deletions islands/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default function Editor(props: EditorProps) {
// } else {
// courseSlug = props.slug;
// }
courseSlug = props.slug
courseSlug = props.slug;
const res = await fetch("/api/test/finsh", {
method: "POST",
headers: {
Expand Down Expand Up @@ -143,10 +143,8 @@ export default function Editor(props: EditorProps) {
<div class="flex flex-col gap-2 grow overflow-hidden mt-2 mx-2">
<div dir="rtl" class="flex gap-2">
<button
class={"btn btn-info grow border-0 " +
(isError
? "bg-error hover:bg-[#ff6868]"
: "bg-[#5bbcd1] hover:opacity-80")}
class={"btn btn-info hover:bg-[#5bbcd1] grow border-0 " +
(isError ? "bg-error hover:bg-[#ff6868]" : "hover:opacity-80")}
onClick={handleCodeRun}
>
تشغيل
Expand Down
10 changes: 9 additions & 1 deletion utils/course.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,15 @@ export async function getCourses(
}

export function getNumberOfCourses(courses: (Course | CourseGroup)[]) {
return CoursesCount;
const slugs = courses.map((c) => {
if ("courses" in c) {
c.courses.sort((a, b) => a.order - b.order);
return c.courses.map((c) => c.slug.replace("\\", "/"));
}
return c.slug.replace("\\", "/");
});
const FlatSlugs = slugs.flat();
return FlatSlugs.length;
}

export async function findNextCourse(slug: string) {
Expand Down

0 comments on commit 5d527df

Please sign in to comment.