Skip to content

Commit 7a49c81

Browse files
authored
Merge pull request #35 from lidofinance/fix/components
feat: update overview data, fix pagination, fix switcher
2 parents e002442 + 1bfd478 commit 7a49c81

File tree

34 files changed

+987
-202
lines changed

34 files changed

+987
-202
lines changed

abi/vault-viewer.ts

Lines changed: 197 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,137 @@
11
export const VaultViewerAbi = [
22
{
33
inputs: [
4-
{ internalType: 'address', name: '_vaultHubAddress', type: 'address' },
4+
{
5+
internalType: 'address',
6+
name: '_vaultHubAddress',
7+
type: 'address',
8+
},
59
],
610
stateMutability: 'nonpayable',
711
type: 'constructor',
812
},
913
{
1014
inputs: [
11-
{ internalType: 'uint256', name: '_from', type: 'uint256' },
12-
{ internalType: 'uint256', name: '_to', type: 'uint256' },
15+
{
16+
internalType: 'uint256',
17+
name: '_from',
18+
type: 'uint256',
19+
},
20+
{
21+
internalType: 'uint256',
22+
name: '_to',
23+
type: 'uint256',
24+
},
1325
],
1426
name: 'WrongPaginationRange',
1527
type: 'error',
1628
},
1729
{
18-
inputs: [{ internalType: 'string', name: 'argName', type: 'string' }],
30+
inputs: [
31+
{
32+
internalType: 'string',
33+
name: 'argName',
34+
type: 'string',
35+
},
36+
],
1937
name: 'ZeroArgument',
2038
type: 'error',
2139
},
2240
{
2341
inputs: [],
2442
name: 'DEFAULT_ADMIN_ROLE',
25-
outputs: [{ internalType: 'bytes32', name: '', type: 'bytes32' }],
43+
outputs: [
44+
{
45+
internalType: 'bytes32',
46+
name: '',
47+
type: 'bytes32',
48+
},
49+
],
2650
stateMutability: 'view',
2751
type: 'function',
2852
},
2953
{
3054
inputs: [
31-
{ internalType: 'contract IVault', name: 'vault', type: 'address' },
32-
{ internalType: 'address', name: '_member', type: 'address' },
33-
{ internalType: 'bytes32', name: '_role', type: 'bytes32' },
55+
{
56+
internalType: 'contract IVault',
57+
name: 'vault',
58+
type: 'address',
59+
},
60+
{
61+
internalType: 'address',
62+
name: '_member',
63+
type: 'address',
64+
},
65+
{
66+
internalType: 'bytes32',
67+
name: '_role',
68+
type: 'bytes32',
69+
},
3470
],
3571
name: 'hasRole',
36-
outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
72+
outputs: [
73+
{
74+
internalType: 'bool',
75+
name: '',
76+
type: 'bool',
77+
},
78+
],
3779
stateMutability: 'view',
3880
type: 'function',
3981
},
4082
{
41-
inputs: [{ internalType: 'address', name: 'account', type: 'address' }],
83+
inputs: [
84+
{
85+
internalType: 'address',
86+
name: 'account',
87+
type: 'address',
88+
},
89+
],
4290
name: 'isContract',
43-
outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
91+
outputs: [
92+
{
93+
internalType: 'bool',
94+
name: '',
95+
type: 'bool',
96+
},
97+
],
4498
stateMutability: 'view',
4599
type: 'function',
46100
},
47101
{
48102
inputs: [
49-
{ internalType: 'contract IVault', name: 'vault', type: 'address' },
50-
{ internalType: 'address', name: '_owner', type: 'address' },
103+
{
104+
internalType: 'contract IVault',
105+
name: 'vault',
106+
type: 'address',
107+
},
108+
{
109+
internalType: 'address',
110+
name: '_owner',
111+
type: 'address',
112+
},
51113
],
52114
name: 'isOwner',
53-
outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
115+
outputs: [
116+
{
117+
internalType: 'bool',
118+
name: '',
119+
type: 'bool',
120+
},
121+
],
54122
stateMutability: 'view',
55123
type: 'function',
56124
},
57125
{
58126
inputs: [],
59127
name: 'vaultHub',
60-
outputs: [{ internalType: 'contract VaultHub', name: '', type: 'address' }],
128+
outputs: [
129+
{
130+
internalType: 'contract VaultHub',
131+
name: '',
132+
type: 'address',
133+
},
134+
],
61135
stateMutability: 'view',
62136
type: 'function',
63137
},
@@ -72,7 +146,7 @@ export const VaultViewerAbi = [
72146
name: 'vaultState',
73147
outputs: [
74148
{
75-
internalType: 'enum VaultDataViewer.VaultState',
149+
internalType: 'enum VaultViewer.VaultState',
76150
name: '',
77151
type: 'uint8',
78152
},
@@ -81,51 +155,117 @@ export const VaultViewerAbi = [
81155
type: 'function',
82156
},
83157
{
84-
inputs: [{ internalType: 'address', name: '_owner', type: 'address' }],
158+
inputs: [
159+
{
160+
internalType: 'address',
161+
name: '_owner',
162+
type: 'address',
163+
},
164+
],
85165
name: 'vaultsByOwner',
86166
outputs: [
87-
{ internalType: 'contract IVault[]', name: '', type: 'address[]' },
167+
{
168+
internalType: 'contract IVault[]',
169+
name: '',
170+
type: 'address[]',
171+
},
88172
],
89173
stateMutability: 'view',
90174
type: 'function',
91175
},
92176
{
93177
inputs: [
94-
{ internalType: 'address', name: '_owner', type: 'address' },
95-
{ internalType: 'uint256', name: '_from', type: 'uint256' },
96-
{ internalType: 'uint256', name: '_to', type: 'uint256' },
178+
{
179+
internalType: 'address',
180+
name: '_owner',
181+
type: 'address',
182+
},
183+
{
184+
internalType: 'uint256',
185+
name: '_from',
186+
type: 'uint256',
187+
},
188+
{
189+
internalType: 'uint256',
190+
name: '_to',
191+
type: 'uint256',
192+
},
97193
],
98194
name: 'vaultsByOwnerBound',
99195
outputs: [
100-
{ internalType: 'contract IVault[]', name: '', type: 'address[]' },
101-
{ internalType: 'uint256', name: '', type: 'uint256' },
196+
{
197+
internalType: 'contract IVault[]',
198+
name: '',
199+
type: 'address[]',
200+
},
201+
{
202+
internalType: 'uint256',
203+
name: '',
204+
type: 'uint256',
205+
},
102206
],
103207
stateMutability: 'view',
104208
type: 'function',
105209
},
106210
{
107211
inputs: [
108-
{ internalType: 'bytes32', name: '_role', type: 'bytes32' },
109-
{ internalType: 'address', name: '_member', type: 'address' },
212+
{
213+
internalType: 'bytes32',
214+
name: '_role',
215+
type: 'bytes32',
216+
},
217+
{
218+
internalType: 'address',
219+
name: '_member',
220+
type: 'address',
221+
},
110222
],
111223
name: 'vaultsByRole',
112224
outputs: [
113-
{ internalType: 'contract IVault[]', name: '', type: 'address[]' },
225+
{
226+
internalType: 'contract IVault[]',
227+
name: '',
228+
type: 'address[]',
229+
},
114230
],
115231
stateMutability: 'view',
116232
type: 'function',
117233
},
118234
{
119235
inputs: [
120-
{ internalType: 'bytes32', name: '_role', type: 'bytes32' },
121-
{ internalType: 'address', name: '_member', type: 'address' },
122-
{ internalType: 'uint256', name: '_from', type: 'uint256' },
123-
{ internalType: 'uint256', name: '_to', type: 'uint256' },
236+
{
237+
internalType: 'bytes32',
238+
name: '_role',
239+
type: 'bytes32',
240+
},
241+
{
242+
internalType: 'address',
243+
name: '_member',
244+
type: 'address',
245+
},
246+
{
247+
internalType: 'uint256',
248+
name: '_from',
249+
type: 'uint256',
250+
},
251+
{
252+
internalType: 'uint256',
253+
name: '_to',
254+
type: 'uint256',
255+
},
124256
],
125257
name: 'vaultsByRoleBound',
126258
outputs: [
127-
{ internalType: 'contract IVault[]', name: '', type: 'address[]' },
128-
{ internalType: 'uint256', name: '', type: 'uint256' },
259+
{
260+
internalType: 'contract IVault[]',
261+
name: '',
262+
type: 'address[]',
263+
},
264+
{
265+
internalType: 'uint256',
266+
name: '',
267+
type: 'uint256',
268+
},
129269
],
130270
stateMutability: 'view',
131271
type: 'function',
@@ -134,20 +274,40 @@ export const VaultViewerAbi = [
134274
inputs: [],
135275
name: 'vaultsConnected',
136276
outputs: [
137-
{ internalType: 'contract IVault[]', name: '', type: 'address[]' },
277+
{
278+
internalType: 'contract IVault[]',
279+
name: '',
280+
type: 'address[]',
281+
},
138282
],
139283
stateMutability: 'view',
140284
type: 'function',
141285
},
142286
{
143287
inputs: [
144-
{ internalType: 'uint256', name: '_from', type: 'uint256' },
145-
{ internalType: 'uint256', name: '_to', type: 'uint256' },
288+
{
289+
internalType: 'uint256',
290+
name: '_from',
291+
type: 'uint256',
292+
},
293+
{
294+
internalType: 'uint256',
295+
name: '_to',
296+
type: 'uint256',
297+
},
146298
],
147299
name: 'vaultsConnectedBound',
148300
outputs: [
149-
{ internalType: 'contract IVault[]', name: '', type: 'address[]' },
150-
{ internalType: 'uint256', name: '', type: 'uint256' },
301+
{
302+
internalType: 'contract IVault[]',
303+
name: '',
304+
type: 'address[]',
305+
},
306+
{
307+
internalType: 'uint256',
308+
name: '',
309+
type: 'uint256',
310+
},
151311
],
152312
stateMutability: 'view',
153313
type: 'function',

features/adjustment/adjustment-tabs.tsx

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,33 @@
1-
import { useRouter } from 'next/router';
21
import { useAdjustment } from 'features/adjustment/contexts/adjustment-provider';
32
import { useVaultInfo } from 'features/overview/contexts';
43

5-
import { ToggleSwitch } from 'shared/components/toggle';
4+
import { Switch } from 'shared/components/switch';
5+
import { ManifestConfigPageEnum } from 'config/external-config';
6+
67
import { Mint } from './mint';
78
import { Repay } from './repay';
9+
import { adjustmentToggleList } from './const';
810
import { FormBlock, PageWrapper } from './styles';
911

10-
import { AdjustmentPaths, adjustmentToggleList } from './const';
11-
import { ManifestConfigPageEnum } from 'config/external-config';
12-
1312
export const AdjustmentTabs = () => {
14-
const router = useRouter();
15-
const initialPath = router.query.mode as AdjustmentPaths;
1613
const { isMintTab } = useAdjustment();
1714
const { activeVault } = useVaultInfo();
1815

19-
const handleToggleCb = (value: AdjustmentPaths) => {
20-
void router.push(
21-
`/${activeVault?.address}/${ManifestConfigPageEnum.adjustment}/${value}`,
22-
);
23-
};
16+
// TODO: improve creation of the path
17+
const mintRoutes = [
18+
{
19+
path: `/${activeVault?.address}${ManifestConfigPageEnum.adjustment}/${adjustmentToggleList[0].value}`,
20+
name: adjustmentToggleList[0].label,
21+
},
22+
{
23+
path: `/${activeVault?.address}${ManifestConfigPageEnum.adjustment}/${adjustmentToggleList[1].value}`,
24+
name: adjustmentToggleList[1].label,
25+
},
26+
];
2427

2528
return (
2629
<PageWrapper>
27-
<ToggleSwitch
28-
options={adjustmentToggleList}
29-
defaultActive={initialPath}
30-
onToggle={({ value }) => handleToggleCb(value as AdjustmentPaths)}
31-
/>
30+
<Switch checked={!isMintTab} routes={mintRoutes} />
3231
<FormBlock>{isMintTab ? <Mint /> : <Repay />}</FormBlock>
3332
</PageWrapper>
3433
);

0 commit comments

Comments
 (0)