From aa979b96f2ceedc2a505699d08ed79e129ac3b85 Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Wed, 26 Mar 2025 13:08:06 +0530 Subject: [PATCH 1/4] 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 @@
- + diff --git a/frontend/src/components/Icons/BatchIcon.vue b/frontend/src/components/Icons/BatchIcon.vue deleted file mode 100644 index 0156adbf..00000000 --- a/frontend/src/components/Icons/BatchIcon.vue +++ /dev/null @@ -1,23 +0,0 @@ - diff --git a/frontend/src/components/Icons/InviteIcon.vue b/frontend/src/components/Icons/InviteIcon.vue new file mode 100644 index 00000000..94810039 --- /dev/null +++ b/frontend/src/components/Icons/InviteIcon.vue @@ -0,0 +1,17 @@ + + \ No newline at end of file diff --git a/frontend/src/components/LessonContent.vue b/frontend/src/components/LessonContent.vue index 736367af..2bb686c4 100644 --- a/frontend/src/components/LessonContent.vue +++ b/frontend/src/components/LessonContent.vue @@ -4,7 +4,7 @@ class="youtube-video" :src="getYouTubeVideoSource(youtube.split('/').pop())" width="100%" - height="400" + :height="screenSize.width < 640 ? 200 : 400" frameborder="0" allowfullscreen > @@ -15,7 +15,7 @@ class="youtube-video" :src="getYouTubeVideoSource(block)" width="100%" - height="400" + :height="screenSize.width < 640 ? 200 : 400" frameborder="0" allowfullscreen > @@ -66,6 +66,9 @@ diff --git a/frontend/src/components/Modals/Question.vue b/frontend/src/components/Modals/Question.vue index 7ab280bd..28ca4f96 100644 --- a/frontend/src/components/Modals/Question.vue +++ b/frontend/src/components/Modals/Question.vue @@ -109,11 +109,13 @@ import { Dialog, FormControl, TextEditor, createResource } from 'frappe-ui' import { computed, watch, reactive, ref } from 'vue' import Link from '@/components/Controls/Link.vue' import { showToast } from '@/utils' +import { useOnboarding } from 'frappe-ui/frappe' const show = defineModel() const quiz = defineModel('quiz') const questionType = ref(null) const editMode = ref(false) +const { updateOnboardingStep } = useOnboarding('learning') const existingQuestion = reactive({ question: '', @@ -122,7 +124,7 @@ const existingQuestion = reactive({ const question = reactive({ question: '', type: 'Choices', - marks: 0, + marks: 1, }) const populateFields = () => { @@ -261,6 +263,7 @@ const addQuestionRow = (question, close) => { { onSuccess() { show.value = false + updateOnboardingStep('create_first_quiz') showToast(__('Success'), __('Question added successfully'), 'check') quiz.value.reload() close() diff --git a/frontend/src/components/Modals/Settings.vue b/frontend/src/components/Modals/Settings.vue index f4c11d4f..fb9aaff7 100644 --- a/frontend/src/components/Modals/Settings.vue +++ b/frontend/src/components/Modals/Settings.vue @@ -40,6 +40,12 @@ :description="activeTab.description" v-model:show="show" /> + { description: 'Manage the members of your learning system', icon: 'UserRoundPlus', }, + { + label: 'Evaluators', + description: 'Manage the evaluators of your learning system', + icon: 'UserCheck', + }, { label: 'Categories', description: 'Manage the members of your learning system', diff --git a/frontend/src/pages/CourseDetail.vue b/frontend/src/pages/CourseDetail.vue index 56c9fc6b..2d47f37c 100644 --- a/frontend/src/pages/CourseDetail.vue +++ b/frontend/src/pages/CourseDetail.vue @@ -56,7 +56,7 @@ -
+
-
+
-