From 758e50527b88a36821cc3f04860e37809608f848 Mon Sep 17 00:00:00 2001 From: vzsky Date: Fri, 15 Aug 2025 16:30:25 +0700 Subject: [PATCH 1/8] draft learn page --- src/app/learn/LearnContent.tsx | 83 +++++++++++++++++ src/app/learn/LearnSidebar.tsx | 52 +++++++++++ src/app/learn/constants.ts | 165 +++++++++++++++++++++++++++++++++ src/app/learn/page.tsx | 31 +++++-- 4 files changed, 322 insertions(+), 9 deletions(-) create mode 100644 src/app/learn/LearnContent.tsx create mode 100644 src/app/learn/LearnSidebar.tsx create mode 100644 src/app/learn/constants.ts diff --git a/src/app/learn/LearnContent.tsx b/src/app/learn/LearnContent.tsx new file mode 100644 index 000000000..b4ec49e7d --- /dev/null +++ b/src/app/learn/LearnContent.tsx @@ -0,0 +1,83 @@ +'use client' + +import { useSearchParams } from 'next/navigation' + +import { learnLevels, LearnLevelType } from './constants' + +// const ContentList = ({ level }: { level: LearnLevelType }) => { +// return ( +// <> +//
{level.label}
+// +// ) +// } + +const ContentList = ({ level }: { level: LearnLevelType }) => { + return ( +
+ {/* Left column */} +
+

{level.label}

