-
-
Notifications
You must be signed in to change notification settings - Fork 366
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3102 from kodadot/feat-popular-collections
#2775 Adding popular collections to landing
- Loading branch information
Showing
4 changed files
with
109 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<template> | ||
<div> | ||
<Loader v-model="isLoading" /> | ||
|
||
<div class="columns is-vcentered"> | ||
<div class="column is-four-fifths"> | ||
<h1 class="title is-2">{{ $t('Popular Collections') }}</h1> | ||
<p class="subtitle is-size-5"> | ||
Discover the most popular collections on rmrk | ||
</p> | ||
</div> | ||
<div class="column has-text-right"> | ||
<Pagination | ||
simple | ||
preserveScroll | ||
v-model="currentValue" | ||
:total="total" | ||
:perPage="1" /> | ||
</div> | ||
</div> | ||
|
||
<CarouselCardList | ||
:nfts="nfts" | ||
:page="currentValue" | ||
:url="`${urlPrefix}/collection`" /> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { Component, mixins } from 'nuxt-property-decorator' | ||
import PrefixMixin from '~/utils/mixins/prefixMixin' | ||
import popularCollectionList from '@/queries/rmrk/subsquid/popularCollectionList.graphql' | ||
import { RowSeries } from '~/components/series/types' | ||
import { sanitizeIpfsUrl } from '../utils' | ||
const components = { | ||
CarouselCardList: () => import('@/components/base/CarouselCardList.vue'), | ||
Pagination: () => import('@/components/rmrk/Gallery/Pagination.vue'), | ||
Loader: () => import('@/components/shared/Loader.vue'), | ||
} | ||
@Component<PopularCollections>({ | ||
components, | ||
}) | ||
export default class PopularCollections extends mixins(PrefixMixin) { | ||
private nfts: RowSeries[] = [] | ||
private total = 0 | ||
private currentValue = 1 | ||
get isLoading(): boolean { | ||
return false | ||
} | ||
async created() { | ||
this.handleResult() | ||
} | ||
protected async handleResult() { | ||
const collections = await this.$apollo.query({ | ||
query: popularCollectionList, | ||
client: 'subsquid', | ||
variables: { | ||
orderDirection: 'ASC', | ||
limit: 10, | ||
dateRange: '7 DAY', | ||
orderBy: 'volume', | ||
}, | ||
}) | ||
const { | ||
data: { seriesInsightTable }, | ||
} = collections | ||
this.nfts = seriesInsightTable.map( | ||
(e: RowSeries): RowSeries => ({ | ||
...e, | ||
image: sanitizeIpfsUrl(e.image), | ||
}) | ||
) | ||
this.total = this.nfts.length | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
query popularCollectionList( | ||
$limit: Float | ||
$orderBy: String | ||
$dateRange: String | ||
$orderDirection: String | ||
) { | ||
seriesInsightTable( | ||
limit: $limit | ||
orderBy: $orderBy | ||
orderDirection: $orderDirection | ||
dateRange: $dateRange | ||
) { | ||
id | ||
image | ||
metadata | ||
sold | ||
name | ||
issuer | ||
total | ||
buys | ||
} | ||
} |