2023-10-30 04:52:00 +00:00
|
|
|
<script lang="ts">
|
2022-01-10 00:18:08 +02:00
|
|
|
import { fly } from 'svelte/transition';
|
2026-03-09 11:18:22 +01:00
|
|
|
import { goto } from '$app/navigation';
|
|
|
|
|
import { resolve } from '$app/paths';
|
|
|
|
|
import { courseApi } from '$features/course/api';
|
|
|
|
|
import type { Course } from '$features/course/utils/types';
|
2024-09-07 10:18:21 +01:00
|
|
|
|
2025-12-22 02:36:48 +01:00
|
|
|
import { CourseLandingPage } from '$features/ui';
|
|
|
|
|
import Editor from '$features/ui/course-landing-page/components/editor/editor.svelte';
|
2026-03-09 11:18:22 +01:00
|
|
|
import * as Sidebar from '@cio/ui/base/sidebar';
|
2022-01-10 00:18:08 +02:00
|
|
|
|
2025-11-01 15:49:29 +01:00
|
|
|
let { data } = $props();
|
2023-10-22 09:47:13 +01:00
|
|
|
|
2026-03-09 11:18:22 +01:00
|
|
|
const courseId = $derived(data.courseId);
|
2022-12-30 13:08:54 +01:00
|
|
|
|
2026-03-09 11:18:22 +01:00
|
|
|
let sidebarOpen = $state(true);
|
2022-12-30 13:08:54 +01:00
|
|
|
|
2023-12-04 19:39:39 +03:00
|
|
|
function syncCourseStore(_courseData: Course) {
|
2026-03-09 11:18:22 +01:00
|
|
|
if (courseApi.course) {
|
|
|
|
|
courseApi.course = { ...courseApi.course, ..._courseData };
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function handleClose() {
|
|
|
|
|
goto(resolve(`/courses/${courseId}`, {}));
|
2023-12-04 19:39:39 +03:00
|
|
|
}
|
2022-01-10 00:18:08 +02:00
|
|
|
</script>
|
|
|
|
|
|
2026-03-09 11:18:22 +01:00
|
|
|
{#if courseApi.course}
|
2025-11-01 15:49:29 +01:00
|
|
|
<div
|
2026-03-09 11:18:22 +01:00
|
|
|
class="fixed inset-0 z-50 h-screen w-screen bg-white"
|
2025-11-01 15:49:29 +01:00
|
|
|
in:fly={{ y: 500, duration: 500 }}
|
|
|
|
|
out:fly={{ y: 500, duration: 500 }}
|
|
|
|
|
>
|
2026-03-12 05:31:59 +01:00
|
|
|
<Sidebar.Provider bind:open={sidebarOpen} style="--sidebar-width: 280px">
|
|
|
|
|
<Sidebar.Root side="left" collapsible="icon" class="h-full">
|
2026-03-09 11:18:22 +01:00
|
|
|
<Editor {courseId} bind:course={courseApi.course} {syncCourseStore} onClose={handleClose} />
|
|
|
|
|
</Sidebar.Root>
|
|
|
|
|
<Sidebar.Inset class="relative h-screen! overflow-y-auto">
|
|
|
|
|
<div class="absolute top-2 left-2 z-60">
|
|
|
|
|
<Sidebar.Trigger variant="secondary" />
|
|
|
|
|
</div>
|
|
|
|
|
<CourseLandingPage bind:courseData={courseApi.course} editMode={true} />
|
|
|
|
|
</Sidebar.Inset>
|
|
|
|
|
</Sidebar.Provider>
|
2022-01-10 00:18:08 +02:00
|
|
|
</div>
|
2026-03-09 11:18:22 +01:00
|
|
|
{/if}
|