From 71658ef4b8603517ba55f702161cf5f5de6b1f96 Mon Sep 17 00:00:00 2001 From: hassnian Date: Mon, 24 Jun 2024 11:02:49 +0500 Subject: [PATCH 01/12] add(drops): created by user off chain profile --- components/collection/drop/CreatedBy.vue | 39 ++++++++++++------- components/identity/IdentityIndex.vue | 11 ++---- .../identity/module/IdentityPopoverFooter.vue | 10 ++--- components/identity/utils/useIdentityStats.ts | 16 +++++--- 4 files changed, 44 insertions(+), 32 deletions(-) diff --git a/components/collection/drop/CreatedBy.vue b/components/collection/drop/CreatedBy.vue index 7a16f77bcb..4981cce740 100644 --- a/components/collection/drop/CreatedBy.vue +++ b/components/collection/drop/CreatedBy.vue @@ -1,19 +1,23 @@ diff --git a/components/identity/IdentityIndex.vue b/components/identity/IdentityIndex.vue index 91eb551c15..9a8914f1f1 100644 --- a/components/identity/IdentityIndex.vue +++ b/components/identity/IdentityIndex.vue @@ -63,15 +63,12 @@ const showIdentityBadge = computed(() => Boolean(props.showBadge && hasIdentity.value), ) -provide('address', props.address) provide( - 'shortenedAddress', - computed(() => shortenedAddress.value), -) -provide( - 'identity', - computed(() => identity.value), + 'address', + computed(() => props.address), ) +provide('shortenedAddress', shortenedAddress) +provide('identity', identity) const emit = defineEmits(['change']) diff --git a/components/identity/module/IdentityPopoverFooter.vue b/components/identity/module/IdentityPopoverFooter.vue index 3f7d3639fd..9cea4e6695 100644 --- a/components/identity/module/IdentityPopoverFooter.vue +++ b/components/identity/module/IdentityPopoverFooter.vue @@ -57,7 +57,7 @@ const GalleryCard = defineAsyncComponent( const NFT_AMOUNT = 2 -const address = inject('address') as string +const address = inject('address') as ComputedRef const { urlPrefix } = usePrefix() const { totalCreated } = useIdentityStats({ @@ -68,7 +68,7 @@ const { data: followersData, refresh, pending: loading, -} = useAsyncData(() => fetchFollowersOf(address)) +} = useAsyncData(() => fetchFollowersOf(address.value)) const followers = computed(() => loading.value ? 0 : followersData.value?.totalCount || 0, @@ -82,12 +82,12 @@ const { data } = useSearchNfts({ OR: [ { // created - issuer_eq: address, + issuer_eq: address.value, }, { // bought - issuer_not_eq: address, - currentOwner_eq: address, + issuer_not_eq: address.value, + currentOwner_eq: address.value, }, ], }, diff --git a/components/identity/utils/useIdentityStats.ts b/components/identity/utils/useIdentityStats.ts index 16b0ef927e..f0e3ce4a33 100644 --- a/components/identity/utils/useIdentityStats.ts +++ b/components/identity/utils/useIdentityStats.ts @@ -4,7 +4,7 @@ import { useIdentityMintStore } from '@/stores/identityMint' import { formatToNow } from '@/utils/format/time' import buyEventByProfile from '@/queries/subsquid/general/buyEventByProfile.query' -const useLastBought = ({ address }) => { +const useLastBought = ({ address }: { address: Ref }) => { const lastBoughtDate = ref(new Date()) const { data } = useAsyncQuery({ @@ -48,14 +48,18 @@ const cacheTotalCount = ({ data, totalCreated }) => { created: { totalCount: totalCreated, }, - firstMintDate: data.value?.firstMint[0]?.createdAt || new Date(), + firstMintDate: data?.value?.firstMint[0]?.createdAt || new Date(), updatedAt: Date.now(), } return cacheData } -export default function useIdentityStats({ address }) { +export default function useIdentityStats({ + address, +}: { + address: Ref +}) { const identityMintStore = useIdentityMintStore() const totalCreated = ref(0) @@ -65,7 +69,7 @@ export default function useIdentityStats({ address }) { const { data: stats } = useGraphql({ queryName: 'userStatsByAccount', variables: { - account: address, + account: address.value, }, }) @@ -88,14 +92,14 @@ export default function useIdentityStats({ address }) { firstMintDate.value = cacheData.firstMintDate identityMintStore.setIdentity({ - address, + address: address.value, cacheData, }) } const fetchNFTStats = () => { // if cache exist and within 12h - const data = identityMintStore.getIdentityMintFor(address) + const data = identityMintStore.getIdentityMintFor(address.value) if (data?.updatedAt && isAfter(data.updatedAt, subHours(Date.now(), 12))) { return handleNFTStats({ data, type: 'cache' }) } From 9277eefbc448cce9904b3f887d46cc9a8bbe4813 Mon Sep 17 00:00:00 2001 From: hassnian Date: Mon, 24 Jun 2024 15:49:22 +0500 Subject: [PATCH 02/12] add(drops): artist_address from worker --- components/collection/drop/GenerativeLayout.vue | 4 +++- params/types.ts | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/components/collection/drop/GenerativeLayout.vue b/components/collection/drop/GenerativeLayout.vue index 746bb871a4..d651bf05c1 100644 --- a/components/collection/drop/GenerativeLayout.vue +++ b/components/collection/drop/GenerativeLayout.vue @@ -100,7 +100,9 @@ const { collection: collectionInfo } = useCollectionMinimal({ const divider = ref() -const address = computed(() => collectionInfo.value?.currentOwner) +const address = computed( + () => drop.value?.artist_address || collectionInfo.value?.currentOwner, +) const { owners } = useCollectionActivity({ collectionId: computed(() => drop.value?.collection), diff --git a/params/types.ts b/params/types.ts index 726567513d..da16386363 100644 --- a/params/types.ts +++ b/params/types.ts @@ -80,4 +80,5 @@ export type DropItem = { userLocation?: string userAccess?: boolean start_at?: string + artist_address?: string } From 856f9119f3a414d15aec34b3e01b8cbe3fe1d7d0 Mon Sep 17 00:00:00 2001 From: hassnian Date: Tue, 25 Jun 2024 08:28:48 +0500 Subject: [PATCH 03/12] add(GenerativeLayout.vue): hide created by if artist_address is not provided --- components/collection/drop/GenerativeLayout.vue | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/components/collection/drop/GenerativeLayout.vue b/components/collection/drop/GenerativeLayout.vue index d651bf05c1..a4c7e55d47 100644 --- a/components/collection/drop/GenerativeLayout.vue +++ b/components/collection/drop/GenerativeLayout.vue @@ -5,11 +5,11 @@
-
+
{{ $t('tooltip.created') }}
- +
@@ -100,9 +100,7 @@ const { collection: collectionInfo } = useCollectionMinimal({ const divider = ref() -const address = computed( - () => drop.value?.artist_address || collectionInfo.value?.currentOwner, -) +const address = computed(() => drop.value?.artist_address) const { owners } = useCollectionActivity({ collectionId: computed(() => drop.value?.collection), From 28a69fc3b5c6074b74b89abc0b03640891b834a7 Mon Sep 17 00:00:00 2001 From: hassnian Date: Tue, 25 Jun 2024 12:37:46 +0500 Subject: [PATCH 04/12] add(drops): drop v2.5 card with chain and artist profile --- components/drops/BasicDropCard.vue | 35 +++++++++++++++++---- components/drops/DropCard.vue | 4 ++- components/drops/DropCardSkeleton.vue | 9 ++++-- components/drops/calendar/DropsCalendar.vue | 2 ++ components/drops/useDrops.ts | 1 + composables/useIcon.ts | 22 ++++++++++++- public/chain/ahp.svg | 3 ++ public/chain/base.svg | 10 ++++++ services/fxart.ts | 1 + 9 files changed, 77 insertions(+), 10 deletions(-) create mode 100644 public/chain/ahp.svg create mode 100644 public/chain/base.svg diff --git a/components/drops/BasicDropCard.vue b/components/drops/BasicDropCard.vue index bb9015c122..935cb9f685 100644 --- a/components/drops/BasicDropCard.vue +++ b/components/drops/BasicDropCard.vue @@ -16,10 +16,28 @@
- {{ name }} +
+
+ {{ name }} +
+ chain icon + {{ dropPrefix }} +
+
+ +
+ + +
+
@@ -52,13 +70,13 @@ import type { Prefix } from '@kodadot1/static' import { DropStatus } from '@/components/drops/useDrops' const emit = defineEmits(['click']) -withDefaults( +const props = withDefaults( defineProps<{ image: string | undefined name: string dropStartTime?: Date | null dropStatus: DropStatus - dropPrefix?: Prefix + dropPrefix?: Prefix | null loading?: boolean cardIs?: string | object to?: string @@ -66,6 +84,7 @@ withDefaults( dropMax?: number minted?: number ownerAddresses?: string[] + artistAddress?: string | null }>(), { loading: false, @@ -76,11 +95,15 @@ withDefaults( minted: 0, dropMax: 0, timeTagWithTime: false, + artistAddress: undefined, ownerAddresses: () => [], }, ) const { placeholder } = useTheme() +const { getChainIcon } = useIcon() + +const dropIcon = computed(() => getChainIcon(props.dropPrefix))