Skip to content

Commit db8b63a

Browse files
authored
feat: load statement in delegation dashboard (#4892)
* feat: load statement in delegation dashboard * feat: load user profiles for delegators * fix: truncate too long delegator user name * fix: grow div
1 parent 75ea2b2 commit db8b63a

File tree

2 files changed

+39
-31
lines changed

2 files changed

+39
-31
lines changed

src/components/SpaceDelegatesCard.vue

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,38 @@ function handleDropdownAction(action: string) {
6262
class="flex h-full w-full flex-col justify-between rounded-xl border border-skin-border px-3 pb-3 pt-[12px] md:px-3 md:pb-3 md:pt-[12px]"
6363
@click="emit('clickUser')"
6464
>
65-
<div class="flex w-full justify-between">
66-
<div class="flex items-center text-left">
67-
<AvatarUser :address="delegate.id" size="40" />
68-
<div class="ml-3">
69-
<div class="font-semibold text-skin-heading">
70-
{{ getUsername(delegate.id, profiles[delegate.id]) }}
65+
<div class="flex w-full">
66+
<div class="flex items-center text-left gap-3 flex-auto min-w-0">
67+
<AvatarUser :address="delegate.id" size="40" class="shrink-0" />
68+
<div class="flex flex-col truncate grow">
69+
<div class="flex truncate gap-1">
70+
<div class="font-semibold text-skin-heading truncate flex-auto">
71+
{{ getUsername(delegate.id, profiles[delegate.id]) }}
72+
</div>
73+
<BaseMenu
74+
:items="dropdownItems"
75+
@select="handleDropdownAction($event)"
76+
@click.stop
77+
>
78+
<template #button>
79+
<BaseButtonIcon class="-mr-[6px] !h-[24px]">
80+
<i-ho-dots-horizontal class="text-[17px]" />
81+
</BaseButtonIcon>
82+
</template>
83+
<template #item="{ item }">
84+
<div class="w-[170px] text-skin-link">
85+
<span class="flex items-center gap-1">
86+
{{ item.text }}
87+
<i-ho-external-link
88+
v-if="item.action === 'seeExplorer'"
89+
class="text-sm"
90+
/>
91+
</span>
92+
</div>
93+
</template>
94+
</BaseMenu>
7195
</div>
72-
<div class="flex gap-[6px]">
96+
<div class="flex gap-x-[6px] flex-wrap">
7397
<div
7498
v-tippy="{
7599
content: `${formatNumber(
@@ -98,28 +122,6 @@ function handleDropdownAction(action: string) {
98122
</div>
99123
</div>
100124
</div>
101-
<BaseMenu
102-
:items="dropdownItems"
103-
@select="handleDropdownAction($event)"
104-
@click.stop
105-
>
106-
<template #button>
107-
<BaseButtonIcon class="-mr-[6px] !h-[24px]">
108-
<i-ho-dots-horizontal class="text-[17px]" />
109-
</BaseButtonIcon>
110-
</template>
111-
<template #item="{ item }">
112-
<div class="w-[170px] text-skin-link">
113-
<span class="flex items-center gap-1">
114-
{{ item.text }}
115-
<i-ho-external-link
116-
v-if="item.action === 'seeExplorer'"
117-
class="text-sm"
118-
/>
119-
</span>
120-
</div>
121-
</template>
122-
</BaseMenu>
123125
</div>
124126

125127
<div class="mt-3 h-[48px] cursor-pointer">

src/views/SpaceDelegates.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ const {
2323
hasDelegatesLoadFailed,
2424
hasDelegationPortal
2525
} = useDelegates(props.space);
26-
const { profiles } = useProfiles();
26+
const { profiles, loadProfiles } = useProfiles();
2727
const { modalAccountOpen } = useModal();
2828
const route = useRoute();
2929
const router = useRouter();
3030
const { t } = useI18n();
3131
const { isFollowing } = useFollowSpace(props.space.id);
3232
const { web3Account } = useWeb3();
33-
const { getStatement } = useStatement();
33+
const { getStatement, loadStatements } = useStatement();
3434
3535
const searchInput = ref((route.query.search as string) || '');
3636
const searchInputDebounced = refDebounced(searchInput, 300);
@@ -138,6 +138,12 @@ watch(matchFilter, () => {
138138
loadDelegates(matchFilter.value);
139139
});
140140
141+
watch(delegates, delegates => {
142+
const ids = delegates.map(d => d.id);
143+
loadStatements(props.space.id, ids);
144+
loadProfiles(ids);
145+
});
146+
141147
onMounted(() => {
142148
if (!hasDelegationPortal) return;
143149

0 commit comments

Comments
 (0)