Skip to content

Commit

Permalink
Merge pull request #6396 from kodadot/6390-another-form
Browse files Browse the repository at this point in the history
  • Loading branch information
yangwao authored Jul 5, 2023
2 parents ceb041e + 5766b51 commit f8cb57b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 16 deletions.
12 changes: 8 additions & 4 deletions components/drops/DropCard.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<template>
<div class="drop-card border card-border-color">
<nuxt-link
<component
:is="externalUrl ? 'a' : 'nuxt-link'"
v-if="drop.collection && !isLoadingMeta"
:href="externalUrl"
rel="nofollow noopener noreferrer"
:to="`/${correctUrlPrefix}/drops/${correctDropUrl}`">
<div
class="drop-card-banner"
Expand All @@ -25,7 +28,7 @@
class="is-flex is-justify-content-space-between flex-direction column-gap">
<div class="is-flex is-flex-direction-column column-gap">
<span class="has-text-weight-bold">{{ drop.collection.name }}</span>
<div class="is-flex">
<div v-if="drop.collection.issuer" class="is-flex">
<div class="mr-2 has-text-grey">
{{ $t('activity.creator') }}:
</div>
Expand Down Expand Up @@ -54,7 +57,7 @@
</div>
</div>
</div>
</nuxt-link>
</component>

<template v-else>
<NeoSkeleton no-margin :rounded="false" height="112px" />
Expand All @@ -70,7 +73,6 @@ import { sanitizeIpfsUrl } from '@/utils/ipfs'
import BasicImage from '@/components/shared/view/BasicImage.vue'
import type { Metadata } from '@/components/rmrk/service/scheme'
import { sum } from '@/utils/math'
import TimeTag from './TimeTag.vue'
import { Drop } from './useDrops'
Expand All @@ -85,6 +87,7 @@ interface Props {
const props = defineProps<Props>()
const image = ref('')
const externalUrl = ref('')
const correctUrlPrefix = computed(() => {
return props.overrideUrlPrefix || urlPrefix.value
Expand Down Expand Up @@ -113,6 +116,7 @@ onMounted(async () => {
image.value = sanitizeIpfsUrl(
metadata.image || metadata.thumbnailUri || metadata.mediaUri || ''
)
externalUrl.value = metadata.external_url || ''
isLoadingMeta.value = false
})
</script>
Expand Down
31 changes: 19 additions & 12 deletions components/drops/useDrops.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,20 @@ interface DropsData {
futureDrops: Drop[]
}

const futureDate = new Date()
futureDate.setDate(futureDate.getDate() * 7) // i weeks in the future

const dummyDrop: Drop = {
collection: {
name: 'Create your own drop page',
metadata:
'ipfs://ipfs/bafkreidvb2my5vj6jgpbrwa7dfw55tryhfk7um5inuxnz7y7khqse2thjq',
} as any,
minted: 0,
max: 300,
dropStartTime: futureDate,
}

export function useDrops(collectionId: string, clientName?: string) {
const dropsData = ref<DropsData>({
drops: [],
Expand All @@ -37,22 +51,15 @@ export function useDrops(collectionId: string, clientName?: string) {
dropStartTime: new Date(2023, 5, 6),
})

// const futureDrops: Drop[] = []
// for (let i = 1; i <= 4; i++) {
// const futureDate = new Date(now)
// futureDate.setDate(now.getDate() + i * 7) // i weeks in the future
// futureDrops.push({
// collection: collectionEntity,
// minted: nftEntitiesConnection.totalCount,
// max: collectionEntity.max || 300,
// dropStartTime: futureDate,
// })
// }
const futureDrops: Drop[] = []
if (!clientName) {
futureDrops.push(dummyDrop)
}

dropsData.value = {
...dropsData.value,
drops,
// futureDrops,
futureDrops,
}
}
})
Expand Down

0 comments on commit f8cb57b

Please sign in to comment.