Skip to content

Commit 5cdbece

Browse files
authored
fix: fixed button show more, added input btn (#1246)
1 parent 31c5c8d commit 5cdbece

File tree

3 files changed

+40
-6
lines changed

3 files changed

+40
-6
lines changed

src/app/routes/create-cluster/ceremony-summary.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Badge } from "@/components/ui/badge.tsx";
22
import { Text } from "@/components/ui/text.tsx";
33
import { Divider } from "@/components/ui/divider.tsx";
4-
import { FaRegFolderClosed } from "react-icons/fa6";
4+
import { FaRegFolderClosed, FaAngleUp, FaAngleDown } from "react-icons/fa6";
55
import { useState } from "react";
66

77
const CeremonySummary = ({
@@ -18,9 +18,10 @@ const CeremonySummary = ({
1818
<Text className="text-[16px] font-bold">Generated Files Summary</Text>
1919
<Text
2020
onClick={setShowAllHandler}
21-
className="text-sm text-primary-500 cursor-pointer"
21+
className="text-sm text-primary-500 cursor-pointer flex items-center gap-1"
2222
>
23-
Show more
23+
{`Show ${isShowAll ? "Less" : "More"}`}
24+
{isShowAll ? <FaAngleUp /> : <FaAngleDown />}
2425
</Text>
2526
</div>
2627
)}

src/app/routes/reshare-dkg/reshare-dkg.tsx

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import CeremonySection from "@/app/routes/reshare-dkg/ceremony-section.tsx";
3030
import RemoveValidatorsSection from "@/app/routes/reshare-dkg/remove-validators-section.tsx";
3131
import { FaCircleInfo } from "react-icons/fa6";
3232
import { Tooltip } from "@/components/ui/tooltip.tsx";
33+
import { shortenAddress } from "@/lib/utils/strings.ts";
3334

3435
enum ReshareSteps {
3536
Signature = 1,
@@ -66,6 +67,7 @@ const schema = z.object({
6667

6768
const ReshareDkg = () => {
6869
const [currentStep, setCurrentStep] = useState(ReshareSteps.Signature);
70+
const [isOwnerInputDisabled, setIsOwnerInputDisabled] = useState(true);
6971
const context = useBulkActionContext();
7072
const isReshare = context.dkgReshareState.newOperators.length > 0;
7173
const account = useAccount();
@@ -171,7 +173,34 @@ const ReshareDkg = () => {
171173
</Tooltip>
172174
</FormLabel>
173175
<FormControl>
174-
<Input {...field} />
176+
<Input
177+
{...field}
178+
disabled={isOwnerInputDisabled || isLoading}
179+
value={
180+
isOwnerInputDisabled
181+
? shortenAddress(field.value)
182+
: field.value
183+
}
184+
rightSlot={
185+
<Button
186+
className="border-none text-primary-500 hover:bg-transparent hover:text-primary-500"
187+
variant={
188+
isOwnerInputDisabled ? "outline" : "secondary"
189+
}
190+
onClick={() => {
191+
if (
192+
form.formState.errors.ownerAddress ||
193+
isLoading
194+
) {
195+
return;
196+
}
197+
setIsOwnerInputDisabled(!isOwnerInputDisabled);
198+
}}
199+
>
200+
{isOwnerInputDisabled ? "Add" : "Save"}
201+
</Button>
202+
}
203+
/>
175204
</FormControl>
176205
<FormMessage />
177206
</FormItem>
@@ -186,7 +215,10 @@ const ReshareDkg = () => {
186215
<FormItem>
187216
<FormLabel>Set Withdrawal Address</FormLabel>
188217
<FormControl>
189-
<Input {...field} />
218+
<Input
219+
{...field}
220+
disabled={field.disabled || isLoading}
221+
/>
190222
</FormControl>
191223
<FormMessage />
192224
</FormItem>

src/components/ui/input.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
2828
"pr-4": rightSlot,
2929
},
3030
className,
31+
`${props.disabled ? "bg-gray-200" : "bg-transparent"}`,
3132
)}
3233
>
3334
<Slot>{isLoading ? <Spinner /> : leftSlot}</Slot>
@@ -37,7 +38,7 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
3738
{...inputProps}
3839
className={cn(
3940
inputProps?.className,
40-
"w-full h-full flex-1 bg-transparent outline-none",
41+
`w-full h-full flex-1 bg-transparent outline-none ${props.disabled ? "text-gray-500" : "text-gray-800"}`,
4142
)}
4243
ref={ref}
4344
/>

0 commit comments

Comments
 (0)