From aa979b96f2ceedc2a505699d08ed79e129ac3b85 Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Wed, 26 Mar 2025 13:08:06 +0530 Subject: [PATCH] feat: onboarding --- frappe-ui | 2 +- frontend/package.json | 2 +- frontend/src/components/AppSidebar.vue | 309 +- frontend/src/components/BatchCourses.vue | 3 + frontend/src/components/BatchStudents.vue | 3 +- frontend/src/components/Members.vue | 3 + .../components/Modals/BatchCourseModal.vue | 12 + .../src/components/Modals/ChapterModal.vue | 8 +- .../src/components/Modals/StudentModal.vue | 3 + frontend/src/pages/Batch.vue | 120 +- frontend/src/pages/BatchForm.vue | 5 + frontend/src/pages/Batches.vue | 24 +- frontend/src/pages/CourseForm.vue | 8 +- frontend/src/pages/Courses.vue | 13 +- frontend/src/pages/LessonForm.vue | 8 +- frontend/src/pages/QuizForm.vue | 3 + frontend/vite.config.js | 2 +- frontend/yarn.lock | 2748 ----------- lms/lms/api.py | 4 +- lms/lms/onboarding.py | 19 + lms/lms/utils.py | 9 +- package.json | 2 +- yarn.lock | 4174 ++++++++++++++++- 23 files changed, 4602 insertions(+), 2882 deletions(-) delete mode 100644 frontend/yarn.lock create mode 100644 lms/lms/onboarding.py diff --git a/frappe-ui b/frappe-ui index c795670f..10635f31 160000 --- a/frappe-ui +++ b/frappe-ui @@ -1 +1 @@ -Subproject commit c795670f395748c0d68761c710d29141fa20b113 +Subproject commit 10635f3120840ddf67d2694b62046578f77c560c diff --git a/frontend/package.json b/frontend/package.json index 57752299..44bd7ea6 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -26,7 +26,7 @@ "codemirror-editor-vue3": "^2.8.0", "dayjs": "^1.11.6", "feather-icons": "^4.28.0", - "frappe-ui": "^0.1.118", + "frappe-ui": "^0.1.121", "highlight.js": "^11.11.1", "lucide-vue-next": "^0.383.0", "markdown-it": "^14.0.0", diff --git a/frontend/src/components/AppSidebar.vue b/frontend/src/components/AppSidebar.vue index 79d05006..2193c654 100644 --- a/frontend/src/components/AppSidebar.vue +++ b/frontend/src/components/AppSidebar.vue @@ -62,20 +62,41 @@ -
+
+ + + + diff --git a/frontend/src/components/BatchCourses.vue b/frontend/src/components/BatchCourses.vue index ebf2f8af..37972a72 100644 --- a/frontend/src/components/BatchCourses.vue +++ b/frontend/src/components/BatchCourses.vue @@ -63,6 +63,9 @@
+
+ {{ __('No courses added') }} +
@@ -34,11 +35,15 @@ import { Dialog, createResource } from 'frappe-ui' import { ref } from 'vue' import Link from '@/components/Controls/Link.vue' import { showToast } from '@/utils' +import { useOnboarding } from 'frappe-ui/frappe' +import { useSettings } from '@/stores/settings' const show = defineModel() const course = ref(null) const evaluator = ref(null) const courses = defineModel('courses') +const { updateOnboardingStep } = useOnboarding('learning') +const settingsStore = useSettings() const props = defineProps({ batch: { @@ -69,6 +74,7 @@ const addCourse = (close) => { { onSuccess() { courses.value.reload() + updateOnboardingStep('add_batch_course') close() course.value = null evaluator.value = null @@ -79,4 +85,10 @@ const addCourse = (close) => { } ) } + +const openSettings = (close) => { + close() + settingsStore.activeTab = 'Categories' + settingsStore.isSettingsOpen = true +} diff --git a/frontend/src/components/Modals/ChapterModal.vue b/frontend/src/components/Modals/ChapterModal.vue index 5bbc44b2..7d3d3171 100644 --- a/frontend/src/components/Modals/ChapterModal.vue +++ b/frontend/src/components/Modals/ChapterModal.vue @@ -81,11 +81,11 @@ import { reactive, watch } from 'vue' import { showToast, getFileSize } from '@/utils/' import { capture } from '@/telemetry' import { FileText, X } from 'lucide-vue-next' -import { useSettings } from '@/stores/settings' +import { useOnboarding } from 'frappe-ui/frappe' const show = defineModel() const outline = defineModel('outline') -const settingsStore = useSettings() +const { updateOnboardingStep } = useOnboarding('learning') const props = defineProps({ course: { @@ -140,14 +140,12 @@ const addChapter = async (close) => { }, onSuccess: (data) => { capture('chapter_created') + updateOnboardingStep('create_first_chapter') chapterReference.submit( { name: data.name }, { onSuccess(data) { cleanChapter() - /* if (!settingsStore.onboardingDetails.data?.is_onboarded) { - settingsStore.onboardingDetails.reload() - } */ outline.value.reload() showToast( __('Success'), diff --git a/frontend/src/components/Modals/StudentModal.vue b/frontend/src/components/Modals/StudentModal.vue index 242d0f87..6afd4ae9 100644 --- a/frontend/src/components/Modals/StudentModal.vue +++ b/frontend/src/components/Modals/StudentModal.vue @@ -29,9 +29,11 @@ import { Dialog, createResource } from 'frappe-ui' import { ref } from 'vue' import Link from '@/components/Controls/Link.vue' import { showToast } from '@/utils' +import { useOnboarding } from 'frappe-ui/frappe' const students = defineModel('reloadStudents') const student = ref() +const { updateOnboardingStep } = useOnboarding('learning') const show = defineModel() const props = defineProps({ @@ -61,6 +63,7 @@ const addStudent = (close) => { onSuccess() { students.value.reload() student.value = null + updateOnboardingStep('add_batch_student') close() }, onError(err) { diff --git a/frontend/src/pages/Batch.vue b/frontend/src/pages/Batch.vue index 7d2f9724..eec3c417 100644 --- a/frontend/src/pages/Batch.vue +++ b/frontend/src/pages/Batch.vue @@ -190,11 +190,15 @@
- +