From b11a9aa4addb439c4bea6641818097d29506b937 Mon Sep 17 00:00:00 2001 From: hassnian Date: Tue, 5 Dec 2023 14:44:37 +0500 Subject: [PATCH 01/65] add: profile collection filter working --- assets/styles/global.scss | 7 + components/explore/ActiveCount.vue | 16 +- components/profile/CollectionFilter.vue | 159 ++++++++++++++++++++ components/profile/ProfileDetail.vue | 28 +++- libs/ui/src/scss/tailwind.scss | 3 + queries/fragments/collectionDetails.graphql | 3 + 6 files changed, 210 insertions(+), 6 deletions(-) create mode 100644 components/profile/CollectionFilter.vue diff --git a/assets/styles/global.scss b/assets/styles/global.scss index 98bf9938a3..b91d72800c 100644 --- a/assets/styles/global.scss +++ b/assets/styles/global.scss @@ -440,6 +440,9 @@ a.has-text-grey { background-color: theme('k-redaccent'); } } +.k-grey-light { + background-color: var(--k-grey-light) !important; +} .theme-background-color { @include ktheme() { background-color: theme('background-color'); @@ -572,3 +575,7 @@ a.has-text-grey { .has-text-inherit { color: inherit !important; } + +.min-width-0 { + min-width: 0; +} \ No newline at end of file diff --git a/components/explore/ActiveCount.vue b/components/explore/ActiveCount.vue index d1950f830b..c477185b56 100644 --- a/components/explore/ActiveCount.vue +++ b/components/explore/ActiveCount.vue @@ -2,7 +2,7 @@
+ :class="[`count--${position}`, { rounded: rounded }]"> {{ count }}
@@ -12,10 +12,12 @@ withDefaults( defineProps<{ count?: number rounded?: boolean + position?: string }>(), { rounded: false, count: 0, + position: 'top-left' as 'top-left' | 'top-right', }, ) @@ -25,13 +27,21 @@ withDefaults( .count { position: absolute; - bottom: 1.5rem; - left: -0.75rem; height: 1.5rem; width: 1.5rem; line-height: 1.5rem; text-align: center; + &--top-left { + bottom: 1.5rem; + left: -0.75rem; + } + + &--top-right { + bottom: 1.5rem; + right: -0.75rem; + } + @include ktheme() { border: 1px solid theme('border-color'); background: theme('k-primary'); diff --git a/components/profile/CollectionFilter.vue b/components/profile/CollectionFilter.vue new file mode 100644 index 0000000000..186257595a --- /dev/null +++ b/components/profile/CollectionFilter.vue @@ -0,0 +1,159 @@ + + + + + diff --git a/components/profile/ProfileDetail.vue b/components/profile/ProfileDetail.vue index 4e6dee70d9..6e28f811f7 100644 --- a/components/profile/ProfileDetail.vue +++ b/components/profile/ProfileDetail.vue @@ -149,6 +149,12 @@ :label="$t('activity.sold')" url-param="sold" class="ml-4" /> + +
@@ -187,6 +193,7 @@ import { useListingCartStore } from '@/stores/listingCart' import resolveQueryPath from '@/utils/queryPathResolver' import { chainsWithMintInteraction } from '@/composables/collectionActivity/helpers' import { Interaction } from '@kodadot1/minimark/v1' +import CollectionFilter from './CollectionFilter.vue' enum ProfileTab { OWNED = 'owned', @@ -226,11 +233,13 @@ const legal = ref('') const riot = ref('') const isModalActive = ref(false) +const tabKey = computed(() => + activeTab.value === ProfileTab.OWNED ? 'currentOwner_eq' : 'issuer_eq', +) + const itemsGridSearch = computed(() => { - const tabKey = - activeTab.value === ProfileTab.OWNED ? 'currentOwner_eq' : 'issuer_eq' const query: Record = { - [tabKey]: id.value, + [tabKey.value]: id.value, } if (listed.value) { @@ -243,6 +252,19 @@ const itemsGridSearch = computed(() => { } } + const collections = route.query.collections + ?.toString() + .split(',') + .filter(Boolean) + + if (collections?.length !== 0) { + query['collection'] = { + id_in: collections, + } + } + + console.log('new saearch') + return query }) diff --git a/libs/ui/src/scss/tailwind.scss b/libs/ui/src/scss/tailwind.scss index e5947797c1..6189a225f8 100644 --- a/libs/ui/src/scss/tailwind.scss +++ b/libs/ui/src/scss/tailwind.scss @@ -31,6 +31,7 @@ --k-red-accent-2: #ffe6e6; --k-grey: #999999; --k-grey-fix: #999999; + --k-grey-light: #D9D9D9; --k-pink: #ffb6ef; --k-yellow: #feffb6; --k-blue-accent: #b6cbff; @@ -77,6 +78,7 @@ --k-red-accent-2: #390b0b; --k-grey: #cccccc; --k-grey-fix: #999999; + --k-grey-light: #454545; --k-pink: #7a2a68; --k-yellow: #363234; --k-blue-accent: #2e50a2; @@ -119,6 +121,7 @@ --k-red-accent-2: #390b0b; --k-grey: #cccccc; --k-grey-fix: #999999; + --k-grey-light: #454545; --k-pink: #7a2a68; --k-yellow: #363234; --k-blue-accent: #2e50a2; diff --git a/queries/fragments/collectionDetails.graphql b/queries/fragments/collectionDetails.graphql index 86922f6da7..42568f0c0c 100644 --- a/queries/fragments/collectionDetails.graphql +++ b/queries/fragments/collectionDetails.graphql @@ -1,4 +1,7 @@ fragment collectionDetails on CollectionEntity { name + meta { + image + } # max } From 79d252cb8c7401ef23758a6fc3837fddba558479 Mon Sep 17 00:00:00 2001 From: hassnian Date: Tue, 5 Dec 2023 16:15:26 +0500 Subject: [PATCH 02/65] fix: collection clear on tab change --- assets/styles/global.scss | 4 ++ components/profile/CollectionFilter.vue | 72 +++++++++++++------------ components/profile/ProfileDetail.vue | 2 - 3 files changed, 41 insertions(+), 37 deletions(-) diff --git a/assets/styles/global.scss b/assets/styles/global.scss index b91d72800c..187063295a 100644 --- a/assets/styles/global.scss +++ b/assets/styles/global.scss @@ -578,4 +578,8 @@ a.has-text-grey { .min-width-0 { min-width: 0; +} + +.pointer-events-none { + pointer-events: none !important; } \ No newline at end of file diff --git a/components/profile/CollectionFilter.vue b/components/profile/CollectionFilter.vue index 186257595a..c71ff2a9c9 100644 --- a/components/profile/CollectionFilter.vue +++ b/components/profile/CollectionFilter.vue @@ -3,7 +3,6 @@ v-model="checked" :disabled="collections.length === 0" class="py-0" - scrollable :mobile-modal="false" :close-on-click="false" multiple> @@ -18,40 +17,41 @@ - - - -
- +
+ +
-
- {{ collection.name || collection.id }} -
- + class="is-flex is-align-items-center filter-container pl-2 is-flex-grow-1 min-width-0"> +
-
{{ $t('search.owners') }}: {{ collection.owners }}
+ class="is-flex is-flex-direction-column is-flex-grow-1 min-width-0"> +
+ {{ collection.name || collection.id }} +
+ +
+
{{ $t('search.owners') }}: {{ collection.owners }}
+
-
-
- {{ collection.owned }} +
+ {{ collection.owned }} +
-
- + +
@@ -66,6 +66,7 @@ import collectionListWithSearch from '@/queries/subsquid/general/collectionListW import ActiveCount from '../explore/ActiveCount.vue' import { CollectionEntityMinimal } from '@/components/collection/utils/types' import { getDenyList } from '@/utils/prefix' +import isEqual from 'lodash/isEqual' type Collection = CollectionEntityMinimal & { owners: number @@ -82,7 +83,6 @@ const checked = ref([]) const { urlPrefix, client } = usePrefix() const { replaceUrl } = useReplaceUrl() -const { accountId } = useAuth() const collections = ref([]) @@ -125,7 +125,7 @@ const formatCollections = (collectionEntities) => { ...collection, owners: new Set(currentOwners).size, owned: currentOwners.filter( - (currentOwner: string) => accountId.value === currentOwner, + (currentOwner: string) => props.id === currentOwner, ).length, } }) @@ -139,11 +139,13 @@ watch(checked, (value) => { replaceUrl({ collections: value.toString() }) }) -watch(nonCollectionSearchParams, (x, y) => console.log(x, y)) - watch( [() => props.tabKey, nonCollectionSearchParams], - () => { + ([tabKey, search], [oldTabKey, oldSearch]) => { + if (isEqual(search, oldSearch) || tabKey === oldTabKey) { + return + } + checked.value = [] collections.value = [] getProfileCollections() diff --git a/components/profile/ProfileDetail.vue b/components/profile/ProfileDetail.vue index 6e28f811f7..96fbe9229f 100644 --- a/components/profile/ProfileDetail.vue +++ b/components/profile/ProfileDetail.vue @@ -263,8 +263,6 @@ const itemsGridSearch = computed(() => { } } - console.log('new saearch') - return query }) From c89ee33129e23df480ca6f0ff731b464b40a8590 Mon Sep 17 00:00:00 2001 From: hassnian Date: Tue, 5 Dec 2023 16:47:24 +0500 Subject: [PATCH 03/65] fix: modal width --- components/profile/CollectionFilter.vue | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/components/profile/CollectionFilter.vue b/components/profile/CollectionFilter.vue index c71ff2a9c9..51528b9387 100644 --- a/components/profile/CollectionFilter.vue +++ b/components/profile/CollectionFilter.vue @@ -3,7 +3,7 @@ v-model="checked" :disabled="collections.length === 0" class="py-0" - :mobile-modal="false" + :mobile-modal="true" :close-on-click="false" multiple> -
+
From ea62f1b426bc0a123978a20d08d21a7636c0ee12 Mon Sep 17 00:00:00 2001 From: hassnian Date: Tue, 5 Dec 2023 17:37:49 +0500 Subject: [PATCH 04/65] fix: profile tab change reset filters --- components/profile/CollectionFilter.vue | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/components/profile/CollectionFilter.vue b/components/profile/CollectionFilter.vue index 51528b9387..8a28f0be19 100644 --- a/components/profile/CollectionFilter.vue +++ b/components/profile/CollectionFilter.vue @@ -98,7 +98,7 @@ useLazyAsyncData('profileCollections', async () => { const getProfileCollections = async () => { const collectionSearch = { - nfts_some: props.search, + nfts_some: nonCollectionSearchParams.value, } const { data } = await useAsyncQuery({ @@ -140,14 +140,13 @@ watch(checked, (value) => { }) watch( - [() => props.tabKey, nonCollectionSearchParams], - ([tabKey, search], [oldTabKey, oldSearch]) => { - if (isEqual(search, oldSearch) || tabKey === oldTabKey) { - return + [() => props.tabKey, () => props.search], + ([, search], [, oldSearch]) => { + if (isEqual(search.collection, oldSearch.collection)) { + checked.value = [] + collections.value = [] } - checked.value = [] - collections.value = [] getProfileCollections() }, { deep: true }, From 69485474891106ae2a204d2bffa13eaa177b6ff1 Mon Sep 17 00:00:00 2001 From: hassnian Date: Thu, 7 Dec 2023 12:07:13 +0500 Subject: [PATCH 05/65] ref: pr review --- components/profile/CollectionFilter.vue | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/components/profile/CollectionFilter.vue b/components/profile/CollectionFilter.vue index 8a28f0be19..d6b50cbc04 100644 --- a/components/profile/CollectionFilter.vue +++ b/components/profile/CollectionFilter.vue @@ -17,7 +17,7 @@ -
+