Skip to content

Commit 8cc1447

Browse files
authored
Merge pull request #549 from kodadot/main
Rank -> Score, Showing twitter next to profile at nft item detail
2 parents ea676da + bacbbad commit 8cc1447

File tree

12 files changed

+400
-166
lines changed

12 files changed

+400
-166
lines changed

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@
2121
"@fortawesome/free-solid-svg-icons": "^5.15.3",
2222
"@fortawesome/vue-fontawesome": "^2.0.2",
2323
"@google/model-viewer": "^1.7.2",
24-
"@polkadot/extension-dapp": "^0.38.6",
25-
"@polkadot/types": "^4.15.1",
26-
"@polkadot/ui-keyring": "^0.81.1",
27-
"@polkadot/util": "^6.9.1",
28-
"@polkadot/util-crypto": "^6.9.1",
29-
"@polkadot/vue-identicon": "^0.81.1",
24+
"@polkadot/extension-dapp": "^0.38.8",
25+
"@polkadot/types": "^4.17.1",
26+
"@polkadot/ui-keyring": "^0.83.1",
27+
"@polkadot/util": "^6.11.1",
28+
"@polkadot/util-crypto": "^6.11.1",
29+
"@polkadot/vue-identicon": "^0.83.1",
3030
"@subsocial/api": "^0.5.8",
3131
"@subsocial/types": "^0.5.8",
3232
"@subsocial/utils": "^0.4.39",
3333
"@types/file-saver": "^2.0.2",
34-
"@vue-polkadot/vue-api": "0.0.35",
35-
"@vue-polkadot/vue-settings": "^0.0.17",
34+
"@vue-polkadot/vue-api": "^0.0.36",
35+
"@vue-polkadot/vue-settings": "^0.0.18",
3636
"apollo-boost": "^0.4.9",
3737
"axios": "^0.21.1",
3838
"buefy": "^0.9.8",

src/components/rmrk/Create/CreateItem.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
></b-input>
1818
<Tooltip iconsize="is-medium" :label="$i18n.t('tooltip.name')" />
1919
</b-field>
20-
<b-field :label="$i18n.t('Collection description')" class="mb-0">
20+
<b-field :label="$i18n.t('nft.description')" class="mb-0">
2121
<b-input
2222
v-model="vDescription"
2323
maxlength="500"

src/components/rmrk/Gallery/CollectionItem.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</div>
99
<div class="column">
1010
<p class="subtitle">
11-
Creator <ProfileLink :address="issuer" :inline="true" />
11+
Creator <ProfileLink :address="issuer" :inline="true" :showTwitter="true"/>
1212
</p>
1313
<p class="subtitle" v-if="owner">
1414
Owner <ProfileLink :address="owner" :inline="true" />

