2023-12-03 18:05:11 +03:00
|
|
|
<script lang="ts">
|
2025-12-22 02:36:48 +01:00
|
|
|
import { LessonsPage } from '$features/course/pages';
|
2025-11-01 15:49:29 +01:00
|
|
|
import { CourseContainer } from '$lib/components/CourseContainer';
|
2025-12-22 02:36:48 +01:00
|
|
|
import { Button } from '@cio/ui/base/button';
|
|
|
|
|
import { RoleBasedSecurity } from '$features/ui';
|
|
|
|
|
import * as Page from '@cio/ui/base/page';
|
2025-01-04 05:55:14 +01:00
|
|
|
import { t } from '$lib/utils/functions/translations';
|
|
|
|
|
import { profile } from '$lib/utils/store/user';
|
|
|
|
|
import { COURSE_VERSION } from '$lib/utils/types';
|
2025-12-22 02:36:48 +01:00
|
|
|
import { getGreeting } from '$lib/utils/functions/date.js';
|
|
|
|
|
import { course } from '$lib/components/Course/store';
|
|
|
|
|
import { handleAddLessonWidget } from '$lib/components/Course/components/Lesson/store';
|
2021-07-10 19:16:10 +00:00
|
|
|
|
2025-11-01 15:49:29 +01:00
|
|
|
let { data } = $props();
|
2023-09-30 10:43:13 +01:00
|
|
|
|
2025-11-01 15:49:29 +01:00
|
|
|
let reorder = $state(false);
|
|
|
|
|
let activateSections = $state(false);
|
2025-12-22 02:36:48 +01:00
|
|
|
let lessonEditing: string | undefined;
|
2021-09-13 14:02:18 +03:00
|
|
|
|
2021-07-10 19:16:10 +00:00
|
|
|
function addLesson() {
|
2024-02-01 20:18:03 +01:00
|
|
|
$handleAddLessonWidget.open = true;
|
2024-08-14 11:13:44 +01:00
|
|
|
$handleAddLessonWidget.isSection = $course.version === COURSE_VERSION.V2;
|
2021-09-14 07:01:44 +03:00
|
|
|
}
|
2021-07-10 19:16:10 +00:00
|
|
|
</script>
|
|
|
|
|
|
2025-12-22 02:36:48 +01:00
|
|
|
<svelte:head>
|
|
|
|
|
<title>Lessons - ClassroomIO</title>
|
|
|
|
|
</svelte:head>
|
2023-09-05 13:22:59 +00:00
|
|
|
|
2025-12-22 02:36:48 +01:00
|
|
|
<CourseContainer courseId={data.courseId}>
|
|
|
|
|
<Page.Header>
|
|
|
|
|
<Page.HeaderContent>
|
|
|
|
|
<Page.Title>
|
|
|
|
|
{$t(getGreeting())}
|
|
|
|
|
{$profile.fullname}!
|
|
|
|
|
</Page.Title>
|
|
|
|
|
</Page.HeaderContent>
|
|
|
|
|
<Page.Action>
|
2025-11-01 15:49:29 +01:00
|
|
|
<div class="flex w-full justify-end gap-2">
|
|
|
|
|
<RoleBasedSecurity allowedRoles={[1, 2]}>
|
|
|
|
|
{#if $course.version === COURSE_VERSION.V1}
|
2025-12-22 02:36:48 +01:00
|
|
|
<Button variant="outline" onclick={() => (activateSections = !activateSections)} disabled={!!lessonEditing}>
|
|
|
|
|
{$t(`course.navItem.lessons.section_prompt.cta`)}
|
|
|
|
|
</Button>
|
2025-11-01 15:49:29 +01:00
|
|
|
{/if}
|
2025-12-22 02:36:48 +01:00
|
|
|
<Button variant="outline" onclick={() => (reorder = !reorder)} disabled={!!lessonEditing}>
|
|
|
|
|
{$t(`course.navItem.lessons.add_lesson.${reorder ? 'end_reorder' : 'start_reorder'}`)}
|
|
|
|
|
</Button>
|
|
|
|
|
<Button onclick={addLesson} disabled={!!lessonEditing}>
|
|
|
|
|
{$t('course.navItem.lessons.add_lesson.button_title')}
|
|
|
|
|
</Button>
|
2025-11-01 15:49:29 +01:00
|
|
|
</RoleBasedSecurity>
|
|
|
|
|
</div>
|
2025-12-22 02:36:48 +01:00
|
|
|
</Page.Action>
|
|
|
|
|
</Page.Header>
|
|
|
|
|
|
|
|
|
|
<Page.Body>
|
|
|
|
|
{#snippet child()}
|
|
|
|
|
<LessonsPage courseId={data.courseId} />
|
2025-11-01 15:49:29 +01:00
|
|
|
{/snippet}
|
2025-12-22 02:36:48 +01:00
|
|
|
</Page.Body>
|
2021-07-10 19:16:10 +00:00
|
|
|
</CourseContainer>
|