Skip to content

Commit 2f209f8

Browse files
committed
fix publish form default params
1 parent bceccc5 commit 2f209f8

File tree

1 file changed

+21
-40
lines changed

1 file changed

+21
-40
lines changed

apps/dashboard/src/components/contract-components/contract-publish-form/contract-params-fieldset.tsx

Lines changed: 21 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import {
55
Input,
66
InputGroup,
77
InputRightElement,
8+
Select,
89
Textarea,
9-
Tooltip,
1010
useBreakpointValue,
1111
} from "@chakra-ui/react";
1212
import type { AbiParameter } from "abitype";
@@ -15,8 +15,6 @@ import { camelToTitle } from "contract-ui/components/solidity-inputs/helpers";
1515
import { getTemplateValuesForType } from "lib/deployment/template-values";
1616
import { useFormContext } from "react-hook-form";
1717
import {
18-
Button,
19-
Card,
2018
Checkbox,
2119
FormErrorMessage,
2220
FormHelperText,
@@ -133,44 +131,27 @@ export const ContractParamsFieldset: React.FC<ContractParamsFieldsetProps> = ({
133131
/>
134132
</Flex>
135133
{paramTemplateValues.length > 0 && (
136-
<InputRightElement width="10.5rem">
137-
<Tooltip
138-
bg="transparent"
139-
boxShadow="none"
140-
shouldWrapChildren
141-
label={
142-
<Card
143-
as={Flex}
144-
flexDir="column"
145-
gap={2}
146-
bgColor="backgroundHighlight"
147-
>
148-
<Text>
149-
{paramTemplateValues[0]?.helperText} Click to
150-
apply.
151-
</Text>
152-
</Card>
153-
}
134+
<InputRightElement width="12rem">
135+
<Select
136+
size="xs"
137+
placeholder="Select value"
138+
onChange={(e) => {
139+
form.setValue(
140+
`constructorParams.${param.name ? param.name : "*"}.defaultValue`,
141+
e.target.value,
142+
{ shouldDirty: true },
143+
);
144+
}}
154145
>
155-
<Button
156-
size="xs"
157-
padding="3"
158-
paddingY="3.5"
159-
onClick={() => {
160-
form.setValue(
161-
`constructorParams.${
162-
param.name ? param.name : "*"
163-
}.defaultValue`,
164-
paramTemplateValues[0]?.value,
165-
{
166-
shouldDirty: true,
167-
},
168-
);
169-
}}
170-
>
171-
{paramTemplateValues[0]?.value}
172-
</Button>
173-
</Tooltip>
146+
{paramTemplateValues.map((paramTemplate) => (
147+
<option
148+
key={paramTemplate.value}
149+
value={paramTemplate?.value}
150+
>
151+
{paramTemplate?.value}
152+
</option>
153+
))}
154+
</Select>
174155
</InputRightElement>
175156
)}
176157
</InputGroup>

0 commit comments

Comments
 (0)