diff --git a/src/components/Course/Chapter.tsx b/src/components/Course/Chapter.tsx index 22447115b..d4790ccf9 100644 --- a/src/components/Course/Chapter.tsx +++ b/src/components/Course/Chapter.tsx @@ -60,52 +60,60 @@ export function Chapter(props: ChapterProps) {
{index}
- {title} + {title} {isActive && (
-
- {filteredLessons?.map((lesson) => { - const isActive = lessonId === lesson.id; - - return ( - - ); - })} -
- -
- - - -
- -
- {exercises?.map((exercise) => { - const isActive = lessonId === exercise.id; - - return ( - - ); - })} -
+ {lessons.length > 0 && ( + <> +
+ {filteredLessons?.map((lesson) => { + const isActive = lessonId === lesson.id; + + return ( + + ); + })} +
+ +
+ + + +
+ +
+ {exercises?.map((exercise) => { + const isActive = lessonId === exercise.id; + + return ( + + ); + })} +
+ + )} + + {lessons.length === 0 && ( +
Coming Soon
+ )}
)} @@ -131,7 +139,7 @@ export function Lesson(props: LessonProps) { } = props; const { title } = frontmatter; - const href = `/courses/${courseId}/${chapterId}/${lessonId}`; + const href = `/learn/${courseId}/${chapterId}/${lessonId}`; return ( {isCompleted && } - {title} + {title} diff --git a/src/components/Course/CourseLayout.tsx b/src/components/Course/CourseLayout.tsx index 838c91156..50c96c820 100644 --- a/src/components/Course/CourseLayout.tsx +++ b/src/components/Course/CourseLayout.tsx @@ -1,4 +1,6 @@ +import { ChevronLeft, ChevronRight } from 'lucide-react'; import { CourseSidebar, type CourseSidebarProps } from './CourseSidebar'; +import { useMemo } from 'react'; type CourseLayoutProps = { children: React.ReactNode; @@ -6,12 +8,58 @@ type CourseLayoutProps = { export function CourseLayout(props: CourseLayoutProps) { const { children, ...sidebarProps } = props; + const { chapters, courseId, chapterId, lessonId } = sidebarProps; + + const allLessonLinks = useMemo(() => { + const lessons: string[] = []; + for (const chapter of chapters) { + for (const lesson of chapter.lessons) { + lessons.push(`/learn/${courseId}/${chapter.id}/${lesson.id}`); + } + } + + return lessons; + }, [chapters]); + + const currentLessonIndex = allLessonLinks.indexOf( + `/learn/${courseId}/${chapterId}/${lessonId}`, + ); + const prevLessonLink = allLessonLinks[currentLessonIndex - 1] || ''; + const nextLessonLink = allLessonLinks[currentLessonIndex + 1] || ''; return ( -
- - - {children} +
+
+ + + {children} +
+ +
+
+ + + +
+
); } diff --git a/src/components/Course/LessonView.tsx b/src/components/Course/LessonView.tsx index 32b39f587..5db7182eb 100644 --- a/src/components/Course/LessonView.tsx +++ b/src/components/Course/LessonView.tsx @@ -38,7 +38,7 @@ export function LessonView(props: LessonViewProps) { >
-
{children}
+
{children}
diff --git a/src/data/courses/sql/chapters/ddl/ddl.md b/src/data/courses/sql/chapters/ddl/ddl.md new file mode 100644 index 000000000..59ba0e409 --- /dev/null +++ b/src/data/courses/sql/chapters/ddl/ddl.md @@ -0,0 +1,5 @@ +--- +title: Data Definition Language (DDL) +description: Learn how to create, modify, and delete database objects using SQL Data Definition Language (DDL) statements. +order: 200 +--- diff --git a/src/data/courses/sql/chapters/introduction/lessons/challenge-1.md b/src/data/courses/sql/chapters/introduction/lessons/challenge-1.md index 3744aa25a..9e1f220db 100644 --- a/src/data/courses/sql/chapters/introduction/lessons/challenge-1.md +++ b/src/data/courses/sql/chapters/introduction/lessons/challenge-1.md @@ -3,7 +3,10 @@ title: Challenge 1 description: Write a SQL query to find the total number of orders in the `orders` table. order: 300 type: challenge -defaultValue: SELECT * FROM orders; +defaultValue: | + SELECT * FROM orders; + + SELECT COUNT(*) FROM orders; initSteps: - CREATE TABLE orders ( id INTEGER PRIMARY KEY, @@ -31,3 +34,7 @@ Write a SQL query to find the total number of orders in the `orders` table. ## Result Your query should return a single column with the total number of orders in the `orders` table. + +- The column name should be `total_orders`. +- The value should be the total number of orders in the `orders` table. +- The query should return a single row with the total number of orders in the `orders` table. diff --git a/src/pages/courses/[courseId]/[chapterId]/[lessonId].astro b/src/pages/learn/[courseId]/[chapterId]/[lessonId].astro similarity index 83% rename from src/pages/courses/[courseId]/[chapterId]/[lessonId].astro rename to src/pages/learn/[courseId]/[chapterId]/[lessonId].astro index 79aa50dca..d3aa4f639 100644 --- a/src/pages/courses/[courseId]/[chapterId]/[lessonId].astro +++ b/src/pages/learn/[courseId]/[chapterId]/[lessonId].astro @@ -81,7 +81,9 @@ const { course, chapter, lesson } = Astro.props; lesson={lesson} client:load > - +
+ +
) } @@ -97,7 +99,9 @@ const { course, chapter, lesson } = Astro.props; lesson={lesson} client:load > - +
+ +
) } @@ -112,7 +116,7 @@ const { course, chapter, lesson } = Astro.props; course={course} lesson={lesson} client:load - > + /> ) } diff --git a/src/pages/courses/[courseId]/index.astro b/src/pages/learn/[courseId]/index.astro similarity index 100% rename from src/pages/courses/[courseId]/index.astro rename to src/pages/learn/[courseId]/index.astro diff --git a/src/styles/global.css b/src/styles/global.css index f410f3380..d6540820f 100644 --- a/src/styles/global.css +++ b/src/styles/global.css @@ -62,6 +62,29 @@ a > code:before { content: '' !important; } +.course-content.prose ul li > code, +.course-content.prose ol li > code, +.course-content p code, +.course-content a > code, +.course-content strong > code, +.course-content em > code, +.course-content h1 > code, +.course-content h2 > code, +.course-content h3 > code { + background: transparent !important; + color: #f4f4f5 !important; + font-size: inherit !important; +} + +.course-content.prose ul li > code:before, +.course-content p > code:before, +.course-content.prose ul li > code:after, +.course-content p > code:after, +.course-content a > code:after, +.course-content a > code:before { + content: '`' !important; +} + .sponsor-footer { text-align: center; font-weight: 600;