chore: ai, public course and other ui improvements
This commit is contained in:
+27
-4
@@ -11,6 +11,7 @@
|
||||
import { t } from '$lib/utils/functions/translations';
|
||||
import { RoleBasedSecurity } from '$features/ui';
|
||||
import DeleteLessonConfirmation from '$features/course/components/lesson/delete-lesson-confirmation.svelte';
|
||||
import { slugifyTitle } from '@cio/utils/validation';
|
||||
|
||||
interface Props {
|
||||
mode: (typeof MODES)[keyof typeof MODES];
|
||||
@@ -20,6 +21,10 @@
|
||||
onTitleChange: (value: string) => void;
|
||||
onToggleLock: () => void;
|
||||
onDeleteLesson: () => Promise<void> | void;
|
||||
slug?: string;
|
||||
showSlugEditor?: boolean;
|
||||
slugError?: string;
|
||||
onSlugChange?: (value: string) => void;
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -29,9 +34,15 @@
|
||||
isDeletingLesson = false,
|
||||
onTitleChange,
|
||||
onToggleLock,
|
||||
onDeleteLesson
|
||||
onDeleteLesson,
|
||||
slug = '',
|
||||
showSlugEditor = false,
|
||||
slugError,
|
||||
onSlugChange = () => {}
|
||||
}: Props = $props();
|
||||
|
||||
// Slug field: commented out via `{#if false && ...}` below — drop `false &&` to show again.
|
||||
|
||||
let openDeleteModal = $state(false);
|
||||
|
||||
const lockLabel = $derived(
|
||||
@@ -40,7 +51,7 @@
|
||||
</script>
|
||||
|
||||
<div class="flex w-full items-center justify-between gap-2">
|
||||
<div class="min-w-0 flex-1">
|
||||
<div class="min-w-0 flex-1 space-y-2">
|
||||
{#if mode === MODES.edit && !$isOrgStudent}
|
||||
<RoleBasedSecurity allowedRoles={[1, 2]}>
|
||||
<InputField
|
||||
@@ -49,6 +60,17 @@
|
||||
placeholder={$t('course.navItem.lessons.add_lesson.lesson_title')}
|
||||
onInputChange={(e) => onTitleChange(e.currentTarget.value)}
|
||||
/>
|
||||
{#if false && showSlugEditor}
|
||||
<InputField
|
||||
className="max-w-xl"
|
||||
label={$t('course.navItem.settings.slug.label')}
|
||||
helperMessage={$t('course.navItem.settings.slug.description')}
|
||||
value={slug}
|
||||
placeholder={slugifyTitle(title || '')}
|
||||
onInputChange={(e) => onSlugChange(e.currentTarget.value)}
|
||||
errorMessage={slugError}
|
||||
/>
|
||||
{/if}
|
||||
</RoleBasedSecurity>
|
||||
{:else}
|
||||
<Page.Title>{title}</Page.Title>
|
||||
@@ -69,8 +91,9 @@
|
||||
<IconButton
|
||||
onclick={() => (openDeleteModal = true)}
|
||||
disabled={isDeletingLesson}
|
||||
aria-label={$t('course.navItem.lessons.add_lesson.delete')}
|
||||
title={$t('course.navItem.lessons.add_lesson.delete')}
|
||||
aria-label={$t('course.navItem.lessons.add_lesson.delete_tooltip')}
|
||||
tooltip={$t('course.navItem.lessons.add_lesson.delete_tooltip')}
|
||||
tooltipSide="bottom"
|
||||
>
|
||||
{#if isDeletingLesson}
|
||||
<Spinner class="h-4 w-4" />
|
||||
|
||||
Reference in New Issue
Block a user