fix: don't update onboarding status if user is not system manager

This commit is contained in:
Jannat Patel
2025-04-10 15:37:59 +05:30
parent 8e405bc8eb
commit 1a5d8ce07e
17 changed files with 115 additions and 55 deletions

View File

@@ -430,10 +430,13 @@ const createNewBatch = () => {
{},
{
onSuccess(data) {
if (user.data?.is_system_manager) {
updateOnboardingStep('create_first_batch', true, false, () => {
localStorage.setItem('firstBatch', data.name)
})
}
capture('batch_created')
updateOnboardingStep('create_first_batch', true, false, () => {
localStorage.setItem('firstBatch', data.name)
})
router.push({
name: 'BatchDetail',
params: {

View File

@@ -3,15 +3,11 @@
<div class="grid md:grid-cols-[70%,30%] h-full">
<div>
<header
class="sticky top-0 z-10 group flex flex-col md:flex-row md:items-center justify-between border-b bg-surface-white px-3 py-2.5 sm:px-5"
class="sticky top-0 z-10 flex flex-col md:flex-row md:items-center justify-between border-b bg-surface-white px-3 py-2.5 sm:px-5"
>
<Breadcrumbs class="h-7" :items="breadcrumbs" />
<div class="flex items-center mt-3 md:mt-0">
<Button
v-if="courseResource.data?.name"
@click="trashCourse()"
class="invisible group-hover:visible"
>
<Button v-if="courseResource.data?.name" @click="trashCourse()">
<template #icon>
<Trash2 class="w-4 h-4 stroke-1.5" />
</template>
@@ -265,7 +261,7 @@ import {
watch,
getCurrentInstance,
} from 'vue'
import { showToast, updateDocumentTitle } from '@/utils'
import { showToast } from '@/utils'
import { Image, Trash2, X } from 'lucide-vue-next'
import { useRouter } from 'vue-router'
import { capture } from '@/telemetry'
@@ -404,7 +400,7 @@ const courseResource = createResource({
'paid_course',
'featured',
'enable_certification',
'paid_certifiate',
'paid_certificate',
]
for (let idx in checkboxes) {
let key = checkboxes[idx]
@@ -447,11 +443,14 @@ const submitCourse = () => {
} else {
courseCreationResource.submit(course, {
onSuccess(data) {
if (user.data?.is_system_manager) {
updateOnboardingStep('create_first_course', true, false, () => {
localStorage.setItem('firstCourse', data.name)
})
}
capture('course_created')
showToast('Success', 'Course created successfully', 'check')
updateOnboardingStep('create_first_course', true, false, () => {
localStorage.setItem('firstCourse', data.name)
})
router.push({
name: 'CourseForm',
params: { courseName: data.name },

View File

@@ -4,7 +4,7 @@
>
<Breadcrumbs :items="breadcrumbs" />
<router-link
v-if="user.data?.is_moderator"
v-if="canCreateCourse()"
:to="{
name: 'CourseForm',
params: { courseName: 'new' },
@@ -105,6 +105,7 @@ import {
import { computed, inject, onMounted, ref, watch } from 'vue'
import { BookOpen, Plus } from 'lucide-vue-next'
import { sessionStore } from '@/stores/session'
import { canCreateCourse } from '@/utils'
import CourseCard from '@/components/CourseCard.vue'
const user = inject('$user')

View File

@@ -25,7 +25,7 @@
</router-link>
</header>
<div>
<div class="p-5">
<div v-if="jobs.data?.length" class="p-5">
<div
class="flex flex-col lg:flex-row space-y-4 lg:space-y-0 lg:items-center justify-between mb-5"
>
@@ -58,10 +58,7 @@
</div>
</div>
<div
v-if="jobs.data?.length"
class="grid grid-cols-1 lg:grid-cols-3 gap-5"
>
<div class="grid grid-cols-1 lg:grid-cols-3 gap-5">
<router-link
v-for="job in jobs.data"
:to="{
@@ -73,8 +70,21 @@
<JobCard :job="job" />
</router-link>
</div>
<div v-else class="text-ink-gray-7 italic p-5 w-fit mx-auto">
{{ __('No jobs posted') }}
</div>
<div
v-else
class="flex flex-col items-center justify-center text-sm text-ink-gray-5 mt-48"
>
<Laptop class="size-10 mx-auto stroke-1 text-ink-gray-4" />
<div class="text-lg font-medium mb-1">
{{ __('No jobs found') }}
</div>
<div class="leading-5 w-2/5 text-center">
{{
__(
'There are no jobs available at the moment. Open a job opportunity or check here again later.'
)
}}
</div>
</div>
</div>
@@ -88,7 +98,7 @@ import {
FormControl,
usePageMeta,
} from 'frappe-ui'
import { Plus, Search } from 'lucide-vue-next'
import { Laptop, Plus, Search } from 'lucide-vue-next'
import { sessionStore } from '../stores/session'
import { inject, computed, ref, onMounted } from 'vue'
import JobCard from '@/components/JobCard.vue'

View File

@@ -402,8 +402,10 @@ const createNewLesson = () => {
{ lesson: data.name },
{
onSuccess() {
if (user.data?.is_system_manager)
updateOnboardingStep('create_first_lesson')
capture('lesson_created')
updateOnboardingStep('create_first_lesson')
showToast('Success', 'Lesson created successfully', 'check')
lessonDetails.reload()
},