+
+ + {/* Right column */} +
+
+
+ {level.sections.map(section => { + return ( +
+ {/* Timeline dot */} +
+ + {/* Section header */} +

{section.label}

+ + {/* Section items */} + {true && ( +
    + {section.content.map((item, idx) => ( +
  • + + {idx + 1} {item.label} + +
  • + ))} +
+ )} +
+ ) + })} +
+
+
+ ) +} + +export const LearnContent = () => { + const searchParams = useSearchParams() + const level = searchParams.get('level') + + return ( +
+
+
+
+

+ {learnLevels.map(learnLevel => { + return !level || level == learnLevel.value ? ( + + ) : ( + <> + ) + })} +

+
+
+
+
+ ) +} diff --git a/src/app/learn/LearnSidebar.tsx b/src/app/learn/LearnSidebar.tsx new file mode 100644 index 000000000..bcd5cf511 --- /dev/null +++ b/src/app/learn/LearnSidebar.tsx @@ -0,0 +1,52 @@ +'use client' + +import Link from 'next/link' +import { useSearchParams } from 'next/navigation' + +import clsx from 'clsx' + +import { learnSidebarSelects } from './constants' + +export const LearnSidebar = () => { + const searchParams = useSearchParams() + + const level = searchParams.get('level') + + return ( +
+
+
+ {learnSidebarSelects.map(learnLevelSelect => { + return ( + +

+ {learnLevelSelect.label} +

+ + ) + })} +
+
+
+ ) +} diff --git a/src/app/learn/constants.ts b/src/app/learn/constants.ts new file mode 100644 index 000000000..012180ea9 --- /dev/null +++ b/src/app/learn/constants.ts @@ -0,0 +1,165 @@ +type LearnSectionType = { + label: string + value: string + content: { + label: string + value: string + }[] +} + +export type LearnLevelType = { + label: string + value: string + sections: LearnSectionType[] +} + +export const learnLevels: LearnLevelType[] = [ + { + label: 'เตรียมตัวก่อนเข้าค่าย', + value: 'prePosn', + sections: [ + { + label: 'คณิตศาสตร์', + value: 'math', + content: [ + { + label: 'จำนวน ระบบจำนวน การดำเนินการของจำนวน', + value: 'number-operation' + }, + { + label: 'ความสัมพันธ์ ฟังก์ชัน', + value: 'function-relation' + }, + { + label: 'สมการ และ อสมการ', + value: 'equation-inequality' + }, + { + label: 'เซต และ ตรรกศาสตร์', + value: 'logic-set' + }, + { + label: 'การวัดและเรขาคณิต', + value: 'geometry' + }, + { + label: 'สถิติและความน่าจะเป็น', + value: 'prob-stats' + } + ] + }, + { + label: 'กระบวนการคิด', + value: 'problem-solving', + content: [ + { + label: 'กระบวนการแก้ปัญหาที่มีการใช้ตรรกะ และฟังก์ชัน', + value: 'problem-solving' + } + ] + } + ] + }, + { + label: 'ค่ายสอวน. 1', + value: 'posn', + sections: [ + { + label: 'คณิตศาสตร์', + value: 'math', + content: [ + { + label: 'ทฤษฎีตัวเลข เมทริกซ์', + value: 'matrix' + }, + { + label: 'ลำดับและอนุกรม', + value: 'sequence-series' + }, + { + label: 'เลขฐาน', + value: 'radix' + } + ] + }, + { + label: 'การเขียนโปรแกรม', + value: 'programming', + content: [ + { + label: 'พื้นฐานภาษา C และ C++', + value: 'cpp-basic' + }, + { + label: 'การติดตั้งโปรแกรม', + value: 'installation' + }, + { + label: 'การเขียนโปรแกรมรับข้อมูลเข้าและการแสดงผลข้อมูล', + value: 'io' + }, + { + label: 'ชนิดของข้อมูล', + value: 'datatype' + } + ] + } + ] + }, + { + label: 'ค่ายสอวน. 2 และระดับชาติ', + value: 'toi', + sections: [ + { + label: 'คณิตศาสตร์', + value: 'math', + content: [ + { + label: 'เวกเตอร์และระบบพิกัดคาร์ทีเซียน', + value: 'vector-cartesian' + } + ] + } + ] + }, + { + label: 'สสวท.', + value: 'ipst', + sections: [ + { + label: 'คณิตศาสตร์', + value: 'math', + content: [ + { + label: 'เวกเตอร์และระบบพิกัดคาร์ทีเซียน', + value: 'vector-cartesian' + } + ] + } + ] + }, + { + label: 'IOI', + value: 'ioi', + sections: [ + { + label: 'คณิตศาสตร์', + value: 'math', + content: [ + { + label: 'เวกเตอร์และระบบพิกัดคาร์ทีเซียน', + value: 'vector-cartesian' + } + ] + } + ] + } +] + +export const learnSidebarSelects = [ + { + label: 'Overview', + value: 'overview' + }, + ...learnLevels.map(({ label, value }) => ({ label, value })) +] diff --git a/src/app/learn/page.tsx b/src/app/learn/page.tsx index 1d5ca449f..73d323500 100644 --- a/src/app/learn/page.tsx +++ b/src/app/learn/page.tsx @@ -1,6 +1,9 @@ +import { Suspense } from 'react' + import { Metadata, type NextPage } from 'next' -import Link from 'next/link' +import { LearnContent } from './LearnContent' +import { LearnSidebar } from './LearnSidebar' export const metadata: Metadata = { title: 'Learn | programming.in.th' @@ -8,14 +11,24 @@ export const metadata: Metadata = { const Learn: NextPage = () => { return ( -
-

- Coming Soon... -

- - กลับหน้าหลัก - -
+
+
+
+

+ Learn +

+

+ Learn with programing.in.th +

+
+
+ + + + +
+
+
) } From e75a7ed9923a50ddf3dd6547f22e1c0a789c17fc Mon Sep 17 00:00:00 2001 From: vzsky Date: Sat, 16 Aug 2025 11:31:41 +0700 Subject: [PATCH 2/8] add content pages --- src/app/learn/LearnContent.tsx | 86 ++++++++++++++----------- src/app/learn/constants.ts | 12 ++-- src/app/learn/content/RenderContent.tsx | 15 +++++ src/app/learn/content/page.tsx | 13 ++++ 4 files changed, 83 insertions(+), 43 deletions(-) create mode 100644 src/app/learn/content/RenderContent.tsx create mode 100644 src/app/learn/content/page.tsx diff --git a/src/app/learn/LearnContent.tsx b/src/app/learn/LearnContent.tsx index b4ec49e7d..e6b23cc7c 100644 --- a/src/app/learn/LearnContent.tsx +++ b/src/app/learn/LearnContent.tsx @@ -1,49 +1,65 @@ 'use client' +import Link from 'next/link' import { useSearchParams } from 'next/navigation' -import { learnLevels, LearnLevelType } from './constants' +import { learnLevels, LearnLevelType, LearnContentType } from './constants' -// const ContentList = ({ level }: { level: LearnLevelType }) => { -// return ( -// <> -//
{level.label}
-// -// ) -// } +const ContentItem = ({ + index, + id, + content +}: { + index: number + id: string + content: LearnContentType +}) => { + return ( + <> +
+ + +

+ {index}. {content.label} +

+
+ +
+ + ) +} const ContentList = ({ level }: { level: LearnLevelType }) => { return (
- {/* Left column */} -
-

{level.label}

-
- - {/* Right column */}
-
+

{level.label}

{level.sections.map(section => { return (
- {/* Timeline dot */} -
- {/* Section header */} -

{section.label}

+

{section.label}

{/* Section items */} {true && (
    - {section.content.map((item, idx) => ( + {section.content.map((content, idx) => (
  • - - {idx + 1} {item.label} - +
  • ))}
@@ -63,20 +79,14 @@ export const LearnContent = () => { return (
-
-
-
-

- {learnLevels.map(learnLevel => { - return !level || level == learnLevel.value ? ( - - ) : ( - <> - ) - })} -

-
-
+
+ {learnLevels.map(learnLevel => { + return !level || level == learnLevel.value ? ( + + ) : ( + <> + ) + })}
) diff --git a/src/app/learn/constants.ts b/src/app/learn/constants.ts index 012180ea9..33ba90b92 100644 --- a/src/app/learn/constants.ts +++ b/src/app/learn/constants.ts @@ -1,10 +1,12 @@ -type LearnSectionType = { +export type LearnContentType = { label: string value: string - content: { - label: string - value: string - }[] +} + +export type LearnSectionType = { + label: string + value: string + content: LearnContentType[] } export type LearnLevelType = { diff --git a/src/app/learn/content/RenderContent.tsx b/src/app/learn/content/RenderContent.tsx new file mode 100644 index 000000000..9e155101f --- /dev/null +++ b/src/app/learn/content/RenderContent.tsx @@ -0,0 +1,15 @@ +'use client' + +import { useSearchParams } from 'next/navigation' + +export const RenderContent = () => { + const searchParams = useSearchParams() + + const content_id = searchParams.get('id') + + return ( +
+
rendering {content_id}
+
+ ) +} diff --git a/src/app/learn/content/page.tsx b/src/app/learn/content/page.tsx new file mode 100644 index 000000000..d1ee4aead --- /dev/null +++ b/src/app/learn/content/page.tsx @@ -0,0 +1,13 @@ +import { Metadata, type NextPage } from 'next' + +import { RenderContent } from './RenderContent' + +export const metadata: Metadata = { + title: 'Learn | programming.in.th' +} + +const Page: NextPage = () => { + return +} + +export default Page From 3fcb6b633cf47c908b579a4e7662aaadfb9e6b13 Mon Sep 17 00:00:00 2001 From: vzsky Date: Sat, 16 Aug 2025 12:13:10 +0700 Subject: [PATCH 3/8] fix build --- src/app/learn/content/page.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/app/learn/content/page.tsx b/src/app/learn/content/page.tsx index d1ee4aead..db7e6bd6a 100644 --- a/src/app/learn/content/page.tsx +++ b/src/app/learn/content/page.tsx @@ -1,3 +1,5 @@ +import { Suspense } from 'react' + import { Metadata, type NextPage } from 'next' import { RenderContent } from './RenderContent' @@ -7,7 +9,11 @@ export const metadata: Metadata = { } const Page: NextPage = () => { - return + return ( + + + + ) } export default Page From 6dbb6a88cb3a18ecd2033528d9081b0f7a522d06 Mon Sep 17 00:00:00 2001 From: vzsky Date: Tue, 19 Aug 2025 22:46:17 +0700 Subject: [PATCH 4/8] add md renderer --- src/app/learn/LearnContent.tsx | 42 +++++++++---------- src/app/learn/content/RenderContent.tsx | 15 ------- .../learn/content/[...id]/RenderContent.tsx | 31 ++++++++++++++ src/app/learn/content/[...id]/page.tsx | 10 +++++ src/app/learn/content/page.tsx | 19 --------- src/lib/api/queries/getLearnMaterial.ts | 33 +++++++++++++++ 6 files changed, 93 insertions(+), 57 deletions(-) delete mode 100644 src/app/learn/content/RenderContent.tsx create mode 100644 src/app/learn/content/[...id]/RenderContent.tsx create mode 100644 src/app/learn/content/[...id]/page.tsx delete mode 100644 src/app/learn/content/page.tsx create mode 100644 src/lib/api/queries/getLearnMaterial.ts diff --git a/src/app/learn/LearnContent.tsx b/src/app/learn/LearnContent.tsx index e6b23cc7c..31890e8b1 100644 --- a/src/app/learn/LearnContent.tsx +++ b/src/app/learn/LearnContent.tsx @@ -1,11 +1,9 @@ -'use client' - import Link from 'next/link' import { useSearchParams } from 'next/navigation' import { learnLevels, LearnLevelType, LearnContentType } from './constants' -const ContentItem = ({ +const LearnItem = ({ index, id, content @@ -15,27 +13,25 @@ const ContentItem = ({ content: LearnContentType }) => { return ( - <> -
- - -

- {index}. {content.label} -

-
- -
- +
+ + +

+ {index}. {content.label} +

+
+ +
) } -const ContentList = ({ level }: { level: LearnLevelType }) => { +const LearnList = ({ level }: { level: LearnLevelType }) => { return (
@@ -55,7 +51,7 @@ const ContentList = ({ level }: { level: LearnLevelType }) => { key={content.value} className="flex items-center gap-2 text-sm" > - {
{learnLevels.map(learnLevel => { return !level || level == learnLevel.value ? ( - + ) : ( <> ) diff --git a/src/app/learn/content/RenderContent.tsx b/src/app/learn/content/RenderContent.tsx deleted file mode 100644 index 9e155101f..000000000 --- a/src/app/learn/content/RenderContent.tsx +++ /dev/null @@ -1,15 +0,0 @@ -'use client' - -import { useSearchParams } from 'next/navigation' - -export const RenderContent = () => { - const searchParams = useSearchParams() - - const content_id = searchParams.get('id') - - return ( -
-
rendering {content_id}
-
- ) -} diff --git a/src/app/learn/content/[...id]/RenderContent.tsx b/src/app/learn/content/[...id]/RenderContent.tsx new file mode 100644 index 000000000..4c7ded036 --- /dev/null +++ b/src/app/learn/content/[...id]/RenderContent.tsx @@ -0,0 +1,31 @@ +'use client' + +import { MDXRemote, MDXRemoteSerializeResult } from 'next-mdx-remote' + +import components from '@/components/common/MDXComponents' + +const RenderUnderConstruction = () => { + return ( +
+ Under Construction +
+ ) +} + +export const RenderContent = ({ + content_md +}: { + content_md: MDXRemoteSerializeResult | null +}) => { + if (!content_md) return + + return ( +
+
+
+ +
+
+
+ ) +} diff --git a/src/app/learn/content/[...id]/page.tsx b/src/app/learn/content/[...id]/page.tsx new file mode 100644 index 000000000..da9bc7331 --- /dev/null +++ b/src/app/learn/content/[...id]/page.tsx @@ -0,0 +1,10 @@ +import { getLearnMaterial } from '@/lib/api/queries/getLearnMaterial' + +import { RenderContent } from './RenderContent' + +const Page = async ({ params }: { params: { id: string } }) => { + const learnMaterial = await getLearnMaterial(params.id) + return +} + +export default Page diff --git a/src/app/learn/content/page.tsx b/src/app/learn/content/page.tsx deleted file mode 100644 index db7e6bd6a..000000000 --- a/src/app/learn/content/page.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { Suspense } from 'react' - -import { Metadata, type NextPage } from 'next' - -import { RenderContent } from './RenderContent' - -export const metadata: Metadata = { - title: 'Learn | programming.in.th' -} - -const Page: NextPage = () => { - return ( - - - - ) -} - -export default Page diff --git a/src/lib/api/queries/getLearnMaterial.ts b/src/lib/api/queries/getLearnMaterial.ts new file mode 100644 index 000000000..42dda9e7c --- /dev/null +++ b/src/lib/api/queries/getLearnMaterial.ts @@ -0,0 +1,33 @@ +import 'server-only' + +import { notFound } from 'next/navigation' + +import { MDXRemoteSerializeResult } from 'next-mdx-remote' + +import { mdxToHtml } from '@/lib/renderMarkdown' + +/** + * Get learn material (md file), only used in server components + * + * @throws 404 Error + */ +export async function getLearnMaterial( + id: string +): Promise { + if (!id) { + return notFound() + } + + let solution = null + + const solutionRes = await fetch( + `${process.env.NEXT_PUBLIC_AWS_URL}/learnmat/md/${id}.md` + ) + + if (solutionRes.status === 200) { + const raw = await solutionRes.text() + solution = await mdxToHtml(raw) + } + + return solution +} From de678799e96407aed53a69b0ca014c908cc5777e Mon Sep 17 00:00:00 2001 From: vzsky Date: Tue, 19 Aug 2025 22:55:30 +0700 Subject: [PATCH 5/8] wrap with try --- src/app/learn/LearnContent.tsx | 3 +-- src/lib/api/queries/getLearnMaterial.ts | 23 ++++++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/app/learn/LearnContent.tsx b/src/app/learn/LearnContent.tsx index 31890e8b1..10ee15b99 100644 --- a/src/app/learn/LearnContent.tsx +++ b/src/app/learn/LearnContent.tsx @@ -16,8 +16,7 @@ const LearnItem = ({
diff --git a/src/lib/api/queries/getLearnMaterial.ts b/src/lib/api/queries/getLearnMaterial.ts index 42dda9e7c..00b7cc489 100644 --- a/src/lib/api/queries/getLearnMaterial.ts +++ b/src/lib/api/queries/getLearnMaterial.ts @@ -14,20 +14,21 @@ import { mdxToHtml } from '@/lib/renderMarkdown' export async function getLearnMaterial( id: string ): Promise { - if (!id) { - return notFound() - } + if (!id) return notFound() let solution = null - const solutionRes = await fetch( - `${process.env.NEXT_PUBLIC_AWS_URL}/learnmat/md/${id}.md` - ) - - if (solutionRes.status === 200) { - const raw = await solutionRes.text() - solution = await mdxToHtml(raw) + try { + const solutionRes = await fetch( + `${process.env.NEXT_PUBLIC_AWS_URL}/learnmat/md/${id}.md` + ) + + if (solutionRes.status === 200) { + const raw = await solutionRes.text() + solution = await mdxToHtml(raw) + } + } catch (error) { + console.log(error) } - return solution } From a965c298b7e8d77579bd9e4ef941efaf210158ba Mon Sep 17 00:00:00 2001 From: vzsky Date: Tue, 19 Aug 2025 23:01:29 +0700 Subject: [PATCH 6/8] fix: use client --- src/app/learn/LearnContent.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/app/learn/LearnContent.tsx b/src/app/learn/LearnContent.tsx index 10ee15b99..7a7157100 100644 --- a/src/app/learn/LearnContent.tsx +++ b/src/app/learn/LearnContent.tsx @@ -1,3 +1,5 @@ +'use client' + import Link from 'next/link' import { useSearchParams } from 'next/navigation' From 75bbd8984555d33de3205dcf579ef77a1910c9bb Mon Sep 17 00:00:00 2001 From: vzsky Date: Wed, 20 Aug 2025 11:41:49 +0700 Subject: [PATCH 7/8] add sidebar --- src/app/learn/constants.ts | 2 +- .../learn/content/[...id]/RenderContent.tsx | 10 +++- src/app/learn/content/[...id]/page.tsx | 54 +++++++++++++++++-- src/lib/api/queries/getLearnMaterial.ts | 2 +- 4 files changed, 61 insertions(+), 7 deletions(-) diff --git a/src/app/learn/constants.ts b/src/app/learn/constants.ts index 33ba90b92..318e2b065 100644 --- a/src/app/learn/constants.ts +++ b/src/app/learn/constants.ts @@ -18,7 +18,7 @@ export type LearnLevelType = { export const learnLevels: LearnLevelType[] = [ { label: 'เตรียมตัวก่อนเข้าค่าย', - value: 'prePosn', + value: 'pre-posn', sections: [ { label: 'คณิตศาสตร์', diff --git a/src/app/learn/content/[...id]/RenderContent.tsx b/src/app/learn/content/[...id]/RenderContent.tsx index 4c7ded036..3fc54f26f 100644 --- a/src/app/learn/content/[...id]/RenderContent.tsx +++ b/src/app/learn/content/[...id]/RenderContent.tsx @@ -1,13 +1,19 @@ 'use client' +import { ExclamationCircleIcon } from '@heroicons/react/24/solid' import { MDXRemote, MDXRemoteSerializeResult } from 'next-mdx-remote' import components from '@/components/common/MDXComponents' const RenderUnderConstruction = () => { return ( -
- Under Construction +
+ + +

+ เนื้อหาส่วนนี้ยังไม่สมบูรณ์ +

+

ขออภัยในความไม่สะดวก

) } diff --git a/src/app/learn/content/[...id]/page.tsx b/src/app/learn/content/[...id]/page.tsx index da9bc7331..0d3824bfb 100644 --- a/src/app/learn/content/[...id]/page.tsx +++ b/src/app/learn/content/[...id]/page.tsx @@ -1,10 +1,58 @@ +import { Suspense } from 'react' + +import Link from 'next/link' + +import { ArrowLeftIcon } from '@heroicons/react/24/solid' + import { getLearnMaterial } from '@/lib/api/queries/getLearnMaterial' import { RenderContent } from './RenderContent' +import { learnLevels } from '../../constants' + +const ContentSidebar = ({ id }: { id: string }) => { + const path = id.split('_') + if (path.length != 3) return <> + const levelLabel = learnLevels.filter(lev => lev.value == path[0])[0].label + const label = learnLevels + .filter(lev => lev.value == path[0])[0] + .sections.filter(sec => sec.value == path[1])[0] + .content.filter(con => con.value == path[2])[0].label + + return ( +
+
+
+ + + + + exit + + + +

เนื้อหา{levelLabel}

+

เรื่อง {label}

+
+
+
+ ) +} -const Page = async ({ params }: { params: { id: string } }) => { - const learnMaterial = await getLearnMaterial(params.id) - return +const Page = async ({ params }: { params: { id: string[] } }) => { + const learnMaterial = await getLearnMaterial(params.id[0]) + return ( +
+
+
+
+ + + + +
+
+
+ ) } export default Page diff --git a/src/lib/api/queries/getLearnMaterial.ts b/src/lib/api/queries/getLearnMaterial.ts index 00b7cc489..976fc05ce 100644 --- a/src/lib/api/queries/getLearnMaterial.ts +++ b/src/lib/api/queries/getLearnMaterial.ts @@ -20,7 +20,7 @@ export async function getLearnMaterial( try { const solutionRes = await fetch( - `${process.env.NEXT_PUBLIC_AWS_URL}/learnmat/md/${id}.md` + `${process.env.NEXT_PUBLIC_AWS_URL}/solutions/md/${id}.md` ) if (solutionRes.status === 200) { From 6d1a2e78f332120c41c4366b8f7d374b832ccc21 Mon Sep 17 00:00:00 2001 From: vzsky Date: Mon, 25 Aug 2025 11:26:43 +0700 Subject: [PATCH 8/8] change path to /tutorial --- src/app/learn/constants.ts | 88 +++++++++++++++++++++---- src/lib/api/queries/getLearnMaterial.ts | 2 +- 2 files changed, 77 insertions(+), 13 deletions(-) diff --git a/src/app/learn/constants.ts b/src/app/learn/constants.ts index 318e2b065..6c7f09c04 100644 --- a/src/app/learn/constants.ts +++ b/src/app/learn/constants.ts @@ -24,6 +24,10 @@ export const learnLevels: LearnLevelType[] = [ label: 'คณิตศาสตร์', value: 'math', content: [ + { + label: 'บทนำ', + value: 'intro' + }, { label: 'จำนวน ระบบจำนวน การดำเนินการของจำนวน', value: 'number-operation' @@ -89,20 +93,16 @@ export const learnLevels: LearnLevelType[] = [ value: 'programming', content: [ { - label: 'พื้นฐานภาษา C และ C++', - value: 'cpp-basic' + label: 'ทำไมถึงใช้ C++', + value: 'why-cpp' }, { label: 'การติดตั้งโปรแกรม', value: 'installation' }, { - label: 'การเขียนโปรแกรมรับข้อมูลเข้าและการแสดงผลข้อมูล', - value: 'io' - }, - { - label: 'ชนิดของข้อมูล', - value: 'datatype' + label: 'พื้นฐานภาษา C และ C++', + value: 'cpp-basic' } ] } @@ -119,6 +119,70 @@ export const learnLevels: LearnLevelType[] = [ { label: 'เวกเตอร์และระบบพิกัดคาร์ทีเซียน', value: 'vector-cartesian' + }, + { + label: 'การนับ', + value: 'counting' + }, + { + label: 'ทฤษฎีกราฟ', + value: 'graph' + } + ] + }, + { + label: 'Data Structure', + value: 'datastructure', + content: [ + { + label: 'Intro To DS', + value: 'intro' + }, + { + label: 'Primitive', + value: 'primitive' + }, + { + label: 'Array and Vector', + value: 'array-vector' + }, + { + label: 'string', + value: 'string' + }, + { + label: 'pair', + value: 'pair' + }, + { + label: 'stack and queue', + value: 'stack-queue' + }, + { + label: 'priority queue', + value: 'priority-queue' + }, + { + label: 'set and map', + value: 'set-map' + }, + { + label: 'choosing datastructure', + value: 'choosing-ds' + } + ] + }, + { + label: 'Algorithm', + value: 'algorithm', + content: [ + { + label: 'intro', + value: 'intro' + }, + { + label: 'bruteforce', + value: 'bruteforce' } ] } @@ -133,8 +197,8 @@ export const learnLevels: LearnLevelType[] = [ value: 'math', content: [ { - label: 'เวกเตอร์และระบบพิกัดคาร์ทีเซียน', - value: 'vector-cartesian' + label: 'คณิตศาสตร์ระดับสูง', + value: 'advanced-math' } ] } @@ -149,8 +213,8 @@ export const learnLevels: LearnLevelType[] = [ value: 'math', content: [ { - label: 'เวกเตอร์และระบบพิกัดคาร์ทีเซียน', - value: 'vector-cartesian' + label: 'คณิตศาสตร์ระดับสูง', + value: 'advanced-math' } ] } diff --git a/src/lib/api/queries/getLearnMaterial.ts b/src/lib/api/queries/getLearnMaterial.ts index 976fc05ce..1c047a0cd 100644 --- a/src/lib/api/queries/getLearnMaterial.ts +++ b/src/lib/api/queries/getLearnMaterial.ts @@ -20,7 +20,7 @@ export async function getLearnMaterial( try { const solutionRes = await fetch( - `${process.env.NEXT_PUBLIC_AWS_URL}/solutions/md/${id}.md` + `${process.env.NEXT_PUBLIC_AWS_URL}/tutorial/${id.replaceAll('_', '/')}.md` ) if (solutionRes.status === 200) {