Skip to content

Sharing, praise for demo gods #171

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Mar 10, 2021
Merged
1 change: 1 addition & 0 deletions dashboard/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ yarn-error.log*
*.sw?

.vercel
/test
11 changes: 10 additions & 1 deletion dashboard/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="container is-max-desktop">
<Navbar/>
<Navbar v-if="isNavbarVisible"/>
<router-view id="routerview" />
</div>
</template>
Expand All @@ -10,6 +10,7 @@ import { Component, Vue, Watch } from 'vue-property-decorator';
import { cryptoWaitReady } from '@polkadot/util-crypto';
import keyring from '@polkadot/ui-keyring';
import Navbar from './components/Navbar.vue';
import isShareMode from '@/utils/isShareMode'

@Component<Dashboard>({
metaInfo() {
Expand Down Expand Up @@ -69,6 +70,10 @@ export default class Dashboard extends Vue {
public mounted(): void {
this.mountWasmCrypto();
}

get isNavbarVisible() {
return !isShareMode
}
}
</script>

Expand Down Expand Up @@ -103,6 +108,10 @@ $link: $primary;
$link-invert: $primary-invert;
$link-focus-border: $primary;

// DEV: for dark mode
// $scheme-main: rgb(27, 34, 44);
// $scheme-invert: $white;

// Import Bulma and Buefy styles
@import "~bulma";
@import "~buefy/src/scss/buefy";
Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/components/landing/Landing.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export default class Landing extends Vue {
['Czech', 'https://t.me/joinchat/Fhnvbi5a_wRjNzFk'],
['Japan', 'https://t.me/joinchat/-CjTUgAflGQxYTU0'],
['Korea', 'https://t.me/KodaDotKR'],
['Portugese', 'https://t.me/joinchat/1UHYFZpVYmE1OTZk'],
['Portuguese', 'https://t.me/joinchat/1UHYFZpVYmE1OTZk'],
['Poland', 'https://t.me/joinchat/HG7J2RAk906N7scb'],
['Russia', 'https://t.me/kodadotru'],
['Spanish','https://t.me/joinchat/HkF3cxImJAJGoRH9'],
Expand Down
11 changes: 10 additions & 1 deletion dashboard/src/components/rmrk/Gallery/CollectionItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<p class="subtitle">
Issued by: <ProfileLink v-if="owner" :address="owner" :inline="true" />
</p>
<Sharing label="Check this awesome Collection on %23KusamaNetwork %23KodaDot" />
<Sharing v-if="sharingVisible" label="Check this awesome Collection on %23KusamaNetwork %23KodaDot" :iframe="iframeSettings" />
</div>
</div>
</div>
Expand All @@ -26,6 +26,7 @@ import { Component, Prop, Vue, Watch } from 'vue-property-decorator';
import { getInstance } from '../service/RmrkService';
import { CollectionWithMeta, NFTWithMeta, Collection } from '../service/scheme';
import { fetchNFTMetadata, sanitizeIpfsUrl, defaultSortBy, fetchCollectionMetadata } from '../utils';
import isShareMode from '@/utils/isShareMode';

const components = {
GalleryCardList: () => import('@/components/rmrk/Gallery/GalleryCardList.vue'),
Expand All @@ -48,6 +49,10 @@ export default class CollectionItem extends Vue {
return this.collection.issuer || ''
}

get sharingVisible() {
return !isShareMode
}

public async mounted() {
this.checkId();
const rmrkService = getInstance();
Expand Down Expand Up @@ -82,6 +87,10 @@ export default class CollectionItem extends Vue {
}
}

get iframeSettings() {
return { width: '100%', height: '100vh' }
}

collectionMeta(collection: Collection) {
fetchCollectionMetadata(collection)
.then(
Expand Down
26 changes: 11 additions & 15 deletions dashboard/src/components/rmrk/Gallery/GalleryCard.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
<template>
<div class="card nft-card">
<router-link
:to="{ name: type, params: { id: id } }"
tag="div"
class="nft-card__skeleton"
>
<LinkResolver class="nft-card__skeleton" :route="type" :param="id" :link="link" tag="div" >
<div class="card-image" v-if="image">
<b-image
:src="image"
Expand All @@ -23,22 +19,26 @@
</div>

<div class="card-content">
<p class="title is-4">
<router-link :to="{ name: type, params: { id: id } }">{{
name
}}</router-link>
<p class="title is-4 has-text-centered has-text-primary">
{{ name }}
</p>
</div>
</router-link>

</LinkResolver>
</div>
</template>

<script lang="ts" >
import { Component, Prop, Vue } from 'vue-property-decorator';

@Component({})
const components = {
LinkResolver: () => import('@/components/shared/LinkResolver.vue')
}

@Component({ components })
export default class GalleryCard extends Vue {
@Prop({ default: 'nftDetail' }) public type!: string;
@Prop({ default: 'rmrk/detail' }) public link!: string;
@Prop() public id!: string;
@Prop() public name!: string;
@Prop() public image!: string;
Expand All @@ -61,8 +61,4 @@ export default class GalleryCard extends Vue {
a {
color: grey;
}

a:hover {
color: black;
}
</style>
3 changes: 2 additions & 1 deletion dashboard/src/components/rmrk/Gallery/GalleryCardList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
v-for="nft in items"
:key="nft.id"
>
<GalleryCard :id="nft.id" :name="nft.name" :image="nft.image" :type="type" />
<GalleryCard :id="nft.id" :name="nft.name" :image="nft.image" :type="type" :link="link" />
</div>
</div>
</template>
Expand All @@ -20,6 +20,7 @@ const components = { GalleryCard };
@Component({ components })
export default class GalleryCardList extends Vue {
@Prop({ default: 'nftDetail' }) public type!: string;
@Prop({ default: 'rmrk/detail' }) public link!: string;
@Prop() public items!: RmrkType[];
}
</script>
26 changes: 16 additions & 10 deletions dashboard/src/components/rmrk/Gallery/GalleryItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="wrapper">
<div class="columns">
<div class="column is-8 is-offset-2">
<div class="box">
<div :class="{ box: detailVisible }">
<b-image
v-if="!isLoading && imageVisible"
:src="nft.image || require('@/assets/kodadot_logo_v1_transparent_400px.png')"
Expand All @@ -11,10 +11,10 @@
ratio="1by1"
></b-image>
<b-skeleton height="524px" size="is-large" :active="isLoading"></b-skeleton>

<MediaResolver v-if="nft.animation_url" :class="{ withPicture: imageVisible }" :src="nft.animation_url" :mimeType="mimeType" />
<Appreciation :accountId="accountId" :currentOwnerId="nft.currentOwner" :nftId="nft.id" />
<PackSaver v-if="accountId" :accountId="accountId" :currentOwnerId="nft.currentOwner" :nftId="nft.id" />
<template v-if="detailVisible">
<MediaResolver v-if="nft.animation_url" :class="{ withPicture: imageVisible }" :src="nft.animation_url" :mimeType="mimeType" />
<Appreciation :accountId="accountId" :currentOwnerId="nft.currentOwner" :nftId="nft.id" />
<PackSaver v-if="accountId" :accountId="accountId" :currentOwnerId="nft.currentOwner" :nftId="nft.id" />

<b-collapse class="card" animation="slide"
aria-id="contentIdForA11y3" :open="false">
Expand Down Expand Up @@ -42,10 +42,11 @@
</div>
</div>
</b-collapse>
</template>
<Name :nft="nft" :isLoading="isLoading" />
<div class="card">
<div class="card-content">
<p class="title is-size-2">
<p class="title" :class="[ detailVisible ? 'is-size-2' : 'is-size-4' ]">
{{ $t('legend')}}
</p>
<p class="subtitle is-size-7">
Expand All @@ -54,16 +55,16 @@
</b-tag>
<p v-if="!isLoading"
class="subtitle is-size-5">
<!-- <markdown-it-vue class="md-body" :content="nft.description" /> -->
<!-- <markdown-it-vue-light class="md-body" :content="nft.description" /> -->
{{ nft.description }}
</p>
<b-skeleton :count="3" size="is-large" :active="isLoading"></b-skeleton>
</p>
</div>
</div>
<Facts :nft="nft" />
<Sharing />
<template v-if="detailVisible">
<Facts :nft="nft" />
<Sharing />
</template>
</div>
</div>
</div>
Expand Down Expand Up @@ -92,6 +93,7 @@ import api from '@/fetch';
import { resolveMedia } from '../utils';
import { MediaType } from '../types';
import { MetaInfo } from 'vue-meta';
import isShareMode from '@/utils/isShareMode';
// import { VueConstructor } from 'vue';

type NFTType = NFTWithMeta;
Expand Down Expand Up @@ -189,6 +191,10 @@ export default class GalleryItem extends Vue {
const { id } = this.nft;
return id;
}

get detailVisible() {
return !isShareMode
}
}
</script>

Expand Down
10 changes: 9 additions & 1 deletion dashboard/src/components/rmrk/Gallery/Item/Name.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
class="card-header"
role="button"
aria-controls="contentIdForA11y3">
<p class="card-header-title is-size-1">
<p
class="card-header-title"
:class="[ detailVisible ? 'is-size-1' : 'is-size-3' ]"
>
<span v-if="!isLoading">
{{ nft.name }}
</span>
Expand Down Expand Up @@ -43,6 +46,7 @@

<script lang="ts" >
import { Component, Prop, Vue } from 'vue-property-decorator';
import isShareMode from '@/utils/isShareMode';
// import Identity from '@/components/shared/format/Identity.vue'

const components = {
Expand All @@ -53,5 +57,9 @@ const components = {
export default class Name extends Vue {
@Prop() public nft!: any;
@Prop() public isLoading!: boolean;

get detailVisible() {
return !isShareMode
}
}
</script>
39 changes: 39 additions & 0 deletions dashboard/src/components/rmrk/Gallery/Item/Sharing.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,31 @@
</a>
</span>
</p>
<p class="card-footer-item">
<span>
<a
v-clipboard:copy="iframeUri"
@click="toast('Code copied to clipboard')">
<b-icon
size="is-medium"
pack="fas"
icon="code">
</b-icon>
</a>
</span>
</p>
</footer>
</div>
</template>

<script lang="ts" >
import { Component, Prop, Vue, Watch } from 'vue-property-decorator';
import { IFrame, emptyIframe } from '../../types';

@Component({})
export default class Sharing extends Vue {
@Prop({ default: 'Check this cool NFT on %23KusamaNetwork %23kodadot' }) label!: string;
@Prop({ default: emptyIframe }) iframe!: IFrame;

get helloText() {
return this.label;
Expand All @@ -85,6 +100,30 @@ export default class Sharing extends Vue {
return `https://lineit.line.me/share/ui?url=${this.realworldFullPath}&text=${this.helloText}`;
}

get width() {
return this.iframe.width || '480px'
}

get height() {
return this.iframe.height || '840px'
}

get customIframeUri() {
return this.iframe.customUrl || this.realworldFullPath
}

get iframeUri() {
return `
<iframe
src="${this.customIframeUri}"
title="${this.label}"
style="width:${this.width};height:${this.height};border:none;"
></iframe>
`
}



public toast(message: string): void {
this.$buefy.toast.open(message);
}
Expand Down
13 changes: 12 additions & 1 deletion dashboard/src/components/rmrk/Pack/PackItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<p class="subtitle">
Curated by: <ProfileLink v-if="owner" :address="owner" :inline="true" />
</p>
<Sharing label="Check this awesome Pack on %23KusamaNetwork %23KodaDot" />
<Sharing v-if="sharingVisible" label="Check this awesome Pack on %23KusamaNetwork %23KodaDot" :iframe="iframeSettings" />
</div>
</div>
</div>
Expand All @@ -26,6 +26,7 @@ import { Component, Prop, Vue, Watch } from 'vue-property-decorator';
import { getInstance } from '../service/RmrkService';
import { CompletePack } from '../service/scheme';
import { fetchNFTMetadata, sanitizeIpfsUrl } from '../utils';
import isShareMode from '@/utils/isShareMode';

const components = {
GalleryCardList: () => import('@/components/rmrk/Gallery/GalleryCardList.vue'),
Expand All @@ -51,13 +52,19 @@ export default class PackItem extends Vue {
return this.pack.nfts || [];
}

get sharingVisible() {
return !isShareMode
}


public async mounted() {
this.checkId();
const rmrkService = getInstance();
if (!rmrkService || !this.id) {
return;
}


this.isLoading = true;

try {
Expand All @@ -82,6 +89,10 @@ export default class PackItem extends Vue {
}
}

get iframeSettings() {
return { width: '100%', height: '100vh' }
}

nftMeta() {
this.pack.nfts.map(fetchNFTMetadata).forEach(async (call, index) => {
const res = await call;
Expand Down
Loading