|
|
|
@ -1,5 +1,9 @@
|
|
|
|
|
<script setup lang="ts"> |
|
|
|
|
const { loadFeed, githubFeed, isErrorOccurred } = useProductFeed() |
|
|
|
|
const props = defineProps<{ |
|
|
|
|
type: 'github' | 'cloud' |
|
|
|
|
}>() |
|
|
|
|
|
|
|
|
|
const { loadFeed, githubFeed, isErrorOccurred, cloudFeed } = useProductFeed() |
|
|
|
|
|
|
|
|
|
const scrollContainer = ref<HTMLElement>() |
|
|
|
|
|
|
|
|
@ -8,12 +12,16 @@ const { isLoading } = useInfiniteScroll(
|
|
|
|
|
async () => { |
|
|
|
|
if (isLoading.value) return |
|
|
|
|
await loadFeed({ |
|
|
|
|
type: 'github', |
|
|
|
|
type: props.type, |
|
|
|
|
loadMore: true, |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
{ distance: 4 }, |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
const feeds = computed(() => { |
|
|
|
|
return props.type === 'github' ? githubFeed.value : cloudFeed.value |
|
|
|
|
}) |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
@ -24,15 +32,18 @@ const { isLoading } = useInfiniteScroll(
|
|
|
|
|
}" |
|
|
|
|
class="overflow-y-auto nc-scrollbar-md mx-auto w-full" |
|
|
|
|
> |
|
|
|
|
<div v-if="isErrorOccurred?.github && !githubFeed.length" class="h-full flex justify-center items-center"> |
|
|
|
|
<FeedError page="github" /> |
|
|
|
|
<div |
|
|
|
|
v-if="(props.type === 'github' ? isErrorOccurred.github : isErrorOccurred.cloud) && !feeds.length" |
|
|
|
|
class="h-full flex justify-center items-center" |
|
|
|
|
> |
|
|
|
|
<FeedError :page="type" /> |
|
|
|
|
</div> |
|
|
|
|
<div v-else-if="isLoading && !githubFeed.length" class="flex items-center justify-center h-full w-full"> |
|
|
|
|
<div v-else-if="isLoading && !feeds.length" class="flex items-center justify-center h-full w-full"> |
|
|
|
|
<GeneralLoader size="xlarge" /> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<div v-else class="mx-auto max-w-[540px] xl:max-w-[638px] justify-around justify-items-center"> |
|
|
|
|
<FeedChangelogItem v-for="(feed, index) in githubFeed" :key="feed.Id" :item="feed" :index="index" /> |
|
|
|
|
<FeedChangelogItem v-for="(item, index) in feeds" :key="item.Id" :item="item" :index="index" /> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|