Skip to content

Commit

Permalink
Improve some things
Browse files Browse the repository at this point in the history
  • Loading branch information
TeaByte committed Jan 18, 2024
1 parent a52a454 commit da2fa6d
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 57 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ help you achieve your learning goals.
- [ ] Blogs page
- [x] Quizes system
- [ ] Improve phone users experience
- [ ] Next and prev lesson buttons (maybe?)
- [x] Next and prev lesson buttons

---

Expand Down
2 changes: 1 addition & 1 deletion components/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default function Footer() {
title: "المجتمع",
children: [
{ name: "قناه التلغرام", href: "https://t.me/NakhlahJS" },
{ name: "المجتمع", href: "https://t.me/Unassisted" },
{ name: "المجتمع", href: "https://t.me/NakhlahChat" },
],
},
];
Expand Down
88 changes: 45 additions & 43 deletions components/MarkdownSplit.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { render } from "https://deno.land/x/gfm/mod.ts";
import { Course } from "../utils/types.ts";
import IconPlayerTrackNext from "https://deno.land/x/[email protected]/tsx/player-track-next.tsx"
import IconPlayerTrackPrev from "https://deno.land/x/[email protected]/tsx/player-track-prev.tsx"
import IconPlayerTrackNext from "https://deno.land/x/[email protected]/tsx/player-track-next.tsx";
import IconPlayerTrackPrev from "https://deno.land/x/[email protected]/tsx/player-track-prev.tsx";
import EditButton from "../components/EditButton.tsx";

