Skip to content

Commit

Permalink
Merge pull request #11037 from Jarsen136/issue-11034
Browse files Browse the repository at this point in the history
fix: Drop calendar: Collection with price that is not set should be TBA
  • Loading branch information
vikiival authored Sep 24, 2024
2 parents e0d4710 + 61181d1 commit dd58c10
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
6 changes: 5 additions & 1 deletion components/drops/BasicDropCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,11 @@
</span>
</div>
</slot>
<div v-if="isTBA(dropPrice)">
<span>TBA</span>
</div>
<div
v-if="Number(dropPrice)"
v-else-if="Number(dropPrice)"
class="flex gap-1 items-baseline"
>
<span>{{ formattedPrice }}</span><span class="text-k-grey text-xs">USD</span>
Expand Down Expand Up @@ -98,6 +101,7 @@ import { NeoIcon } from '@kodadot1/brick'
import type { Prefix } from '@kodadot1/static'
import type { DropStatus } from '@/components/drops/useDrops'
import { chainPropListOf } from '@/utils/config/chain.config'
import { isTBA } from '@/components/drops/utils'
const emit = defineEmits(['click'])
const props = withDefaults(
Expand Down
3 changes: 2 additions & 1 deletion components/drops/calendar/DropPreviewModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ import { format } from 'date-fns'
import type { InternalDropCalendar } from './DropsCalendar.vue'
import { useCollectionMinimal } from '@/components/collection/utils/useCollectionDetails'
import { chainPropListOf } from '@/utils/config/chain.config'
import { isTBA } from '@/components/drops/utils'
const NuxtLink = resolveComponent('NuxtLink')
const placeholder = 'TBA'
Expand Down Expand Up @@ -210,5 +211,5 @@ const formattedDate = computed(() =>
)
const withPlaceholder = (nullableValue: unknown, or: unknown) =>
nullableValue === null ? placeholder : or
isTBA(nullableValue) ? placeholder : or
</script>
2 changes: 2 additions & 0 deletions components/drops/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,5 @@ export async function getDropAttributes(alias: string): Promise<DropItem | undef
status: getLocalDropStatus(drop),
}
}

export const isTBA = (price: unknown) => price === null || price === ''

0 comments on commit dd58c10

Please sign in to comment.