-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dApp: Action duration estimation & validation (#790)
Closes: #789 ### Changes: - Implemented action duration estimation based on given amount - Updated form validation strategy to update the state dynamically based on given value https://github.com/user-attachments/assets/1893466c-910a-4933-8293-163da9c45f60
- Loading branch information
Showing
4 changed files
with
30 additions
and
1 deletion.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
dapp/src/components/TransactionModal/ActionDurationEstimation.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React from "react" | ||
import { ActivityType } from "#/types" | ||
import { getEstimatedDuration } from "#/utils" | ||
import { useFormField } from "#/hooks" | ||
import { TextMd } from "../shared/Typography" | ||
import { TOKEN_AMOUNT_FIELD_NAME } from "../shared/TokenAmountForm/TokenAmountFormBase" | ||
|
||
export default function ActionDurationEstimation({ | ||
type, | ||
}: { | ||
type: ActivityType | ||
}) { | ||
const { value: amount = 0n } = useFormField<bigint | undefined>( | ||
TOKEN_AMOUNT_FIELD_NAME, | ||
) | ||
|
||
return ( | ||
<TextMd mt={4} color="grey.400"> | ||
Estimated duration | ||
<TextMd as="span" color="grey.500"> | ||
~ {getEstimatedDuration(amount, type)} | ||
</TextMd> | ||
</TextMd> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters