fix: progress

This commit is contained in:
Jannat Patel
2024-04-03 12:11:34 +05:30
parent c7bdf68bc6
commit 5de7f5e283
9 changed files with 68 additions and 35 deletions

View File

@@ -21,32 +21,29 @@
<div class="flex flex-col flex-auto p-4">
<div class="flex items-center justify-between mb-2">
<div v-if="course.lesson_count">
<Tooltip
:text="__('Lessons')"
class="flex items-center space-x-1 py-1"
>
<BookOpen class="h-4 w-4 stroke-1.5 text-gray-700" />
<span> {{ course.lesson_count }} </span>
<Tooltip :text="__('Lessons')">
<span class="flex items-center">
<BookOpen class="h-4 w-4 stroke-1.5 text-gray-700 mr-1" />
{{ course.lesson_count }}
</span>
</Tooltip>
</div>
<div v-if="course.enrollment_count">
<Tooltip
:text="__('Enrolled Students')"
class="flex items-center space-x-1 py-1"
>
<Users class="h-4 w-4 stroke-1.5 text-gray-700" />
<span> {{ course.enrollment_count }} </span>
<Tooltip :text="__('Enrolled Students')">
<span class="flex items-center">
<Users class="h-4 w-4 stroke-1.5 text-gray-700 mr-1" />
{{ course.enrollment_count }}
</span>
</Tooltip>
</div>
<div v-if="course.avg_rating">
<Tooltip
:text="__('Average Rating')"
class="flex items-center space-x-1 py-1"
>
<Star class="h-4 w-4 stroke-1.5 text-gray-700" />
<span> {{ course.avg_rating }} </span>
<Tooltip :text="__('Average Rating')">
<span class="flex items-center">
<Star class="h-4 w-4 stroke-1.5 text-gray-700 mr-1" />
{{ course.avg_rating }}
</span>
</Tooltip>
</div>

View File

@@ -65,6 +65,10 @@
class="h-4 w-4 text-gray-900 stroke-1 mr-2"
/>
{{ lesson.title }}
<Check
v-if="lesson.is_complete"
class="h-4 w-4 text-green-500 stroke-1.5 ml-2"
/>
</div>
</router-link>
</div>
@@ -108,6 +112,7 @@ import {
MonitorPlay,
HelpCircle,
FileText,
Check,
} from 'lucide-vue-next'
import { useRoute } from 'vue-router'
import ChapterModal from '@/components/Modals/ChapterModal.vue'

View File

@@ -230,6 +230,8 @@ const lesson = createResource({
name: data.membership.name,
lesson_name: data.name,
})
markProgress(data)
if (data.content) editor = renderEditor('editor', data.content)
if (data.instructor_content)
@@ -237,8 +239,6 @@ const lesson = createResource({
'instructor-content',
data.instructor_content
)
markProgress(data)
},
})
@@ -253,9 +253,7 @@ const renderEditor = (holder, content) => {
}
const markProgress = (data) => {
setTimeout(() => {
if (!data.progress) progress.submit()
}, 60000)
if (!data.progress) progress.submit()
}
const current_lesson = createResource({