diff --git a/components/rmrk/Collection/List/CollectionList.vue b/components/rmrk/Collection/List/CollectionList.vue index b9cba62f00..d59d5a4a3d 100644 --- a/components/rmrk/Collection/List/CollectionList.vue +++ b/components/rmrk/Collection/List/CollectionList.vue @@ -33,7 +33,7 @@
@@ -65,7 +65,7 @@ import { getSanitizer } from '@/components/rmrk/utils' import { SearchQuery } from '@/components/rmrk/Gallery/Search/types' import 'lazysizes' -import collectionListWithSearch from '@/queries/collectionListWithSearch.graphql' +import collectionListWithSearch from '@/queries/rmrk/subsquid/collectionListWithSearch.graphql' import PrefixMixin from '~/utils/mixins/prefixMixin' import { mapOnlyMetadata } from '~/utils/mappers' import { @@ -105,15 +105,15 @@ export default class CollectionList extends mixins(PrefixMixin) { private searchQuery: SearchQuery = { search: '', type: '', - sortBy: 'BLOCK_NUMBER_DESC', + sortBy: 'blockNumber_DESC', listed: false, } private collectionSortOption: string[] = [ - 'BLOCK_NUMBER_DESC', - 'BLOCK_NUMBER_ASC', - 'UPDATED_AT_DESC', - 'UPDATED_AT_ASC', + 'blockNumber_DESC', + 'blockNumber_ASC', + 'updatedAt_DESC', + 'updatedAt_ASC', ] get isLoading(): boolean { @@ -129,7 +129,7 @@ export default class CollectionList extends mixins(PrefixMixin) { if (this.searchQuery.search) { params.push({ - name: { likeInsensitive: `%${this.searchQuery.search}%` }, + name_contains: this.searchQuery.search, }) } @@ -140,7 +140,7 @@ export default class CollectionList extends mixins(PrefixMixin) { this.$apollo.addSmartQuery('collection', { query: collectionListWithSearch, manual: true, - client: this.urlPrefix, + client: this.urlPrefix === 'rmrk' ? 'subsquid' : this.urlPrefix, loadingKey: 'isLoading', result: this.handleResult, variables: () => { @@ -156,17 +156,14 @@ export default class CollectionList extends mixins(PrefixMixin) { }, update: ({ collectionEntity }) => ({ ...collectionEntity, - nfts: collectionEntity.nfts.nodes, + nfts: collectionEntity.nfts, }), }) } protected async handleResult({ data }: any) { - this.total = data.collectionEntities.totalCount - this.collections = data.collectionEntities.nodes.map((e: any) => ({ - ...e, - })) - + this.total = data.stats.totalCount + this.collections = data.collectionEntities const metadataList: string[] = this.collections.map(mapOnlyMetadata) const imageLinks = await getCloudflareImageLinks(metadataList) @@ -187,7 +184,7 @@ export default class CollectionList extends mixins(PrefixMixin) { try { const collections = this.$apollo.query({ query: collectionListWithSearch, - client: this.urlPrefix, + client: this.urlPrefix === 'rmrk' ? 'subsquid' : this.urlPrefix, variables: { first: this.first, offset, @@ -196,7 +193,7 @@ export default class CollectionList extends mixins(PrefixMixin) { const { data: { - collectionEntities: { nodes: collectionList }, + collectionEntities: { collectionList }, }, } = await collections diff --git a/components/rmrk/Gallery/CollectionItem.vue b/components/rmrk/Gallery/CollectionItem.vue index 200f904987..984d55bda9 100644 --- a/components/rmrk/Gallery/CollectionItem.vue +++ b/components/rmrk/Gallery/CollectionItem.vue @@ -276,7 +276,7 @@ export default class CollectionItem extends mixins( if (this.searchQuery.search) { params.push({ - name: { likeInsensitive: `%${this.searchQuery.search}%` }, + name: `%${this.searchQuery.search}%`, }) } diff --git a/langDir/en.json b/langDir/en.json index 9cc49a28ec..642250ffe5 100644 --- a/langDir/en.json +++ b/langDir/en.json @@ -416,6 +416,10 @@ "BLOCK_NUMBER_ASC": "Old first", "UPDATED_AT_DESC": "Last interacted", "UPDATED_AT_ASC": "Least Interacted", + "blockNumber_DESC": "New first", + "blockNumber_ASC": "Old first", + "updatedAt_DESC": "Last interacted", + "updatedAt_ASC": "Least Interacted", "PRICE_DESC": "Price: High to Low", "PRICE_ASC": "Price: Low to High", "SN_ASC": "Serial Number Ascending", diff --git a/pages/rmrk/explore.vue b/pages/rmrk/explore.vue index c574cbec6c..c069b7c9a5 100644 --- a/pages/rmrk/explore.vue +++ b/pages/rmrk/explore.vue @@ -10,7 +10,7 @@ const components = { ExploreLayout, } -@Component({ +@Component({ components, head() { const title = 'Low minting fees and carbonless NFTs' @@ -27,5 +27,5 @@ const components = { } }, }) -export default class ExplorePage extends Vue {} +export default class ExploreRmrk extends Vue {} diff --git a/pages/westend/explore.vue b/pages/westend/explore.vue index 2706933397..9a7bb64d64 100644 --- a/pages/westend/explore.vue +++ b/pages/westend/explore.vue @@ -10,7 +10,7 @@ const components = { ExploreLayout, } -@Component({ +@Component({ components, head() { const title = 'Low minting fees and carbonless NFTs' @@ -18,7 +18,7 @@ const components = { title, type: 'profile', description: 'Buy Carbonless NFTs on Kusama', - url: '/rmrk/explore', + url: '/westend/explore', image: `${this.$config.baseUrl}/k_card_collections.png`, } return { @@ -27,5 +27,5 @@ const components = { } }, }) -export default class ExplorePage extends Vue {} +export default class ExploreWestend extends Vue {} diff --git a/pages/westmint/explore.vue b/pages/westmint/explore.vue index 2706933397..437dce237a 100644 --- a/pages/westmint/explore.vue +++ b/pages/westmint/explore.vue @@ -10,7 +10,7 @@ const components = { ExploreLayout, } -@Component({ +@Component({ components, head() { const title = 'Low minting fees and carbonless NFTs' @@ -18,7 +18,7 @@ const components = { title, type: 'profile', description: 'Buy Carbonless NFTs on Kusama', - url: '/rmrk/explore', + url: '/westmint/explore', image: `${this.$config.baseUrl}/k_card_collections.png`, } return { @@ -27,5 +27,5 @@ const components = { } }, }) -export default class ExplorePage extends Vue {} +export default class ExploreWestmint extends Vue {} diff --git a/queries/rmrk/subsquid/collectionListWithSearch.graphql b/queries/rmrk/subsquid/collectionListWithSearch.graphql new file mode 100644 index 0000000000..272912e3c1 --- /dev/null +++ b/queries/rmrk/subsquid/collectionListWithSearch.graphql @@ -0,0 +1,33 @@ +#import "../../fragments/collection.graphql" +#import "../../fragments/collectionDetails.graphql" + +query collectionListWithSearch( + $first: Int! + $offset: Int + $search: [CollectionEntityWhereInput!] + $orderBy: CollectionEntityOrderByInput = blockNumber_DESC +) { + collectionEntities( + orderBy: [$orderBy, blockNumber_DESC] + limit: $first + offset: $offset + where: { nfts_some: { burned_eq: false }, AND: $search } + ) { + ...collection + ...collectionDetails + nfts { + id + metadata + name + price + burned + currentOwner + } + } + stats: collectionEntitiesConnection( + where: { nfts_some: { burned_eq: false }, AND: $search } + orderBy: blockNumber_DESC + ) { + totalCount + } +}