Skip to content

Commit 88e744b

Browse files
committed
feat: update main settings form
1 parent eed6404 commit 88e744b

3 files changed

Lines changed: 9 additions & 19 deletions

File tree

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,14 @@
1-
import { useController } from 'react-hook-form';
2-
import { Input, Identicon } from '@lidofinance/lido-ui';
3-
41
import { vaultTexts } from 'modules/vaults';
5-
import { isAddress } from 'viem';
2+
import { AddressInputHookForm } from 'shared/hook-form/controls';
63

74
const texts = vaultTexts.actions.settings.fields.nodeOperatorFeeRecipient;
85

96
export const EditRecipient = () => {
10-
const {
11-
field,
12-
fieldState: { error },
13-
} = useController({ name: 'nodeOperatorFeeRecipient' });
14-
157
return (
16-
<Input
17-
{...field}
18-
leftDecorator={
19-
isAddress(field.value) ? <Identicon address={field.value} /> : null
20-
}
8+
<AddressInputHookForm
219
label={texts.editLabel}
22-
error={error?.message}
23-
fullwidth
10+
fieldName="nodeOperatorFeeRecipient"
11+
showRightDecorator={false}
2412
/>
2513
);
2614
};

features/settings/main/edit-main-settings.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ export const EditMainSettings = () => {
2525
{vaultTexts.actions.settings.title}
2626
</Text>
2727
<NodeOperator />
28-
<NodeOperatorFeeRecipient />
2928
<Admins />
29+
<NodeOperatorFeeRecipient />
3030
<Voting />
3131
<MainSettingsAction />
3232
</SectionContainer>

shared/hook-form/controls/address-input-hook-form.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ type TokenAmountInputHookFormProps = Partial<
99
> & {
1010
fieldName: string;
1111
showErrorMessage?: boolean;
12+
showRightDecorator?: boolean;
1213
};
1314

1415
const safeIsAddressEqual = (a: string, b: string) => {
@@ -20,6 +21,7 @@ const safeIsAddressEqual = (a: string, b: string) => {
2021
export const AddressInputHookForm = ({
2122
fieldName,
2223
showErrorMessage = true,
24+
showRightDecorator = true,
2325
onBlur: onBlurProp,
2426
onFocus: onFocusProp,
2527
disabled,
@@ -35,7 +37,7 @@ export const AddressInputHookForm = ({
3537
const shouldShowErrorMessage = showErrorMessage && inFocus && !!error;
3638
const errorMessage = error?.message as string;
3739

38-
const rightDecorator = (
40+
const rightDecorator = showRightDecorator ? (
3941
<Button
4042
size="xxs"
4143
variant="translucent"
@@ -51,7 +53,7 @@ export const AddressInputHookForm = ({
5153
>
5254
Current address
5355
</Button>
54-
);
56+
) : null;
5557

5658
return (
5759
<Input

0 commit comments

Comments
 (0)