export default function MarkdownSplit({
Expand All @@ -18,63 +18,65 @@ export default function MarkdownSplit({
prevCourse: string | undefined;
}) {
return (
<section dir="rtl" class="p-3 py-5 mb-40">
<div>
<div className="flex flex-col-reverse">
<div class="flex flex-col-reverse text-sm breadcrumbs" dir="rtl">
<ul>
<li>
<a href="/">الرئيسية</a>
</li>
{lable && (
<li>
<a href={`/group/${lableSlug}`}>{lable}</a>
</li>
)}
<li class="underline">{course.title}</li>
</ul>
</div>
</div>
<div class="flex flex-col gap-2 md:flex-row justify-between mb-4">
<h1 class="text-3xl">{course.title}</h1>
<EditButton slug={course.slug} />
</div>
</div>

<div
id="document"
class="markdown-body"
style={{ backgroundColor: "inherit" }}
dangerouslySetInnerHTML={{
__html: render(course.content, {
disableHtmlSanitization: true,
}),
}}
/>
<div class="flex justify-between mt-4">
<div>
<>
<div class="flex px-2 pt-2 gap-2">
<div class="grow overflow-hidden">
{prevCourse && (
<a
href={`/${prevCourse}`}
class="flex flex-row items-center gap-2 btn btn-outline"
class="flex items-center gap-2 btn btn-outline flex-nowrap"
>
<IconPlayerTrackNext size={18} />
<span>الدرس السابق</span>
</a>
)}
</div>
<div>
<div class="grow overflow-hidden">
{nextCourse && (
<a
href={`/${nextCourse}`}
class="flex flex-row items-center gap-2 btn btn-outline"
href={`/${nextCourse}`}
class="flex items-center gap-2 btn btn-outline flex-nowrap"
>
<span>الدرس التالي</span>
<IconPlayerTrackPrev size={18} />
<IconPlayerTrackPrev size={18} />
</a>
)}
</div>
</div>
</section>
<section dir="rtl" class="p-3 py-5 mb-24 md:mb-0">
<div>
<div className="flex flex-col-reverse">
<div class="flex flex-col-reverse text-sm breadcrumbs" dir="rtl">
<ul>
<li>
<a href="/">الرئيسية</a>
</li>
{lable && (
<li>
<a href={`/group/${lableSlug}`}>{lable}</a>
</li>
)}
<li class="underline">{course.title}</li>
</ul>
</div>
</div>
<div class="flex flex-col gap-2 md:flex-row justify-between mb-4">
<h1 class="text-3xl">{course.title}</h1>
<EditButton slug={course.slug} />
</div>
</div>

<div
id="document"
class="markdown-body"
style={{ backgroundColor: "inherit" }}
dangerouslySetInnerHTML={{
__html: render(course.content, {
disableHtmlSanitization: true,
}),
}}
/>
</section>
</>
);
}
2 changes: 1 addition & 1 deletion components/ProgressBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default function ProgressBar(props: { progress: number }) {
<div className="bg-base-100 rounded-box shadow-sm overflow-hidden p-1">
<div className="relative h-6 flex items-center justify-center">
<div
className="absolute top-0 bottom-0 right-0 rounded-box bg-info"
className="absolute top-0 bottom-0 right-0 rounded-box bg-[#5bbcd1]"
style={widthStyle}
>
<div className="relative text-black font-medium text-sm text-center">
Expand Down
10 changes: 5 additions & 5 deletions components/ProgressPageSplit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ export default function ProgressPageSplit(
props: { completed: number; total: number; className?: string },
) {
return (
<div class={"flex-col" + props?.className}>
<h2 className="text-xl font-bold py-2">تقدمك في إنجاز الدروس:</h2>
<ProgressBar
progress={Math.floor((props.completed / props.total) * 100)}
/>
<div class={"flex-col py-2 " + props?.className}>
<h2 className="text-xl font-bold pb-2">تقدمك في إنجاز الدروس</h2>
<ProgressBar
progress={Math.floor((props.completed / props.total) * 100)}
/>
</div>
);
}
4 changes: 2 additions & 2 deletions courses/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ order: 1
تجاربهم معك. هذا التفاعل يمكن أن يجعل عملية التعلم أكثر سهولة ومتعة.

<div class="quiz">
لتخطي هذا الدرس إضغط على زر إختبار
لتخطي هذا الدرس إضغط على زر إختبار
</div>
<!-- <mark>recommended</mark> -->

أنضم الان! [قناه التلغرام](https://t.me/NakhlahJS),
[جروب التلغرام](https://t.me/Unassisted)
[جروب التلغرام](https://t.me/NakhlahChat)
12 changes: 10 additions & 2 deletions islands/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,14 @@ export default function Editor(props: EditorProps) {
if (code) {
eval(code);
}

setIsError(false);
setOutput(capturedOutput.join("\n"));
if (capturedOutput.length > 0) {
setOutput(capturedOutput.join("\n"));
} else {
setOutput("لا يوجد اي شيء يتم طباعته");
}

console.log = originalConsoleLog;
return capturedOutput.join("\n");
} catch (error) {
Expand All @@ -144,7 +150,9 @@ export default function Editor(props: EditorProps) {
<div dir="rtl" class="flex gap-2">
<button
class={"btn btn-info hover:bg-[#5bbcd1] grow border-0 " +
(isError ? "bg-error hover:bg-[#ff6868]" : "hover:opacity-80")}
(isError
? "bg-error hover:bg-[#ff6868]"
: "bg-[#5bbcd1] hover:opacity-80")}
onClick={handleCodeRun}
>
تشغيل
Expand Down
10 changes: 8 additions & 2 deletions routes/[...slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import IconAppWindow from "https://deno.land/x/[email protected]/tsx/app-wi
import { findNextCourse } from "../utils/course.ts";
import { findPrevCourse } from "../utils/course.ts";

interface Props {
interface Props {
course: Course;
lable: string | undefined;
lableSlug: string | undefined;
Expand All @@ -33,7 +33,13 @@ export const handler: Handlers<Props> = {
const [lableSlug, lable] = await getJson(ctx.params.slug.split("/")[0]);
return ctx.render({ course, lable, lableSlug, nextCourse, prevCourse });
}
return ctx.render({ course, lable: undefined, lableSlug: undefined, nextCourse, prevCourse });
return ctx.render({
course,
lable: undefined,
lableSlug: undefined,
nextCourse,
prevCourse,
});
} catch {
return ctx.renderNotFound();
}
Expand Down

0 comments on commit da2fa6d

Please sign in to comment.