Skip to content
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

feat: Add skeleton loader for followers in hover card #10990

Merged
merged 2 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 23 additions & 7 deletions components/identity/module/IdentityPopoverFooter.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
<template>
<div class="flex flex-col gap-4">
<div class="flex justify-between">
<div class="flex flex-row gap-1 items-center">
<div v-if="statsLoading">
<NeoSkeleton
width="100px"
no-margin
/>
</div>
<div
v-else
class="flex flex-row gap-1 items-center"
>
<p
class="text-base"
data-testid="identity-created"
Expand All @@ -14,7 +23,16 @@
}}</span>
</div>

<div class="flex flex-row gap-1 items-center">
<div v-if="followersLoading">
<NeoSkeleton
width="100px"
no-margin
/>
</div>
<div
v-else
class="flex flex-row gap-1 items-center"
>
<p
class="text-base"
data-testid="identity-followers"
Expand Down Expand Up @@ -76,21 +94,19 @@ const NFT_AMOUNT = 2
const address = inject('address') as ComputedRef<string>

const { urlPrefix } = usePrefix()
const { totalCreated } = useIdentityStats({
const { totalCreated, loading: statsLoading } = useIdentityStats({
address,
})

const {
data: followersData,
refresh,
pending: loading,
pending: followersLoading,
} = useAsyncData(`followers-${address.value}`, () =>
fetchFollowersOf(address.value),
)

const followers = computed(() =>
loading.value ? 0 : followersData.value?.totalCount || 0,
)
const followers = computed(() => followersData.value?.totalCount || 0)

const { data } = useSearchNfts({
search: [
Expand Down
3 changes: 2 additions & 1 deletion components/identity/utils/useIdentityStats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default function useIdentityStats({
const firstMintDate = ref(new Date())

const { lastBoughtDate } = useLastBought({ address })
const { data: stats } = useGraphql({
const { data: stats, loading } = useGraphql({
queryName: 'userStatsByAccount',
variables: {
account: address.value,
Expand Down Expand Up @@ -113,5 +113,6 @@ export default function useIdentityStats({
totalCreated,
lastBought,
startedMinting,
loading,
}
}
Loading