-
Notifications
You must be signed in to change notification settings - Fork 529
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1151 from frappe/develop
chore: merge 'develop' into 'main'
- Loading branch information
Showing
43 changed files
with
2,416 additions
and
963 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
<template> | ||
<div v-if="showOnboardingBanner && onboardingDetails.data"> | ||
<Tooltip :text="__('Skip Onboarding')" placement="left"> | ||
<X | ||
class="w-4 h-4 stroke-1 absolute top-2 right-2 cursor-pointer mr-1" | ||
@click="skipOnboarding.reload()" | ||
/> | ||
</Tooltip> | ||
<div class="flex items-center justify-evenly bg-gray-100 p-10"> | ||
<div | ||
@click="redirectToCourseForm()" | ||
class="flex items-center space-x-2" | ||
:class="{ | ||
'cursor-pointer': !onboardingDetails.data.course_created.length, | ||
}" | ||
> | ||
<span | ||
v-if="onboardingDetails.data.course_created.length" | ||
class="py-1 px-1 bg-white rounded-full" | ||
> | ||
<Check class="h-4 w-4 stroke-2 text-green-600" /> | ||
</span> | ||
<span v-else class="font-semibold bg-white px-2 py-1 rounded-full"> | ||
1 | ||
</span> | ||
<span class="text-lg font-semibold"> | ||
{{ __('Create a course') }} | ||
</span> | ||
</div> | ||
<div | ||
@click="redirectToChapterForm()" | ||
class="flex items-center space-x-2" | ||
:class="{ | ||
'cursor-pointer': | ||
onboardingDetails.data.course_created.length && | ||
!onboardingDetails.data.chapter_created.length, | ||
'text-gray-400': !onboardingDetails.data.course_created.length, | ||
}" | ||
> | ||
<span | ||
v-if="onboardingDetails.data.chapter_created.length" | ||
class="py-1 px-1 bg-white rounded-full" | ||
> | ||
<Check class="h-4 w-4 stroke-2 text-green-600" /> | ||
</span> | ||
<span v-else class="font-semibold bg-white px-2 py-1 rounded-full"> | ||
2 | ||
</span> | ||
<span class="text-lg font-semibold"> | ||
{{ __('Add a chapter') }} | ||
</span> | ||
</div> | ||
<div | ||
@click="redirectToLessonForm()" | ||
class="flex items-center space-x-2" | ||
:class="{ | ||
'cursor-pointer': | ||
onboardingDetails.data.course_created.length && | ||
onboardingDetails.data.chapter_created.length, | ||
'text-gray-400': | ||
!onboardingDetails.data.course_created.length || | ||
!onboardingDetails.data.chapter_created.length, | ||
}" | ||
> | ||
<span | ||
v-if="onboardingDetails.data.lesson_created.length" | ||
class="py-1 px-1 bg-white rounded-full" | ||
> | ||
<Check class="h-4 w-4 stroke-2 text-green-600" /> | ||
</span> | ||
<span class="font-semibold bg-white px-2 py-1 rounded-full"> 3 </span> | ||
<span class="text-lg font-semibold"> | ||
{{ __('Add a lesson') }} | ||
</span> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
<script setup lang="ts"> | ||
import { ref, watch } from 'vue' | ||
import { Check, X } from 'lucide-vue-next' | ||
import { useRouter } from 'vue-router' | ||
import { useSettings } from '@/stores/settings' | ||
import { createResource, Tooltip } from 'frappe-ui' | ||
const showOnboardingBanner = ref(false) | ||
const settings = useSettings() | ||
const onboardingDetails = settings.onboardingDetails | ||
const router = useRouter() | ||
watch(onboardingDetails, () => { | ||
if (!onboardingDetails.data?.is_onboarded) { | ||
showOnboardingBanner.value = true | ||
} else { | ||
showOnboardingBanner.value = false | ||
} | ||
}) | ||
const redirectToCourseForm = () => { | ||
if (onboardingDetails.data?.course_created.length) { | ||
return | ||
} else { | ||
router.push({ name: 'CourseForm', params: { courseName: 'new' } }) | ||
} | ||
} | ||
const redirectToChapterForm = () => { | ||
if (!onboardingDetails.data?.course_created.length) { | ||
return | ||
} else { | ||
router.push({ | ||
name: 'CourseForm', | ||
params: { | ||
courseName: onboardingDetails.data?.first_course, | ||
}, | ||
}) | ||
} | ||
} | ||
const redirectToLessonForm = () => { | ||
if (!onboardingDetails.data?.course_created.length) { | ||
return | ||
} else if (!onboardingDetails.data?.chapter_created.length) { | ||
return | ||
} else { | ||
router.push({ | ||
name: 'LessonForm', | ||
params: { | ||
courseName: onboardingDetails.data?.first_course, | ||
chapterNumber: 1, | ||
lessonNumber: 1, | ||
}, | ||
}) | ||
} | ||
} | ||
const skipOnboarding = createResource({ | ||
url: 'frappe.client.set_value', | ||
makeParams() { | ||
return { | ||
doctype: 'LMS Settings', | ||
name: 'LMS Settings', | ||
fieldname: 'is_onboarding_complete', | ||
value: 1, | ||
} | ||
}, | ||
onSuccess(data) { | ||
onboardingDetails.reload() | ||
}, | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.