chore: ai, public course and other ui improvements
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
import BookOpenIcon from '@lucide/svelte/icons/book-open';
|
||||
import ContentList from '$features/course/components/lesson/content-list.svelte';
|
||||
import ContentSectionList from '$features/course/components/lesson/content-section-list.svelte';
|
||||
import CourseContentIcon from '$features/course/components/course-content-icon.svelte';
|
||||
import { courseApi } from '$features/course/api';
|
||||
import { t } from '$lib/utils/functions/translations';
|
||||
import { getCourseContent } from '$features/course/utils/content';
|
||||
@@ -28,6 +29,12 @@
|
||||
contentItems.filter((item) => item.type === ContentType.Lesson || item.type === ContentType.Exercise)
|
||||
);
|
||||
|
||||
const sectionsTotal = $derived(
|
||||
contentData.grouped ? contentData.sections.filter((section) => section.id !== 'ungrouped').length : 0
|
||||
);
|
||||
const lessonsTotal = $derived(contentItems.filter((item) => item.type === ContentType.Lesson).length);
|
||||
const exercisesTotal = $derived(contentItems.filter((item) => item.type === ContentType.Exercise).length);
|
||||
|
||||
let isFetching: boolean = $state(false);
|
||||
let hasHandledNext = $state(false);
|
||||
|
||||
@@ -65,6 +72,34 @@
|
||||
variant="page"
|
||||
/>
|
||||
{:else if contentLength > 0}
|
||||
<div
|
||||
class="mb-5 grid grid-cols-1 gap-3 sm:grid-cols-3"
|
||||
role="region"
|
||||
aria-label={t.get('course.navItem.lessons.heading_v2')}
|
||||
>
|
||||
<div class="ui:border-border flex flex-col gap-1 rounded-lg border px-4 py-3">
|
||||
<div class="ui:text-muted-foreground flex items-center gap-2 text-xs font-medium">
|
||||
<CourseContentIcon type={ContentType.Section} size={14} />
|
||||
<span>{$t('course.navItem.lessons.stats.sections')}</span>
|
||||
</div>
|
||||
<p class="text-2xl font-semibold tabular-nums">{sectionsTotal}</p>
|
||||
</div>
|
||||
<div class="ui:border-border flex flex-col gap-1 rounded-lg border px-4 py-3">
|
||||
<div class="ui:text-muted-foreground flex items-center gap-2 text-xs font-medium">
|
||||
<CourseContentIcon type={ContentType.Lesson} size={14} />
|
||||
<span>{$t('course.navItem.lessons.stats.lessons')}</span>
|
||||
</div>
|
||||
<p class="text-2xl font-semibold tabular-nums">{lessonsTotal}</p>
|
||||
</div>
|
||||
<div class="ui:border-border flex flex-col gap-1 rounded-lg border px-4 py-3">
|
||||
<div class="ui:text-muted-foreground flex items-center gap-2 text-xs font-medium">
|
||||
<CourseContentIcon type={ContentType.Exercise} size={14} />
|
||||
<span>{$t('course.navItem.lessons.stats.exercises')}</span>
|
||||
</div>
|
||||
<p class="text-2xl font-semibold tabular-nums">{exercisesTotal}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if reorder}
|
||||
<p class="text-center text-xs text-gray-400 italic dark:text-white">
|
||||
{$t('course.navItem.lessons.drag')}
|
||||
|
||||
Reference in New Issue
Block a user