Skip to content

Commit 27bd61e

Browse files
committed
initial layout move for course
1 parent 33adbcf commit 27bd61e

15 files changed

Lines changed: 180 additions & 192 deletions

File tree

‎apps/codingcatdev/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"prismjs": "^1.29.0",
4343
"svelte": "^3.58.0",
4444
"svelte-check": "^3.2.0",
45-
"svelte-preprocess": "^5.0.1",
45+
"svelte-preprocess": "^5.0.3",
4646
"tailwindcss": "^3.2.7",
4747
"typescript": "^4.9.5",
4848
"vite": "^4.1.4",

‎apps/codingcatdev/src/lib/server/content.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ for (const path in modules) {
6464
console.log('Add Lessons to courses');
6565
const lessonModules = import.meta.glob('../../content/course/*/lesson/*.md');
6666
for (const path in lessonModules) {
67-
lessonModules[path]().then((mod) => {
67+
await lessonModules[path]().then((mod) => {
6868
const splitPath = path.replace('../../content/', '').split('/');
6969
const type = splitPath.at(0);
7070
const slug = splitPath.at(1);
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<script lang="ts">
2+
import { AppShell, TableOfContents } from '@codingcatdev/blackcatui';
3+
import RecentPostsList from './RecentPostsList.svelte';
4+
import { ContentType } from '$lib/types';
5+
6+
import type { LayoutData } from './$types';
7+
export let data: LayoutData;
8+
</script>
9+
10+
<!-- App Shell -->
11+
<AppShell regionPage="overflow-y-scroll" slotPageFooter="pt-4 bg-surface-50-900-token" }>
12+
<!-- Page Content -->
13+
<slot />
14+
<svelte:fragment slot="bcu-app-shell-sidebar-right">
15+
<!-- Div takes up same room as fixed -->
16+
<div class="w-[19.5rem] xl:w-96" />
17+
<div
18+
class="fixed z-20 top-[5.125rem] bottom-24 w-[19.5rem] xl:w-96 py-10 overflow-y-auto hidden xl:block"
19+
>
20+
<div class="px-8 flex flex-col gap-2 md:gap-8">
21+
<TableOfContents target=".markdown" />
22+
<RecentPostsList contentType={ContentType.course} list={data.course} />
23+
<RecentPostsList contentType={ContentType.tutorial} list={data.tutorial} />
24+
<RecentPostsList contentType={ContentType.podcast} list={data.podcast} />
25+
<RecentPostsList contentType={ContentType.post} list={data.post} />
26+
</div>
27+
</div>
28+
</svelte:fragment>
29+
<!-- <svelte:fragment slot="bcu-app-shell-page-footer">new</svelte:fragment> -->
30+
</AppShell>

‎apps/codingcatdev/src/routes/(content-single)/(non-course)/Content.svelte‎

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,17 @@
11
<script lang="ts">
22
import 'prism-themes/themes/prism-shades-of-purple.min.css';
3-
import RecentPostsList from './RecentPostsList.svelte';
4-
import {
5-
ContentType,
6-
type Content,
7-
type Course,
8-
type Lesson,
9-
type Podcast
10-
} from '$lib/types/index';
3+
114
import Video from '$lib/components/content/Video.svelte';
5+
import type { Content } from '$lib/types';
126
export let data: {
13-
content: Lesson;
14-
course: Course[];
15-
tutorial: Content[];
16-
podcast: Podcast[];
17-
post: Content[];
7+
content: Content;
188
};
19-
console.log(data?.content);
209
</script>
2110

2211
{#if data?.content}
2312
<div class="flex justify-center">
24-
<section class="flex flex-col xl:flex-row gap-8 justify-center p-1 xl:p-8">
25-
<div class="flex flex-col gap-2 md:gap-8 max-w-7xl">
13+
<section class="flex flex-col xl:flex-row gap-8 justify-center p-1 xl:p-8 w-full">
14+
<div class="flex flex-col gap-2 md:gap-8 max-w-7xl w-full">
2615
{#if data?.content?.youtube}
2716
<Video
2817
sources={[
@@ -37,13 +26,6 @@
3726
{@html data.content.html}
3827
</section>
3928
</div>
40-
41-
<div class="flex flex-col gap-6">
42-
<RecentPostsList contentType={ContentType.course} list={data.course} />
43-
<RecentPostsList contentType={ContentType.tutorial} list={data.tutorial} />
44-
<RecentPostsList contentType={ContentType.podcast} list={data.podcast} />
45-
<RecentPostsList contentType={ContentType.post} list={data.post} />
46-
</div>
4729
</section>
4830
</div>
4931
{:else}

‎apps/codingcatdev/src/routes/(content-single)/(non-course)/RecentPostsList.svelte‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<div class="bcu-card">
1111
<header class="bcu-card-header capitalize pb-2 text-xl font-bold">{title}</header>
1212
<hr />
13-
<ul class="w-96 p-2 bg-base-content shadow-xl">
13+
<ul>
1414
{#each list as content}
1515
<li class={`list-none cursor-pointer p-1 rounded m-1 flex flex-col justify-between`}>
1616
<a href={`/${contentType}/${content.slug}`} class="link-primary">

‎apps/codingcatdev/src/routes/(content-single)/course/Course.svelte‎

Lines changed: 0 additions & 43 deletions
This file was deleted.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { getContentBySlug } from '$lib/server/content';
2+
import { ContentType } from '$lib/types';
3+
import { error } from '@sveltejs/kit';
4+
import type { LayoutServerLoad } from './$types';
5+
6+
const contentType = ContentType.course;
7+
8+
export const load = (async ({ params }) => {
9+
const course = await getContentBySlug(contentType, params.slug);
10+
if (!course) {
11+
throw error(404, {
12+
message: 'Not found'
13+
});
14+
}
15+
return {
16+
contentType,
17+
course
18+
};
19+
}) satisfies LayoutServerLoad;
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<script lang="ts">
2+
import { AppShell, TableOfContents } from '@codingcatdev/blackcatui';
3+
import LessonList from './LessonList.svelte';
4+
5+
import type { LayoutData } from './$types';
6+
export let data: LayoutData;
7+
console.log(data);
8+
</script>
9+
10+
<!-- App Shell -->
11+
<AppShell regionPage="overflow-y-scroll" slotPageFooter="pt-4 bg-surface-50-900-token" }>
12+
<!-- Page Content -->
13+
<slot />
14+
<svelte:fragment slot="bcu-app-shell-sidebar-right">
15+
<!-- Div takes up same room as fixed -->
16+
<div class="w-[19.5rem] xl:w-96" />
17+
<div
18+
class="fixed z-20 top-[5.125rem] bottom-24 w-[19.5rem] xl:w-96 py-10 overflow-y-auto hidden xl:block"
19+
>
20+
<div class="px-8 flex flex-col gap-2 md:gap-8">
21+
<TableOfContents target=".markdown" />
22+
{#if data?.course?.lesson && data?.course?.lesson.length > 0 && data?.course?.slug}
23+
<div class="hidden xl:block">
24+
<LessonList courseSlug={data?.course?.slug} lesson={data.course.lesson} />
25+
</div>
26+
{/if}
27+
</div>
28+
</div>
29+
</svelte:fragment>
30+
<!-- <svelte:fragment slot="bcu-app-shell-page-footer">new</svelte:fragment> -->
31+
</AppShell>

‎apps/codingcatdev/src/routes/(content-single)/course/[slug]/+page.server.ts‎

Lines changed: 0 additions & 19 deletions
This file was deleted.

‎apps/codingcatdev/src/routes/(content-single)/course/[slug]/+page.svelte‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script>
2-
import Course from '../Course.svelte';
2+
import Course from './Course.svelte';
33
/** @type {import('./$types').PageData} */
44
export let data;
55
</script>

0 commit comments

Comments
 (0)