|
|
|
@ -3,6 +3,8 @@ |
|
|
|
|
|
|
|
|
|
<hr /> |
|
|
|
|
|
|
|
|
|
<div class="relative min-h-[300px]"> |
|
|
|
|
<Loading :visible="!isFullyLoaded" /> |
|
|
|
|
<div |
|
|
|
|
v-if="isLoading && courses.length === 0" |
|
|
|
|
class="grid gap-4 grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4" |
|
|
|
@ -30,11 +32,12 @@ |
|
|
|
|
<div ref="lastCourseRef"></div> |
|
|
|
|
</div> |
|
|
|
|
<EmptyState |
|
|
|
|
v-else-if="!isLoading && 0 === courses.length" |
|
|
|
|
v-else-if="!isLoading && courses.length === 0" |
|
|
|
|
:detail="t('Go to Explore to find a topic of interest, or wait for someone to subscribe you')" |
|
|
|
|
:summary="t('You don\'t have any course yet.')" |
|
|
|
|
icon="courses" |
|
|
|
|
/> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script setup> |
|
|
|
@ -47,12 +50,14 @@ import StickyCourses from "../../../views/user/courses/StickyCourses.vue" |
|
|
|
|
import CourseCardList from "../../../components/course/CourseCardList.vue" |
|
|
|
|
import EmptyState from "../../../components/EmptyState" |
|
|
|
|
import { useSecurityStore } from "../../../store/securityStore" |
|
|
|
|
import Loading from "../../../components/Loading.vue" |
|
|
|
|
|
|
|
|
|
const securityStore = useSecurityStore() |
|
|
|
|
const { t } = useI18n() |
|
|
|
|
|
|
|
|
|
const courses = ref([]) |
|
|
|
|
const isLoading = ref(false) |
|
|
|
|
const isFullyLoaded = ref(false) |
|
|
|
|
const endCursor = ref(null) |
|
|
|
|
const hasMore = ref(true) |
|
|
|
|
const lastCourseRef = ref(null) |
|
|
|
@ -82,6 +87,7 @@ watch(result, (newResult) => { |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
isLoading.value = false |
|
|
|
|
isFullyLoaded.value = true |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
const loadMoreCourses = () => { |
|
|
|
@ -134,6 +140,7 @@ onMounted(() => { |
|
|
|
|
endCursor.value = null |
|
|
|
|
hasMore.value = true |
|
|
|
|
isLoading.value = false |
|
|
|
|
isFullyLoaded.value = false |
|
|
|
|
|
|
|
|
|
if (observer) observer.disconnect() |
|
|
|
|
observer = new IntersectionObserver( |
|
|
|
|