Skip to content

Commit

Permalink
Merge branch 'main' into fix/seo/bsx
Browse files Browse the repository at this point in the history
  • Loading branch information
roiLeo committed Jul 5, 2022
2 parents 806afb6 + d2953ed commit 7852b5b
Show file tree
Hide file tree
Showing 26 changed files with 1,060 additions and 165 deletions.
18 changes: 9 additions & 9 deletions .github/ISSUE_TEMPLATE/feature.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
name: Feature Request
name: Feature Request / User Experience
description: Suggest an idea for KodaDot to be better for your friends
title: "Be descriptive and short"
labels: ["enhancement"]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this feature request!
Thanks for taking the time to fill out this feature request, it would help us upgrade user experience for others users like you!
- type: textarea
id: feature-request
attributes:
label: Is your feature request related to a problem?
description: A clear and concise description of what the problem is
placeholder: I'm always frustrated when [...]
value: "I'm always frustrated when [...]"
validations:
required: true
- type: textarea
Expand All @@ -22,7 +21,6 @@ body:
label: Describe the solution you would like
description: A clear and concise description of what you want to happen.
placeholder: I would like to see
value: "I would like to see"
validations:
required: true
- type: textarea
Expand All @@ -31,15 +29,17 @@ body:
label: Describe alternatives you have considered
description: A clear and concise description of any alternative solutions or features you have considered.
placeholder: I have tried this alternative
value: "I have tried this alternative"
validations:
required: true
- type: textarea
id: screenshots
attributes:
label: Screeenshots
description: Sometimes, visuals are much better than words
description: Most times, visuals are much better than words
placeholder: Paste your vision
value: "Paste your vision"
validations:
required: true
- type: textarea
id: relatedissues
attributes:
label: Are there opened related issues?
description: Linking it with existing issue would help us sort out things faster on our side
placeholder: Link to Github issue in our repository or from elsewhere helps a lot!
21 changes: 19 additions & 2 deletions components/bsx/Create/CreateToken.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@
:hasEdition="false">
<template v-slot:main>
<BasicSwitch key="nsfw" v-model="nsfw" label="mint.nfsw" />
<BasicSwitch key="listed" v-model="listed" label="mint.listForSale" />
<BalanceInput
v-if="listed"
label="Price"
expanded
key="price"
value="0.1"
@input="updatePrice"
class="mb-3" />
<CustomAttributeInput
Expand Down Expand Up @@ -127,14 +130,21 @@ export default class CreateToken extends mixins(
protected depositPerByte = BigInt(0)
protected attributes: Attribute[] = []
protected nsfw = false
protected price: string | number = 0
protected price: string | number = 0.1
protected listed = true
protected royalty: Royalty = {
amount: 0,
address: '',
}
protected updatePrice(value: number) {
protected updatePrice(value: string) {
this.price = value
if (parseFloat(value) === 0 && this.listed) {
showNotification(
'In order to list NFT, price has to be more than 0',
notificationTypes.info
)
}
}
get hasPrice() {
Expand All @@ -156,6 +166,13 @@ export default class CreateToken extends mixins(
}
}
@Watch('listed', { immediate: true })
onListedChange(value: boolean, oldVal: boolean) {
if (value === oldVal) {
return
}
this.price = value ? 0.1 : 0
}
public async fetchCollections() {
const query = await resolveQueryPath(this.urlPrefix, 'collectionForMint')
const collections = await this.$apollo.query({
Expand Down
2 changes: 0 additions & 2 deletions components/bsx/Create/RoyaltyForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ import {
Component,
Emit,
mixins,
Prop,
PropSync,
Vue,
Watch,
} from 'nuxt-property-decorator'
import AuthMixin from '~/utils/mixins/authMixin'
Expand Down
35 changes: 34 additions & 1 deletion components/bsx/Gallery/Item/AvailableActions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
<ActionList
v-if="accountId"
:actions="actions"
:isMakeOffersAllowed="isMakeOffersAllowed"
:isMakeOffersAllowed="!isMakeOffersDisabled"
:tooltipOfferLabel="tooltipOfferLabel"
@click="handleAction" />
<component
class="mb-4"
Expand Down Expand Up @@ -38,6 +39,8 @@ import {
import shouldUpdate from '@/utils/shouldUpdate'
import Connector from '@kodadot1/sub-api'
import { Component, mixins, Prop } from 'nuxt-property-decorator'
import formatBalance from '@/utils/formatBalance'
import onApiConnect from '@/utils/api/general'
const components = {
ActionList: () => import('@/components/rmrk/Gallery/Item/ActionList.vue'),
Expand All @@ -64,6 +67,14 @@ export default class AvailableActions extends mixins(
private selectedAction: ShoppingActions | '' = ''
private meta: string | number = ''
public minimumOfferAmount = 0
public isMakeOffersDisabled = true
public tooltipOfferLabel = {}
get balance(): number {
return Number(this.$store.getters.getAuthBalance)
}
get actions() {
return getActionList('bsx', this.isOwner, this.isAvailableToBuy)
}
Expand Down Expand Up @@ -98,6 +109,28 @@ export default class AvailableActions extends mixins(
return actionComponent[this.selectedAction]
}
public async created(): Promise<void> {
onApiConnect(() => {
const { api } = Connector.getInstance()
this.minimumOfferAmount = parseFloat(
formatBalance(
api?.consts?.marketplace?.minimumOfferAmount?.toString(),
12,
false
).replace(/,/g, '')
)
this.isMakeOffersDisabled =
!this.isMakeOffersAllowed || this.minimumOfferAmount > this.balance
if (!this.isMakeOffersAllowed) {
this.tooltipOfferLabel = this.$t('tooltip.makeOfferDisabled')
} else if (this.minimumOfferAmount > this.balance) {
this.tooltipOfferLabel = this.$t('tooltip.makeOfferNotEnoughBalance')
}
})
}
protected iconType(value: string) {
return iconResolver[value]
}
Expand Down
4 changes: 2 additions & 2 deletions components/bsx/Gallery/Item/GalleryItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,10 @@ export default class GalleryItem extends mixins(
? cachedMeta
: await fetchNFTMetadata(
this.nft,
getSanitizer(this.nft.metadata, 'cloudflare', 'permafrost')
getSanitizer(this.nft.metadata, 'pinata', 'permafrost')
)
const imageSanitizer = getSanitizer(meta.image, 'cloudflare')
const imageSanitizer = getSanitizer(meta.image, 'pinata')
this.meta = {
...meta,
image: imageSanitizer(meta.image),
Expand Down
1 change: 1 addition & 0 deletions components/bsx/Offer/OfferList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export default class OfferList extends mixins(
notificationTypes.success
)
})
this.fetchOffers()
} catch (e: any) {
showNotification(`[OFFER::ERR] ${e}`, notificationTypes.danger)
this.$consola.error(e)
Expand Down
18 changes: 10 additions & 8 deletions components/bsx/Offer/OfferTable.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<b-table :data="offers">
<b-table-column
cell-class="is-vcentered"
cell-class="is-vcentered is-narrow"
field="caller"
:label="$t('offer.caller')"
v-slot="props"
Expand All @@ -12,7 +12,7 @@
</b-table-column>

<b-table-column
cell-class="is-vcentered"
cell-class="is-vcentered is-narrow"
field="price"
:label="$t('offer.price')"
v-slot="props"
Expand All @@ -21,7 +21,7 @@
</b-table-column>
<b-table-column
v-if="!isBsxStats"
cell-class="is-vcentered"
cell-class="is-vcentered is-narrow"
field="expiration"
:label="$t('offer.expiration')"
v-slot="props"
Expand All @@ -30,7 +30,7 @@
</b-table-column>
<b-table-column
v-if="!isBsxStats"
cell-class="is-vcentered"
cell-class="is-vcentered is-narrow"
:label="$t('offer.action')"
v-slot="props"
width="120"
Expand All @@ -50,9 +50,10 @@
</b-table-column>
<b-table-column
v-if="isBsxStats"
cell-class="is-vcentered"
cell-class="is-vcentered is-narrow"
:label="$t('nft.offer.item')"
v-slot="props">
v-slot="props"
sortable>
<nuxt-link :to="`gallery/${props.row.nft.id}`">
<p v-if="props.row.nft.name">{{ props.row.nft.name }}</p>
<p v-else>{{ props.row.nft.id }}</p>
Expand All @@ -61,10 +62,11 @@
<b-table-column
v-if="isBsxStats"
field="status"
cell-class="is-vcentered"
cell-class="is-vcentered is-narrow"
:label="$t('nft.offer.status')"
v-slot="props"
><p>{{ props.row.status }}</p></b-table-column
sortable>
<p>{{ props.row.status }}</p></b-table-column
>
<b-table-column
v-if="isBsxStats"
Expand Down
9 changes: 4 additions & 5 deletions components/landing/CuratedList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,11 @@ import {
processMetadata,
} from '~/utils/cachingStrategy'
import PrefixMixin from '~/utils/mixins/prefixMixin'
import Unknown from '../rmrk/Media/JsonMedia.vue'
import resolveQueryPath from '~/utils/queryPathResolver'
import { mapOnlyMetadata } from '~/utils/mappers'
import { CollectionMetadata } from '../rmrk/types'
import { fastExtract } from '~/utils/ipfs'
import { getSanitizer } from '../rmrk/utils'
import { getSanitizer, SomethingWithMeta } from '../rmrk/utils'
import { Collection } from '~/components/unique/types'
const components = {
Expand All @@ -72,7 +71,7 @@ const curatedCollection = [
'800f8a914281765a7d-KITTY', // Kitty
'2075be44ea4b9e422d-🐺', // WolfAngryClub
'160a6f4320f11acb25-LCKWV', // PixelBabe
'7472058104f9f93924-KSMRAI', // Kusamurais (substraknights)
'0a24c7876a892acb79-RADTOADZ', // RadToadz (ZestLifeLab)
'7cf9daa38281a57331-BSS', // Spaceships (ClownWorldHouse)
'900D19DC7D3C444E4C-KSMBOT', // KusamaBot (deepologics)
]
Expand All @@ -81,7 +80,7 @@ const curatedCollection = [
components,
})
export default class CuratedList extends mixins(AuthMixin, PrefixMixin) {
protected collections: Collection[] = []
protected collections: Collection[] | SomethingWithMeta[] = []
async fetch() {
const query = await resolveQueryPath(
Expand All @@ -108,7 +107,7 @@ export default class CuratedList extends mixins(AuthMixin, PrefixMixin) {
this.collections = data.collectionEntities.map((e: any) => ({
...e,
metadata: e.meta?.id || e.metadata,
}))
})) as SomethingWithMeta[]
const metadataList: string[] = this.collections.map(mapOnlyMetadata)
const imageLinks = await getCloudflareImageLinks(metadataList)
Expand Down
3 changes: 1 addition & 2 deletions components/rmrk/Collection/List/CollectionList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@

<script lang="ts">
import { Component, mixins, Vue, Watch } from 'nuxt-property-decorator'
import shouldUpdate from '~/utils/shouldUpdate'
import { Debounce } from 'vue-debounce-decorator'
import {
CollectionWithMeta,
Expand Down Expand Up @@ -263,7 +262,7 @@ export default class CollectionList extends mixins(
@Watch('$route.query.search')
protected onSearchChange(val: string, oldVal: string) {
if (shouldUpdate(val, oldVal)) {
if (val !== oldVal) {
this.resetPage()
this.searchQuery.search = val || ''
}
Expand Down
10 changes: 8 additions & 2 deletions components/rmrk/Gallery/AvailableActions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
outlined
@click="handleAction(action)"
expanded>
{{ action }}
{{ actionLabel(action) }}
</b-button>
</template>
<template v-else-if="isForSale">
Expand All @@ -33,7 +33,7 @@
outlined
@click="handleAction(ShoppingActions.BUY)"
expanded>
{{ replaceBuyNowWithYolo ? 'YOLO' : 'BUY' }}
{{ replaceBuyNowWithYolo ? 'YOLO' : actionLabel('BUY') }}
</b-button>
</b-tooltip>
</template>
Expand Down Expand Up @@ -84,7 +84,9 @@ import {
ShoppingActions,
KeyboardValueToActionMap,
getActions,
getActionButtonLabel,
} from '@/utils/shoppingActions'
import { TranslateResult } from 'vue-i18n/types'
type Address = string | GenericAccountId | undefined
type IdentityFields = Record<string, string>
Expand Down Expand Up @@ -410,6 +412,10 @@ export default class AvailableActions extends mixins(
this.meta = 0
this.submit()
}
protected actionLabel(value: ShoppingActions): TranslateResult {
return getActionButtonLabel(value, this)
}
}
</script>
<style scoped lang="scss">
Expand Down
4 changes: 1 addition & 3 deletions components/rmrk/Gallery/Gallery.vue
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,8 @@ import AuthMixin from '@/utils/mixins/authMixin'
import { NFTMetadata } from '../service/scheme'
import { getSanitizer } from '../utils'
import { SearchQuery } from './Search/types'
import shouldUpdate from '~/utils/shouldUpdate'
import resolveQueryPath from '~/utils/queryPathResolver'
import { unwrapSafe } from '~/utils/uniquery'
import { exist } from '@/components/rmrk/Gallery/Search/exist'
import { notificationTypes, showNotification } from '@/utils/notification'
import passionQuery from '@/queries/rmrk/subsquid/passionFeed.graphql'
Expand Down Expand Up @@ -408,7 +406,7 @@ export default class Gallery extends mixins(
@Watch('$route.query.search')
protected onSearchChange(val: string, oldVal: string) {
if (shouldUpdate(val, oldVal)) {
if (val !== oldVal) {
this.resetPage()
this.searchQuery.search = val || ''
}
Expand Down
Loading

0 comments on commit 7852b5b

Please sign in to comment.