Skip to content
This repository was archived by the owner on Dec 5, 2025. It is now read-only.

Commit 87946cc

Browse files
authored
Merge pull request #166 from kodadot/sharing
sharing
2 parents a81f31c + e487f25 commit 87946cc

File tree

16 files changed

+219
-53
lines changed

16 files changed

+219
-53
lines changed

dashboard/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ yarn-error.log*
2222
*.sw?
2323

2424
.vercel
25+
/test

dashboard/src/App.vue

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div class="container is-max-desktop">
3-
<Navbar/>
3+
<Navbar v-if="isNavbarVisible"/>
44
<router-view id="routerview" />
55
</div>
66
</template>
@@ -10,6 +10,7 @@ import { Component, Vue, Watch } from 'vue-property-decorator';
1010
import { cryptoWaitReady } from '@polkadot/util-crypto';
1111
import keyring from '@polkadot/ui-keyring';
1212
import Navbar from './components/Navbar.vue';
13+
import isShareMode from '@/utils/isShareMode'
1314
1415
@Component<Dashboard>({
1516
metaInfo() {
@@ -69,6 +70,10 @@ export default class Dashboard extends Vue {
6970
public mounted(): void {
7071
this.mountWasmCrypto();
7172
}
73+
74+
get isNavbarVisible() {
75+
return !isShareMode
76+
}
7277
}
7378
</script>
7479

@@ -103,6 +108,10 @@ $link: $primary;
103108
$link-invert: $primary-invert;
104109
$link-focus-border: $primary;
105110
111+
// DEV: for dark mode
112+
// $scheme-main: rgb(27, 34, 44);
113+
// $scheme-invert: $white;
114+
106115
// Import Bulma and Buefy styles
107116
@import "~bulma";
108117
@import "~buefy/src/scss/buefy";

dashboard/src/components/rmrk/Gallery/CollectionItem.vue

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<p class="subtitle">
1010
Issued by: <ProfileLink v-if="owner" :address="owner" :inline="true" />
1111
</p>
12-
<Sharing label="Check this awesome Collection on %23KusamaNetwork %23KodaDot" />
12+
<Sharing v-if="sharingVisible" label="Check this awesome Collection on %23KusamaNetwork %23KodaDot" :iframe="iframeSettings" />
1313
</div>
1414
</div>
1515
</div>
@@ -26,6 +26,7 @@ import { Component, Prop, Vue, Watch } from 'vue-property-decorator';
2626
import { getInstance } from '../service/RmrkService';
2727
import { CollectionWithMeta, NFTWithMeta, Collection } from '../service/scheme';
2828
import { fetchNFTMetadata, sanitizeIpfsUrl, defaultSortBy, fetchCollectionMetadata } from '../utils';
29+
import isShareMode from '@/utils/isShareMode';
2930
3031
const components = {
3132
GalleryCardList: () => import('@/components/rmrk/Gallery/GalleryCardList.vue'),
@@ -48,6 +49,10 @@ export default class CollectionItem extends Vue {
4849
return this.collection.issuer || ''
4950
}
5051
52+
get sharingVisible() {
53+
return !isShareMode
54+
}
55+
5156
public async mounted() {
5257
this.checkId();
5358
const rmrkService = getInstance();
@@ -82,6 +87,10 @@ export default class CollectionItem extends Vue {
8287
}
8388
}
8489
90+
get iframeSettings() {
91+
return { width: '100%', height: '100vh' }
92+
}
93+
8594
collectionMeta(collection: Collection) {
8695
fetchCollectionMetadata(collection)
8796
.then(

dashboard/src/components/rmrk/Gallery/GalleryCard.vue

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
<template>
22
<div class="card nft-card">
3-
<router-link
4-
:to="{ name: type, params: { id: id } }"
5-
tag="div"
6-
class="nft-card__skeleton"
7-
>
3+
<LinkResolver class="nft-card__skeleton" :route="type" :param="id" :link="link" tag="div" >
84
<div class="card-image" v-if="image">
95
<b-image
106
:src="image"
@@ -23,22 +19,26 @@
2319
</div>
2420

2521
<div class="card-content">
26-
<p class="title is-4">
27-
<router-link :to="{ name: type, params: { id: id } }">{{
28-
name
29-
}}</router-link>
22+
<p class="title is-4 has-text-centered has-text-primary">
23+
{{ name }}
3024
</p>
3125
</div>
32-
</router-link>
26+
27+
</LinkResolver>
3328
</div>
3429
</template>
3530

3631
<script lang="ts" >
3732
import { Component, Prop, Vue } from 'vue-property-decorator';
3833
39-
@Component({})
34+
const components = {
35+
LinkResolver: () => import('@/components/shared/LinkResolver.vue')
36+
}
37+
38+
@Component({ components })
4039
export default class GalleryCard extends Vue {
4140
@Prop({ default: 'nftDetail' }) public type!: string;
41+
@Prop({ default: 'rmrk/detail' }) public link!: string;
4242
@Prop() public id!: string;
4343
@Prop() public name!: string;
4444
@Prop() public image!: string;
@@ -61,8 +61,4 @@ export default class GalleryCard extends Vue {
6161
a {
6262
color: grey;
6363
}
64-
65-
a:hover {
66-
color: black;
67-
}
6864
</style>

dashboard/src/components/rmrk/Gallery/GalleryCardList.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
v-for="nft in items"
66
:key="nft.id"
77
>
8-
<GalleryCard :id="nft.id" :name="nft.name" :image="nft.image" :type="type" />
8+
<GalleryCard :id="nft.id" :name="nft.name" :image="nft.image" :type="type" :link="link" />
99
</div>
1010
</div>
1111
</template>
@@ -20,6 +20,7 @@ const components = { GalleryCard };
2020
@Component({ components })
2121
export default class GalleryCardList extends Vue {
2222
@Prop({ default: 'nftDetail' }) public type!: string;
23+
@Prop({ default: 'rmrk/detail' }) public link!: string;
2324
@Prop() public items!: RmrkType[];
2425
}
2526
</script>

dashboard/src/components/rmrk/Gallery/GalleryItem.vue

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div class="wrapper">
33
<div class="columns">
44
<div class="column is-8 is-offset-2">
5-
<div class="box">
5+
<div :class="{ box: detailVisible }">
66
<b-image
77
v-if="!isLoading && imageVisible"
88
:src="nft.image || require('@/assets/kodadot_logo_v1_transparent_400px.png')"
@@ -11,10 +11,10 @@
1111
ratio="1by1"
1212
></b-image>
1313
<b-skeleton height="524px" size="is-large" :active="isLoading"></b-skeleton>
14-
15-
<MediaResolver v-if="nft.animation_url" :class="{ withPicture: imageVisible }" :src="nft.animation_url" :mimeType="mimeType" />
16-
<Appreciation :accountId="accountId" :currentOwnerId="nft.currentOwner" :nftId="nft.id" />
17-
<PackSaver v-if="accountId" :accountId="accountId" :currentOwnerId="nft.currentOwner" :nftId="nft.id" />
14+
<template v-if="detailVisible">
15+
<MediaResolver v-if="nft.animation_url" :class="{ withPicture: imageVisible }" :src="nft.animation_url" :mimeType="mimeType" />
16+
<Appreciation :accountId="accountId" :currentOwnerId="nft.currentOwner" :nftId="nft.id" />
17+
<PackSaver v-if="accountId" :accountId="accountId" :currentOwnerId="nft.currentOwner" :nftId="nft.id" />
1818

1919
<b-collapse class="card" animation="slide"
2020
aria-id="contentIdForA11y3" :open="false">
@@ -42,10 +42,11 @@
4242
</div>
4343
</div>
4444
</b-collapse>
45+
</template>
4546
<Name :nft="nft" :isLoading="isLoading" />
4647
<div class="card">
4748
<div class="card-content">
48-
<p class="title is-size-2">
49+
<p class="title" :class="[ detailVisible ? 'is-size-2' : 'is-size-4' ]">
4950
{{ $t('legend')}}
5051
</p>
5152
<p class="subtitle is-size-7">
@@ -54,16 +55,16 @@
5455
</b-tag>
5556
<p v-if="!isLoading"
5657
class="subtitle is-size-5">
57-
<!-- <markdown-it-vue class="md-body" :content="nft.description" /> -->
58-
<!-- <markdown-it-vue-light class="md-body" :content="nft.description" /> -->
5958
{{ nft.description }}
6059
</p>
6160
<b-skeleton :count="3" size="is-large" :active="isLoading"></b-skeleton>
6261
</p>
6362
</div>
6463
</div>
65-
<Facts :nft="nft" />
66-
<Sharing />
64+
<template v-if="detailVisible">
65+
<Facts :nft="nft" />
66+
<Sharing />
67+
</template>
6768
</div>
6869
</div>
6970
</div>
@@ -92,6 +93,7 @@ import api from '@/fetch';
9293
import { resolveMedia } from '../utils';
9394
import { MediaType } from '../types';
9495
import { MetaInfo } from 'vue-meta';
96+
import isShareMode from '@/utils/isShareMode';
9597
// import { VueConstructor } from 'vue';
9698
9799
type NFTType = NFTWithMeta;
@@ -189,6 +191,10 @@ export default class GalleryItem extends Vue {
189191
const { id } = this.nft;
190192
return id;
191193
}
194+
195+
get detailVisible() {
196+
return !isShareMode
197+
}
192198
}
193199
</script>
194200

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
class="card-header"
88
role="button"
99
aria-controls="contentIdForA11y3">
10-
<p class="card-header-title is-size-1">
10+
<p
11+
class="card-header-title"
12+
:class="[ detailVisible ? 'is-size-1' : 'is-size-3' ]"
13+
>
1114
<span v-if="!isLoading">
1215
{{ nft.name }}
1316
</span>
@@ -43,6 +46,7 @@
4346

4447
<script lang="ts" >
4548
import { Component, Prop, Vue } from 'vue-property-decorator';
49+
import isShareMode from '@/utils/isShareMode';
4650
// import Identity from '@/components/shared/format/Identity.vue'
4751
4852
const components = {
@@ -53,5 +57,9 @@ const components = {
5357
export default class Name extends Vue {
5458
@Prop() public nft!: any;
5559
@Prop() public isLoading!: boolean;
60+
61+
get detailVisible() {
62+
return !isShareMode
63+
}
5664
}
5765
</script>

dashboard/src/components/rmrk/Gallery/Item/Sharing.vue

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,31 @@
5050
</a>
5151
</span>
5252
</p>
53+
<p class="card-footer-item">
54+
<span>
55+
<a
56+
v-clipboard:copy="iframeUri"
57+
@click="toast('Code copied to clipboard')">
58+
<b-icon
59+
size="is-medium"
60+
pack="fas"
61+
icon="code">
62+
</b-icon>
63+
</a>
64+
</span>
65+
</p>
5366
</footer>
5467
</div>
5568
</template>
5669

5770
<script lang="ts" >
5871
import { Component, Prop, Vue, Watch } from 'vue-property-decorator';
72+
import { IFrame, emptyIframe } from '../../types';
5973
6074
@Component({})
6175
export default class Sharing extends Vue {
6276
@Prop({ default: 'Check this cool NFT on %23KusamaNetwork %23kodadot' }) label!: string;
77+
@Prop({ default: emptyIframe }) iframe!: IFrame;
6378
6479
get helloText() {
6580
return this.label;
@@ -85,6 +100,30 @@ export default class Sharing extends Vue {
85100
return `https://lineit.line.me/share/ui?url=${this.realworldFullPath}&text=${this.helloText}`;
86101
}
87102
103+
get width() {
104+
return this.iframe.width || '480px'
105+
}
106+
107+
get height() {
108+
return this.iframe.height || '840px'
109+
}
110+
111+
get customIframeUri() {
112+
return this.iframe.customUrl || this.realworldFullPath
113+
}
114+
115+
get iframeUri() {
116+
return `
117+
<iframe
118+
src="${this.customIframeUri}"
119+
title="${this.label}"
120+
style="width:${this.width};height:${this.height};border:none;"
121+
></iframe>
122+
`
123+
}
124+
125+
126+
88127
public toast(message: string): void {
89128
this.$buefy.toast.open(message);
90129
}

dashboard/src/components/rmrk/Pack/PackItem.vue

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<p class="subtitle">
1010
Curated by: <ProfileLink v-if="owner" :address="owner" :inline="true" />
1111
</p>
12-
<Sharing label="Check this awesome Pack on %23KusamaNetwork %23KodaDot" />
12+
<Sharing v-if="sharingVisible" label="Check this awesome Pack on %23KusamaNetwork %23KodaDot" :iframe="iframeSettings" />
1313
</div>
1414
</div>
1515
</div>
@@ -26,6 +26,7 @@ import { Component, Prop, Vue, Watch } from 'vue-property-decorator';
2626
import { getInstance } from '../service/RmrkService';
2727
import { CompletePack } from '../service/scheme';
2828
import { fetchNFTMetadata, sanitizeIpfsUrl } from '../utils';
29+
import isShareMode from '@/utils/isShareMode';
2930
3031
const components = {
3132
GalleryCardList: () => import('@/components/rmrk/Gallery/GalleryCardList.vue'),
@@ -51,13 +52,19 @@ export default class PackItem extends Vue {
5152
return this.pack.nfts || [];
5253
}
5354
55+
get sharingVisible() {
56+
return !isShareMode
57+
}
58+
59+
5460
public async mounted() {
5561
this.checkId();
5662
const rmrkService = getInstance();
5763
if (!rmrkService || !this.id) {
5864
return;
5965
}
6066
67+
6168
this.isLoading = true;
6269
6370
try {
@@ -82,6 +89,10 @@ export default class PackItem extends Vue {
8289
}
8390
}
8491
92+
get iframeSettings() {
93+
return { width: '100%', height: '100vh' }
94+
}
95+
8596
nftMeta() {
8697
this.pack.nfts.map(fetchNFTMetadata).forEach(async (call, index) => {
8798
const res = await call;

0 commit comments

Comments
 (0)