From 5f6e887f3595e621ceb6138a0680e42fea28a112 Mon Sep 17 00:00:00 2001
From: Jarsen <695552027@qq.com>
Date: Fri, 19 Aug 2022 22:27:56 +0800
Subject: [PATCH 1/5] fix: Tags on RMRK NFTs
---
components/bsx/Create/CreateCollection.vue | 11 ++++-----
components/bsx/Create/CreateToken.vue | 2 +-
components/rmrk/Create/CreateToken.vue | 2 +-
components/rmrk/Gallery/GalleryItem.vue | 6 +++++
components/unique/Create/CreateCollection.vue | 24 +++++++------------
components/unique/Create/CreateToken.vue | 16 ++++++-------
components/unique/Gallery/Item/Properties.vue | 9 ++++++-
7 files changed, 36 insertions(+), 34 deletions(-)
diff --git a/components/bsx/Create/CreateCollection.vue b/components/bsx/Create/CreateCollection.vue
index f01c1b8037..577721bc06 100644
--- a/components/bsx/Create/CreateCollection.vue
+++ b/components/bsx/Create/CreateCollection.vue
@@ -125,12 +125,11 @@ export default class CreateCollection extends mixins(
const imageHash = await pinImageSafe(file, pinningKey.token)
const type = getImageTypeSafe(file)
- const attributes = this.attributes
- .map((val) => ({
- ...val,
- display_type: null,
- }))
- .filter((item) => item.trait_type || item.display_type)
+ const attributes = this.attributes.map((val) => ({
+ ...val,
+ display_type: null,
+ }))
+
const meta = createMetadata(
name,
description,
diff --git a/components/bsx/Create/CreateToken.vue b/components/bsx/Create/CreateToken.vue
index 77d9c64873..a47784db35 100644
--- a/components/bsx/Create/CreateToken.vue
+++ b/components/bsx/Create/CreateToken.vue
@@ -370,7 +370,7 @@ export default class CreateToken extends mixins(
...(this.attributes || []),
...nsfwAttribute(this.nsfw),
...offsetAttribute(this.hasCarbonOffset),
- ].filter((attribute) => attribute.display_type || attribute.trait_type)
+ ]
const meta = createMetadata(
name,
diff --git a/components/rmrk/Create/CreateToken.vue b/components/rmrk/Create/CreateToken.vue
index 5b2d09e47c..eba01ee2a1 100644
--- a/components/rmrk/Create/CreateToken.vue
+++ b/components/rmrk/Create/CreateToken.vue
@@ -315,7 +315,7 @@ export default class CreateToken extends mixins(
...(this.tags || []),
...nsfwAttribute(this.nsfw),
...offsetAttribute(this.hasCarbonOffset),
- ].filter((item) => item.trait_type || item.display_type)
+ ]
const meta = createMetadata(
name,
diff --git a/components/rmrk/Gallery/GalleryItem.vue b/components/rmrk/Gallery/GalleryItem.vue
index e56eee353d..2c0e11640c 100644
--- a/components/rmrk/Gallery/GalleryItem.vue
+++ b/components/rmrk/Gallery/GalleryItem.vue
@@ -44,6 +44,9 @@
v-if="!isLoading"
:text="meta.description.replaceAll('\n', ' \n')" />
+
@@ -190,6 +193,7 @@ import AvailableActions from './AvailableActions.vue'
Appreciation: () => import('@/components/rmrk/Gallery/Appreciation.vue'),
MediaResolver: () => import('@/components/media/MediaResolver.vue'),
IndexerGuard: () => import('@/components/shared/wrapper/IndexerGuard.vue'),
+ Properties: () => import('@/components/unique/Gallery/Item/Properties.vue'),
DescriptionWrapper: () =>
import('@/components/shared/collapse/DescriptionWrapper.vue'),
Detail: () => import('@/components/unique/Gallery/Item/Detail.vue'),
@@ -368,6 +372,8 @@ export default class GalleryItem extends mixins(PrefixMixin) {
),
}
+ console.log('jarsen this', this.meta)
+
if (this.meta.animation_url && !this.mimeType) {
const { mimeType, imageVisible } = await processMedia(
this.meta.animation_url
diff --git a/components/unique/Create/CreateCollection.vue b/components/unique/Create/CreateCollection.vue
index 35604b4421..6c70f88931 100644
--- a/components/unique/Create/CreateCollection.vue
+++ b/components/unique/Create/CreateCollection.vue
@@ -115,12 +115,11 @@ export default class CreateCollection extends mixins(
? IPFS_KODADOT_IMAGE_PLACEHOLDER
: await pinFileToIPFS(file, pinningKey.token)
const type = !file ? 'image/png' : file.type
- const attributes = this.attributes
- .map((val) => ({
- ...val,
- display_type: null,
- }))
- .filter((item) => item.trait_type || item.display_type)
+ const attributes = this.attributes.map((val) => ({
+ ...val,
+ display_type: null,
+ }))
+
const meta = createMetadata(
name,
description,
@@ -162,16 +161,9 @@ export default class CreateCollection extends mixins(
const create = api.tx.uniques.create(randomId, this.accountId)
// Option to freeze metadata
const meta = api.tx.uniques.setClassMetadata(randomId, metadata, false)
- const attributes = this.attributes
- .filter((item) => item.trait_type || item.display_type)
- .map((a) =>
- api.tx.uniques.setAttribute(
- randomId,
- null,
- a.trait_type,
- String(a.value)
- )
- )
+ const attributes = this.attributes.map((a) =>
+ api.tx.uniques.setAttribute(randomId, null, a.trait_type, String(a.value))
+ )
return [create, meta, ...attributes]
}
diff --git a/components/unique/Create/CreateToken.vue b/components/unique/Create/CreateToken.vue
index a33ea1c0c6..55ae18b730 100644
--- a/components/unique/Create/CreateToken.vue
+++ b/components/unique/Create/CreateToken.vue
@@ -237,16 +237,14 @@ export default class CreateToken extends mixins(
metadata,
false
)
- const attributes = this.attributes
- .filter((item) => item.trait_type || item.display_type)
- .map((a) =>
- api.tx.uniques.setAttribute(
- collectionId,
- String(nextId),
- a.trait_type,
- String(a.value)
- )
+ const attributes = this.attributes.map((a) =>
+ api.tx.uniques.setAttribute(
+ collectionId,
+ String(nextId),
+ a.trait_type,
+ String(a.value)
)
+ )
const support = await canSupport(api, this.hasSupport)
//
diff --git a/components/unique/Gallery/Item/Properties.vue b/components/unique/Gallery/Item/Properties.vue
index 916501f91b..8c5d2ea2ca 100644
--- a/components/unique/Gallery/Item/Properties.vue
+++ b/components/unique/Gallery/Item/Properties.vue
@@ -21,7 +21,14 @@ export default class Properties extends Vue {
@Prop({ type: String, default: 'key' }) private fieldKey!: string
get displayAttributes() {
- return this.attributes.filter((attribute) => attribute[this.fieldKey])
+ return this.attributes
+ .map((attr) => {
+ return {
+ [this.fieldKey]: '',
+ ...attr,
+ }
+ })
+ .filter((attribute) => attribute[this.fieldKey] || attribute.value)
}
get columns() {
From f9bb5ab7f3cb17f3d553df71f98835f3a1b1ea7e Mon Sep 17 00:00:00 2001
From: Jarsen <695552027@qq.com>
Date: Fri, 19 Aug 2022 22:56:53 +0800
Subject: [PATCH 2/5] remove debug log
---
components/rmrk/Gallery/GalleryItem.vue | 2 --
1 file changed, 2 deletions(-)
diff --git a/components/rmrk/Gallery/GalleryItem.vue b/components/rmrk/Gallery/GalleryItem.vue
index 2c0e11640c..8046252b0d 100644
--- a/components/rmrk/Gallery/GalleryItem.vue
+++ b/components/rmrk/Gallery/GalleryItem.vue
@@ -372,8 +372,6 @@ export default class GalleryItem extends mixins(PrefixMixin) {
),
}
- console.log('jarsen this', this.meta)
-
if (this.meta.animation_url && !this.mimeType) {
const { mimeType, imageVisible } = await processMedia(
this.meta.animation_url
From 13e8d4ede8a021faf341dab4843d04f21dd0bdc6 Mon Sep 17 00:00:00 2001
From: Jarsen <695552027@qq.com>
Date: Mon, 22 Aug 2022 21:39:38 +0800
Subject: [PATCH 3/5] fix: properties with tag
---
components/rmrk/Gallery/GalleryItem.vue | 2 +-
components/shared/gallery/Properties.vue | 4 +++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/components/rmrk/Gallery/GalleryItem.vue b/components/rmrk/Gallery/GalleryItem.vue
index 8046252b0d..5b4d292556 100644
--- a/components/rmrk/Gallery/GalleryItem.vue
+++ b/components/rmrk/Gallery/GalleryItem.vue
@@ -193,7 +193,7 @@ import AvailableActions from './AvailableActions.vue'
Appreciation: () => import('@/components/rmrk/Gallery/Appreciation.vue'),
MediaResolver: () => import('@/components/media/MediaResolver.vue'),
IndexerGuard: () => import('@/components/shared/wrapper/IndexerGuard.vue'),
- Properties: () => import('@/components/unique/Gallery/Item/Properties.vue'),
+ Properties: () => import('@/components/shared/gallery/Properties.vue'),
DescriptionWrapper: () =>
import('@/components/shared/collapse/DescriptionWrapper.vue'),
Detail: () => import('@/components/unique/Gallery/Item/Detail.vue'),
diff --git a/components/shared/gallery/Properties.vue b/components/shared/gallery/Properties.vue
index e7478476dd..fa8904ee4a 100644
--- a/components/shared/gallery/Properties.vue
+++ b/components/shared/gallery/Properties.vue
@@ -6,7 +6,9 @@
:key="attribute[fieldKey]"
class="column is-4">
-
+
{{ attribute[fieldKey] }}
{{ attribute.value }}
From d6182fbbef91184df3e51fe395814bc762f04c76 Mon Sep 17 00:00:00 2001
From: Jarsen <695552027@qq.com>
Date: Mon, 22 Aug 2022 23:06:21 +0800
Subject: [PATCH 4/5] property ui
---
components/shared/gallery/Properties.vue | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/components/shared/gallery/Properties.vue b/components/shared/gallery/Properties.vue
index fa8904ee4a..7964c7e4f1 100644
--- a/components/shared/gallery/Properties.vue
+++ b/components/shared/gallery/Properties.vue
@@ -7,9 +7,8 @@
class="column is-4">
- {{ attribute[fieldKey] }}
+ class="is-size-7 has-text-grey-lighter is-uppercase attribute-key">
+ {{ attribute[fieldKey] === 'undefined' ? '' : attribute[fieldKey] }}
{{ attribute.value }}
@@ -35,3 +34,9 @@ export default class Properties extends Vue {
@Prop({ type: String, default: 'trait_type' }) public fieldKey!: string
}
+
+>
From c4abaf86f4d9d4dc2fd8b814eb8119c6adf41831 Mon Sep 17 00:00:00 2001
From: Jarsen <695552027@qq.com>
Date: Mon, 22 Aug 2022 23:29:07 +0800
Subject: [PATCH 5/5] remove scoped
---
components/shared/gallery/Properties.vue | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/components/shared/gallery/Properties.vue b/components/shared/gallery/Properties.vue
index 7964c7e4f1..46cc3caa4c 100644
--- a/components/shared/gallery/Properties.vue
+++ b/components/shared/gallery/Properties.vue
@@ -7,7 +7,7 @@
class="column is-4">
+ class="is-size-7 has-text-grey-lighter is-uppercase properties-attribute-key">
{{ attribute[fieldKey] === 'undefined' ? '' : attribute[fieldKey] }}
{{ attribute.value }}
@@ -34,8 +34,8 @@ export default class Properties extends Vue {
@Prop({ type: String, default: 'trait_type' }) public fieldKey!: string
}
-