src/components/rmrk/Gallery/Gallery.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,9 @@ export default class Gallery extends Vue {
229229
const storedMetadata = await getMany(
230230
this.nfts.map(({ metadata }: any) => metadata)
231231
);
232+
232233
storedMetadata.forEach(async (m, i) => {
234+
console.log(m)
233235
if (!m) {
234236
try {
235237
const meta = await fetchNFTMetadata(this.nfts[i]);

src/components/rmrk/Gallery/GalleryItem.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ import { exist } from './Search/exist';
149149
150150
@Component<GalleryItem>({
151151
metaInfo() {
152-
const image = `https://og-image-green-seven.vercel.app/${encodeURIComponent(this.nft.name as string)}.png?price=${this.nft.price ? Vue.filter('formatBalance')(this.nft.price, 12, 'KSM') : ''}&image=${(this.meta.image as string)}`;
152+
const image = `https://og-image-green-seven.vercel.app/${encodeURIComponent(this.nft.name as string)}.png?price=${Number(this.nft.price) ? Vue.filter('formatBalance')(this.nft.price, 12, 'KSM') : ''}&image=${(this.meta.image as string)}`;
153153
return {
154154
title: this.nft.name,
155155
titleTemplate: '%s | Low Carbon NFTs',

src/components/rmrk/Gallery/Item/Name.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
{{ $t('owner') }}
3232
</p>
3333
<p class="subtitle is-size-6">
34-
<ProfileLink :address="nft.currentOwner" />
34+
<ProfileLink :address="nft.currentOwner" :showTwitter="true"/>
3535
<b-skeleton :count="1" size="is-large" :active="isLoading"></b-skeleton>
3636
<!-- <a :href="`https://kusama.subscan.io/account/${nft.currentOwner}`" target="_blank"><Identity :address="nft.currentOwner" /></a> -->
3737
</p>

src/components/rmrk/Profile/ProfileLink.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<template>
2+
<div>
23
<LinkResolver class="profile-link__wrapper" route="profile" :param="address" link="u">
34
<Identity :address="address" :inline="true" :verticalAlign="true" />
45
<template v-slot:extra>
@@ -9,6 +10,11 @@
910
</a>
1011
</template>
1112
</LinkResolver>
13+
<div class="pt-2" v-if="showTwitter">
14+
<Identity :address="address" :inline="true" :showTwitter="showTwitter" :verticalAlign="true" />
15+
</div>
16+
</div>
17+
1218
</template>
1319

1420
<script lang="ts" >
@@ -23,6 +29,7 @@ const components = {
2329
@Component({ components })
2430
export default class ProfileLink extends Mixins(InlineMixin) {
2531
@Prop() public address!: string;
32+
@Prop() public showTwitter!: boolean;
2633
2734
}
2835
</script>

src/components/shared/format/Identity.vue

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
<template>
22
<component :is="is" v-clipboard:copy="address" :class="{ aligned: verticalAlign, overflowWrap: noOwerflow }">
3-
{{ name | toString }}
3+
<template v-if="showTwitter && twitter">
4+
<a :href="`https://twitter.com/${twitter}`" target="_blank" rel="noopener noreferrer">
5+
{{ twitter | toString }}
6+
<b-icon
7+
pack="fab"
8+
icon="twitter"
9+
></b-icon>
10+
</a>
11+
</template>
12+
<template v-else>
13+
{{ name | toString }}
14+
</template>
415
</component>
516
</template>
617

@@ -28,6 +39,7 @@ export default class Identity extends Mixins(InlineMixin) {
2839
@Prop(Boolean) public verticalAlign!: boolean;
2940
@Prop(Boolean) public noOwerflow!: boolean;
3041
@Prop(Boolean) public emit!: boolean;
42+
@Prop(Boolean) public showTwitter!: boolean;
3143
private identity: IdentityFields = emptyObject<IdentityFields>();
3244
3345
get name(): Address {
@@ -36,6 +48,12 @@ export default class Identity extends Mixins(InlineMixin) {
3648
return name as string || shortAddress(this.resolveAddress(this.address))
3749
}
3850
51+
get twitter(): Address {
52+
// console.log('get twitter -> identityInfo', this.identityInfo);
53+
const twitter = this.identity.twitter
54+
return twitter as string || shortAddress(this.resolveAddress(this.address))
55+
}
56+
3957
@Watch('address', { immediate: true })
4058
async watchAddress(newAddress: Address, oldAddress: Address) {
4159
if (shouldUpdate(newAddress, oldAddress)) {
@@ -95,7 +113,7 @@ export default class Identity extends Mixins(InlineMixin) {
95113
const final = Array.from(identity.info)
96114
.filter(([_, value]) => !Array.isArray(value) && !value.isEmpty)
97115
.reduce((acc, [key, value]) => {
98-
acc[key] = this.handleRaw(value as Data)
116+
acc[key] = this.handleRaw(value as unknown as Data)
99117
return acc;
100118
}, {} as IdentityFields)
101119

src/components/spotlight/SpotlightTable.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666

6767
<b-table-column
6868
field="rank"
69-
:label="$t('spotlight.rank')"
69+
:label="$t('spotlight.score')"
7070
v-slot="props"
7171
sortable
7272
>

src/components/spotlight/utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const nftFn = (a: any): Row => {
2424
total,
2525
sold,
2626
unique,
27-
averagePrice: a.nfts.nodes.reduce(sumFn, 0) / (a.nfts.nodes.length || 1),
27+
averagePrice: a.nfts.nodes.filter(onlyOwned).reduce(sumFn, 0) / (a.nfts.nodes.length || 1),
2828
count: 1,
2929
collectors: 0, // a.nfts.nodes.reduce(uniqueCollectorFn, new Set()),
3030
rank: sold * (unique / total)
@@ -38,3 +38,4 @@ const sumFn = (acc: number, val: SimpleSpotlightNFT) => {
3838
// const uniqueCollectorFn = (acc: Set<string>, val: SimpleSpotlightNFT) => val.issuer !== val.currentOwner ? acc.add(val.currentOwner) : acc
3939
const uniqueFn = (acc: Set<string>, val: SimpleSpotlightNFT) => acc.add(val.metadata)
4040
const soldFn = (acc: number, val: SimpleSpotlightNFT) => val.issuer !== val.currentOwner ? acc + 1 : acc
41+
const onlyOwned = ({ issuer, currentOwner }: SimpleSpotlightNFT) => issuer === currentOwner;

0 commit comments

Comments
 (0)