);
}
-export function handleDelete(lessonId: Lesson['id']) {
- return async () => {
- // Need to implement soft delete
- if (lessonId) {
- const { error } = await deleteLesson(lessonId);
+export async function handleDelete(lessonId: Lesson['id'] | undefined) {
+ // Need to implement soft delete
+ if (lessonId) {
+ const { error } = await deleteLesson(lessonId);
- if (error) {
- return alert('Please delete all exercises first');
- }
+ if (error) {
+ snackbar.error(error.message);
+ return console.error('Error deleting course', error);
}
lessons.update((_lessons) => _lessons.filter((lesson) => lesson.id !== lessonId));
- console.log(`lessonId`, lessonId);
- };
+ }
+
+ console.log(`lessonId`, lessonId);
}
export async function handleSaveLesson(lesson: Lesson, course_id: Course['id']) {
diff --git a/apps/dashboard/src/lib/components/CourseLandingPage/components/Editor/InstructorForm.svelte b/apps/dashboard/src/lib/components/CourseLandingPage/components/Editor/InstructorForm.svelte
index bfd965a4..3f5408fd 100644
--- a/apps/dashboard/src/lib/components/CourseLandingPage/components/Editor/InstructorForm.svelte
+++ b/apps/dashboard/src/lib/components/CourseLandingPage/components/Editor/InstructorForm.svelte
@@ -1,4 +1,4 @@
-
diff --git a/apps/dashboard/src/lib/components/CourseLandingPage/components/Editor/index.svelte b/apps/dashboard/src/lib/components/CourseLandingPage/components/Editor/index.svelte
index f80dfbbc..31ed953a 100644
--- a/apps/dashboard/src/lib/components/CourseLandingPage/components/Editor/index.svelte
+++ b/apps/dashboard/src/lib/components/CourseLandingPage/components/Editor/index.svelte
@@ -27,6 +27,7 @@
export let course: Course;
export let courseId: string;
+ export let syncCourseStore: (course: Course) => void;
let borderBottomGrey = 'border-r-0 border-b border-l-0 border-gray-300';
let loading = false;
@@ -123,9 +124,9 @@
polls: undefined,
slug: course.slug
});
- loading = false;
- return `${window.location.origin}/course/${course.slug}`;
+ loading = false;
+ syncCourseStore(course);
}
/**
* 1. Use all you have for editing now
@@ -149,10 +150,11 @@
size={$isMobile ? 'large' : 'small'}
color="text-black"
toolTipProps={$isMobile
- ? {}
+ ? undefined
: {
title: 'Toggle editor',
- direction: 'right'
+ direction: 'right',
+ hotkeys: []
}}
>
{#if show}
diff --git a/apps/dashboard/src/lib/components/CourseLandingPage/index.svelte b/apps/dashboard/src/lib/components/CourseLandingPage/index.svelte
index 681e4bad..0041e6d0 100644
--- a/apps/dashboard/src/lib/components/CourseLandingPage/index.svelte
+++ b/apps/dashboard/src/lib/components/CourseLandingPage/index.svelte
@@ -86,7 +86,7 @@
$: video = get(courseData, 'metadata.videoUrl');
$: bannerImage = get(courseData, 'logo');
$: lessons = get(courseData, 'lessons', []);
- $: instructor = courseData?.metadata?.instructor || {};
+ $: instructor = get(courseData, 'metadata.instructor') || {};
$: initPlyr(player, video);
$: {
reviews = get(courseData, 'metadata.reviews') || [];
@@ -276,7 +276,7 @@
{/if}
{#if lesson.note}
1 notenote
{/if}
diff --git a/apps/dashboard/src/lib/components/Form/Date.svelte b/apps/dashboard/src/lib/components/Form/Date.svelte
index fd949775..2fe5d84f 100644
--- a/apps/dashboard/src/lib/components/Form/Date.svelte
+++ b/apps/dashboard/src/lib/components/Form/Date.svelte
@@ -1,7 +1,7 @@
diff --git a/apps/dashboard/src/lib/components/TextEditor/index.svelte b/apps/dashboard/src/lib/components/TextEditor/index.svelte
index 16b6c8d9..c70b236f 100644
--- a/apps/dashboard/src/lib/components/TextEditor/index.svelte
+++ b/apps/dashboard/src/lib/components/TextEditor/index.svelte
@@ -4,7 +4,7 @@
import { appStore } from '$lib/utils/store/app';
export let id = '';
- export let value: string;
+ export let value: string | undefined = '';
export let onChange = (html: string) => {};
export let height = 300;
export let placeholder = '';
@@ -14,7 +14,7 @@
const apiKey = PUBLIC_TINYMCE_API_KEY;
let tinmycEditor: any;
- let unmount = false
+ let unmount = false;
// editor configuration
let conf = {
@@ -73,6 +73,6 @@
{#if !unmount}
-
+
{/if}
diff --git a/apps/dashboard/src/lib/components/UploadImage/index.svelte b/apps/dashboard/src/lib/components/UploadImage/index.svelte
index 204c2ffb..aa279387 100644
--- a/apps/dashboard/src/lib/components/UploadImage/index.svelte
+++ b/apps/dashboard/src/lib/components/UploadImage/index.svelte
@@ -1,21 +1,22 @@
-
diff --git a/apps/dashboard/src/routes/+layout.server.ts b/apps/dashboard/src/routes/+layout.server.ts
index 59dda199..6884e4f6 100644
--- a/apps/dashboard/src/routes/+layout.server.ts
+++ b/apps/dashboard/src/routes/+layout.server.ts
@@ -12,29 +12,22 @@ interface LoadOutput {
orgSiteName: string;
isOrgSite: boolean;
skipAuth: boolean;
- org: CurrentOrg;
+ org: CurrentOrg | null;
}
export const load = async ({ url, cookies }): Promise => {
- // if (url.hostname === 'classroomio.com') {
- // throw redirect(301, 'https://about.classroomio.com');
- // }
-
- let response: LoadOutput = {
+ const response: LoadOutput = {
orgSiteName: '',
isOrgSite: false,
skipAuth: false,
- org: {
- theme: ''
- }
+ org: null
};
const _orgSiteName = cookies.get('_orgSiteName');
const debugPlay = cookies.get('debugPlay');
const debugMode = _orgSiteName && _orgSiteName !== 'false';
- console.log('_orgSiteName', _orgSiteName);
- const matches = url.host.match(/([a-z 0-9 \-]+).*classroomio[.]com/);
+ const matches = url.host.match(/([a-z 0-9 -]+).*classroomio[.]com/);
const subdomain = matches?.[1] ?? '';
if (!blockedSubdomain.includes(subdomain)) {
@@ -42,7 +35,7 @@ export const load = async ({ url, cookies }): Promise => {
response.isOrgSite = debugMode || answer;
response.orgSiteName = debugMode ? _orgSiteName : subdomain;
- response.org = await getCurrentOrg(response.orgSiteName, true);
+ response.org = (await getCurrentOrg(response.orgSiteName, true)) || null;
} else if (subdomain === 'play' || debugPlay === 'true') {
response.skipAuth = true;
}
diff --git a/apps/dashboard/src/routes/+layout.svelte b/apps/dashboard/src/routes/+layout.svelte
index 22731491..7ee0f1fe 100644
--- a/apps/dashboard/src/routes/+layout.svelte
+++ b/apps/dashboard/src/routes/+layout.svelte
@@ -90,7 +90,6 @@
error,
status
} = await supabase.from('profile').select(`*`).eq('id', authUser?.id).single();
- console.log('Get user', authUser);
console.log('Get profile', profileData);
if (error && !profileData && status === 406 && authUser) {
@@ -219,10 +218,7 @@
handleResize();
- if (
- !isSupabaseTokenInLocalStorage() &&
- !isPublicRoute($page.url.pathname)
- ) {
+ if (!isSupabaseTokenInLocalStorage() && !isPublicRoute($page.url.pathname)) {
console.log('No auth token and is not a public route, redirect to login', path);
return goto('/login?redirect=/' + path);
}
@@ -408,9 +404,12 @@
}
:global(.plyr__controls) {
- background: url(/logo-192.png) 99% 70% no-repeat,
+ background:
+ url(/logo-192.png) 99% 70% no-repeat,
linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.5)) !important;
- background-size: 50px auto, auto !important;
+ background-size:
+ 50px auto,
+ auto !important;
}
:global(.cards-container) {
diff --git a/apps/dashboard/src/routes/courses/[id]/landingpage/+page.svelte b/apps/dashboard/src/routes/courses/[id]/landingpage/+page.svelte
index f7a3feb9..f13fe014 100644
--- a/apps/dashboard/src/routes/courses/[id]/landingpage/+page.svelte
+++ b/apps/dashboard/src/routes/courses/[id]/landingpage/+page.svelte
@@ -1,4 +1,5 @@
-
+
diff --git a/apps/dashboard/src/routes/courses/[id]/lessons/+page.svelte b/apps/dashboard/src/routes/courses/[id]/lessons/+page.svelte
index b59f3c02..ffbea3bf 100644
--- a/apps/dashboard/src/routes/courses/[id]/lessons/+page.svelte
+++ b/apps/dashboard/src/routes/courses/[id]/lessons/+page.svelte
@@ -1,5 +1,4 @@
-