@@ -19,14 +19,11 @@ import {
19
19
BadgeContainer ,
20
20
Row ,
21
21
VestingSlide ,
22
- EnsName ,
23
22
} from './vestingSlideStyles' ;
24
23
import { BigNumber } from 'ethers' ;
25
- import { AddressZero } from '@ethersproject/constants' ;
26
24
import { useModal } from '../walletModal' ;
27
25
import { encodeAddress } from '../addressModal' ;
28
- import { useENS } from '../addressModal' ;
29
- import { InlineLoader } from '@lidofinance/lido-ui' ;
26
+ import { VestingDelegateBadge } from './vestingDelegateBadge' ;
30
27
31
28
export type VestingSummarySlideProps = {
32
29
title ?: string ;
@@ -47,12 +44,11 @@ export const VestingSummarySlide: FC<VestingSummarySlideProps> = memo(
47
44
useAragonDelegateAddress ( vesting ?. escrow ) ;
48
45
const { data : snapshotDelegate , isLoading : snapshotDelegateIsLoading } =
49
46
useSnapshotDelegateAddress ( vesting ?. escrow ) ;
50
- const { data : ensName , isLoading : ensNameIsLoading } =
51
- useENS ( aragonDelegate ) ;
47
+
48
+ const delegateAddress =
49
+ showDelegation === 'snapshot' ? snapshotDelegate : aragonDelegate ;
50
+
52
51
const { data : token , isLoading : tokenIsLoading } = useVestingToken ( ) ;
53
- const { openModal : openDelegateModal } = useModal (
54
- encodeAddress ( aragonDelegate , 'delegate' ) ,
55
- ) ;
56
52
const { openModal : openEscrowModal } = useModal (
57
53
encodeAddress ( vesting ?. escrow , 'trp' ) ,
58
54
) ;
@@ -66,9 +62,6 @@ export const VestingSummarySlide: FC<VestingSummarySlideProps> = memo(
66
62
return null ;
67
63
}
68
64
69
- const delegate =
70
- showDelegation === 'snapshot' ? snapshotDelegate : aragonDelegate ;
71
-
72
65
if (
73
66
unclaimedIsLoading ||
74
67
lockedIsLoading ||
@@ -128,23 +121,7 @@ export const VestingSummarySlide: FC<VestingSummarySlideProps> = memo(
128
121
< DetailsHeader > Delegated to</ DetailsHeader >
129
122
</ Column >
130
123
< Column style = { { textAlign : 'right' } } >
131
- { delegate === AddressZero ? (
132
- 'Not delegated'
133
- ) : (
134
- < BadgeContainer >
135
- { ensNameIsLoading ? (
136
- < InlineLoader />
137
- ) : ! ensName ? (
138
- < Badge
139
- address = { delegate }
140
- title = { delegate }
141
- onClick = { openDelegateModal }
142
- />
143
- ) : (
144
- < EnsName onClick = { openDelegateModal } > { ensName } </ EnsName >
145
- ) }
146
- </ BadgeContainer >
147
- ) }
124
+ < VestingDelegateBadge delegateAddress = { delegateAddress } />
148
125
</ Column >
149
126
</ Row >
150
127
) }
0 commit comments