chore: improve course settings
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
RadioButtonGroup,
|
||||
RadioButton
|
||||
} from 'carbon-components-svelte';
|
||||
import { Restart } from 'carbon-icons-svelte';
|
||||
import { Restart, ArrowUpRight } from 'carbon-icons-svelte';
|
||||
import { PUBLIC_SERVER_URL } from '$env/static/public';
|
||||
|
||||
import SectionTitle from '$lib/components/Org/SectionTitle.svelte';
|
||||
@@ -130,45 +130,28 @@
|
||||
}
|
||||
isSaving = true;
|
||||
try {
|
||||
const {
|
||||
course_title,
|
||||
course_description,
|
||||
type,
|
||||
logo,
|
||||
tabs,
|
||||
grading,
|
||||
allow_new_students,
|
||||
lesson_download,
|
||||
is_published
|
||||
} = $settings;
|
||||
await updateCourse($course.id, avatar, {
|
||||
title: course_title,
|
||||
description: course_description,
|
||||
type: type,
|
||||
logo: logo,
|
||||
is_published,
|
||||
const updatedCourse = {
|
||||
title: $settings.course_title,
|
||||
description: $settings.course_description,
|
||||
type: $settings.type,
|
||||
logo: $settings.logo,
|
||||
is_published: $settings.is_published,
|
||||
metadata: {
|
||||
...(isObject($course.metadata) ? $course.metadata : {}),
|
||||
lessonTabsOrder: tabs,
|
||||
grading: grading,
|
||||
lessonDownload: lesson_download,
|
||||
allowNewStudent: allow_new_students
|
||||
lessonTabsOrder: $settings.tabs,
|
||||
grading: $settings.grading,
|
||||
lessonDownload: $settings.lesson_download,
|
||||
allowNewStudent: $settings.allow_new_students
|
||||
},
|
||||
slug: $course.slug
|
||||
});
|
||||
|
||||
$course.title = course_title;
|
||||
$course.description = course_description;
|
||||
$course.type = type;
|
||||
$course.logo = logo;
|
||||
$course.is_published = is_published;
|
||||
$course.metadata = {
|
||||
...(isObject($course.metadata) ? $course.metadata : {}),
|
||||
lessonTabsOrder: tabs,
|
||||
grading: grading,
|
||||
lessonDownload: lesson_download,
|
||||
allowNewStudent: allow_new_students
|
||||
};
|
||||
await updateCourse($course.id, avatar, updatedCourse);
|
||||
|
||||
$course = {
|
||||
...$course,
|
||||
...updatedCourse
|
||||
};
|
||||
|
||||
snackbar.success('snackbar.course_settings.success.saved');
|
||||
} catch (error) {
|
||||
snackbar.error();
|
||||
@@ -198,6 +181,7 @@
|
||||
};
|
||||
|
||||
$: setDefault($course);
|
||||
$: courseLink = `${$currentOrgDomain}/course/${$course.slug}`;
|
||||
</script>
|
||||
|
||||
<Grid class="border-c rounded border-gray-200 dark:border-neutral-600">
|
||||
@@ -263,9 +247,13 @@
|
||||
<IconButton contained={true} size="small" onClick={generateNewCourseLink}>
|
||||
<Restart size={16} />
|
||||
</IconButton>
|
||||
<span class="grow" />
|
||||
<IconButton contained={true} size="small" onClick={() => goto(courseLink)}>
|
||||
<ArrowUpRight size={16} />
|
||||
</IconButton>
|
||||
</p>
|
||||
{#if $course.slug}
|
||||
<CodeSnippet wrapText type="multi" code={`${$currentOrgDomain}/course/${$course.slug}`} />
|
||||
<CodeSnippet wrapText type="multi" code={courseLink} />
|
||||
{:else}
|
||||
<CodeSnippet code="Setup landing page to get course link" />
|
||||
{/if}
|
||||
|
||||
@@ -12,16 +12,16 @@
|
||||
class="group fixed bottom-14 right-9 z-50 hover:no-underline"
|
||||
>
|
||||
<span
|
||||
class="overflow-hidden transition shadow-md duration-500 group-hover:bg-blue-600 group-hover:text-white flex items-center gap-2 dark:text-black bg-white border border-gray-50 group-hover:border-blue-600 rounded-md p-3 text-black text-sm font-medium"
|
||||
class="overflow-hidden transition shadow-md duration-500 group-hover:bg-blue-600 group-hover:text-white flex items-center gap-1 dark:text-black bg-white border border-gray-50 group-hover:border-blue-600 rounded-md px-2 py-1 text-black text-sm font-medium"
|
||||
>
|
||||
<ArrowUpRight
|
||||
class="
|
||||
absolute group-hover:opacity-100 group-hover:translate-y-0 group-hover:translate-x-0
|
||||
absolute left-3 group-hover:opacity-100 group-hover:translate-y-0 group-hover:translate-x-0
|
||||
opacity-0 translate-y-full -translate-x-full transition duration-500 text-white"
|
||||
size={16}
|
||||
/>
|
||||
<img src="/logo-192.png" alt="logo" class="group-hover:opacity-0 opacity-100 h-[16px]" />
|
||||
{$t('course.navItem.landing_page.powered_by')}ClassroomIO
|
||||
<img src="/logo-192.png" alt="logo" class="group-hover:opacity-0 opacity-100 h-[24px]" />
|
||||
{$t('course.navItem.landing_page.powered_by')} ClassroomIO
|
||||
</span>
|
||||
</a>
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user