-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
56 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"label": "الدوال", | ||
"order": 8 | ||
"order": 9 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { Course, CourseGroup } from "../../utils/types.ts"; | ||
import { getCourse } from "../../utils/course.ts"; | ||
import { Handlers } from "$fresh/server.ts"; | ||
import { PageProps } from "$fresh/server.ts"; | ||
import { CSS, render } from "$gfm"; | ||
import { Head } from "$fresh/runtime.ts"; | ||
import { cache, populateCache } from "../../utils/course-cache.ts"; | ||
import CourseCard from "../../components/CourseCard.tsx"; | ||
|
||
import IconChevronDown from "https://deno.land/x/[email protected]/tsx/chevron-down.tsx"; | ||
|
||
populateCache(); | ||
|
||
// TODO - FIX TYPES | ||
export const handler: Handlers<CourseGroup> = { | ||
GET(_req, ctx) { | ||
const foundCourseGroup = cache.merged.find((c) => { | ||
return "courses" in c && c.courses.length > 0 && | ||
c.order === parseInt(ctx.params.slug, 10); | ||
}); | ||
if (!foundCourseGroup) return ctx.renderNotFound(); | ||
return ctx.render(foundCourseGroup as CourseGroup); | ||
}, | ||
}; | ||
|
||
export default function CoursePage(props: PageProps<CourseGroup>) { | ||
const foundCourseGroup = props.data; | ||
|
||
return ( | ||
<main class="max-w-screen-md px-4 pt-12 mx-auto mb-6"> | ||
<div class="flex gap-1 items-center"> | ||
<h2 class="text-3xl font-bold"> | ||
{foundCourseGroup.label} | ||
</h2> | ||
<IconChevronDown /> | ||
</div> | ||
<div class="flex flex-col mt-2 pr-3"> | ||
{foundCourseGroup.courses.map((innerCourse) => ( | ||
<CourseCard key={innerCourse.slug} course={innerCourse} /> | ||
))} | ||
</div> | ||
</main> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
import { Handlers } from "$fresh/server.ts"; | ||
import { Head } from "$fresh/runtime.ts"; | ||
import { PageProps } from "$fresh/server.ts"; | ||
|
||
import CourseCard from "../components/CourseCard.tsx"; | ||
import { getCourses } from "../utils/course.ts"; | ||
import { Course, CourseGroup } from "../utils/types.ts"; | ||
import { cache, populateCache } from "../utils/course-cache.ts"; | ||
import Footer from "../components/Footer.tsx"; | ||
|
||
import IconChevronDown from "https://deno.land/x/[email protected]/tsx/chevron-down.tsx"; | ||
|
||
populateCache(); | ||
|
||
export const handler: Handlers<{ merged: (Course | CourseGroup)[] }> = { | ||
|
@@ -46,9 +47,12 @@ export default function BlogIndexPage( | |
if ("courses" in course) { | ||
return ( | ||
<div class="" key={index}> | ||
<h2 class="text-3xl font-bold"> | ||
{course.label} | ||
</h2> | ||
<div class="flex gap-1 items-center"> | ||
<h2 class="text-3xl font-bold hover:opacity-75"> | ||
<a href={`/group/${course.order}`}>{course.label}</a> | ||
</h2> | ||
<IconChevronDown /> | ||
</div> | ||
<div class="flex flex-col mt-2 pr-3"> | ||
{course.courses.map((innerCourse) => ( | ||
<CourseCard key={innerCourse.slug} course={innerCourse} /> | ||
|