Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: base /drops grid not loading #10771

Merged
merged 3 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions components/drops/Drops.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
:drops="currentDrops"
:loaded="loaded"
:default-skeleton-count="DEFAULT_SKELETON_COUNT"
:async-skeleton-count="Math.round((count/2) - currentDrops.length)"
:async-skeleton-count="asyncSkeletonCountOf(currentDrops.length)"
skeleton-key="current-drops-skeleton"
/>

Expand All @@ -56,7 +56,7 @@
:drops="pastDrops"
:loaded="loaded"
:default-skeleton-count="DEFAULT_SKELETON_COUNT"
:async-skeleton-count="Math.round((count/2) - pastDrops.length)"
:async-skeleton-count="asyncSkeletonCountOf(pastDrops.length)"
skeleton-key="skeleton"
/>

Expand Down Expand Up @@ -96,6 +96,8 @@ const pastDrops = computed(() =>
filter(drops.value, { status: DropStatus.MINTING_ENDED }),
)

const asyncSkeletonCountOf = (amount: number) => count.value ? Math.max(0, Math.round((count.value) / 2) - amount) : DEFAULT_SKELETON_COUNT

const checkRouteAvailability = () => {
if (!dropsVisible(urlPrefix.value)) {
navigateTo('/')
Expand Down
8 changes: 5 additions & 3 deletions components/drops/DropsGrid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
persist
>
<template
v-if="asyncSkeletonCount ? true : loaded"
v-if="isAsync || loaded"
>
<div
v-for="(drop, index) in drops"
Expand All @@ -23,7 +23,7 @@
</template>
<template v-if="!loaded">
<DropsDropCardSkeleton
v-for="x in asyncSkeletonCount || defaultSkeletonCount"
v-for="x in isAsync ? asyncSkeletonCount : defaultSkeletonCount"
:key="`${skeletonKey}-${x}`"
/>
</template>
Expand All @@ -41,7 +41,7 @@ const GRID_DEFAULT_WIDTH = {
large: 0,
}

defineProps<{
const props = defineProps<{
drops: Drop[] | InternalDropCalendar[]
loaded: boolean
defaultSkeletonCount: number
Expand All @@ -50,6 +50,8 @@ defineProps<{
clickable?: boolean
}>()

const isAsync = computed(() => typeof props.asyncSkeletonCount === 'number')

const isDrop = (item: Drop | InternalDropCalendar): item is Drop =>
(item as Drop).collection !== undefined
</script>
Loading