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: Remove minted out collection from landing #10668

Merged
merged 4 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 2 additions & 2 deletions components/carousel/CarouselTypeDrops.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import type { Drop } from '@/components/drops/useDrops'
import { useDrops } from '@/components/drops/useDrops'

let queries = {
limit: 12,
limit: 14,
active: [true],
chain: ['ahp', 'base'],
}
Expand Down Expand Up @@ -63,7 +63,7 @@ const skeletonCount = computed(() =>
Number.isInteger(perView.value) ? perView.value : Math.ceil(perView.value),
)

const { drops, loaded: isReady } = useDrops(queries)
const { drops, loaded: isReady } = useDrops(queries, { filterOutMinted: true })
const dropsAlias = computed(() => drops.value.map(drop => drop.alias))

const onDropClick = ({ path, drop }: { path: string, drop: Drop }) => {
Expand Down
9 changes: 4 additions & 5 deletions components/drops/useDrops.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,19 @@ const DROP_LIST_ORDER = [

const ONE_DAYH_IN_MS = 24 * 60 * 60 * 1000

export function useDrops(query?: GetDropsQuery) {
export function useDrops(query?: GetDropsQuery, config?: { filterOutMinted?: boolean }) {
const drops = ref<Drop[]>([])
const dropsList = ref<DropItem[]>([])
const { filterOutMinted } = config || {}
const count = computed(() => dropsList.value.length)
const loaded = ref(false)

onBeforeMount(async () => {
dropsList.value = await getDrops(query)

const formattedDrops = await Promise.all(
drops.value = await Promise.all(
dropsList.value.map(async drop => getFormattedDropItem(drop, drop)),
)

drops.value = formattedDrops
).then(dropsList => filterOutMinted ? dropsList.filter(drop => !drop.isMintedOut) : dropsList)

loaded.value = true
})
Expand Down
Loading