Skip to content

Commit

Permalink
Update token amount field value gathering
Browse files Browse the repository at this point in the history
  • Loading branch information
kpyszkowski committed Oct 28, 2024
1 parent 06fd76a commit 0abf238
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
import React from "react"
import { ActivityType } from "#/types"
import { getEstimatedDuration } from "#/utils"
import { useFormField } from "#/hooks"
import { TextMd } from "../shared/Typography"
import { useTokenAmountField } from "../shared/TokenAmountForm/TokenAmountFormBase"
import { TOKEN_AMOUNT_FIELD_NAME } from "../shared/TokenAmountForm/TokenAmountFormBase"

export default function ActionDurationEstimation({
type,
}: {
type: ActivityType
}) {
const { value: amount } = useTokenAmountField()
const { value: amount = 0n } = useFormField<bigint | undefined>(
TOKEN_AMOUNT_FIELD_NAME,
)

return (
<TextMd mt={4} color="grey.400">
Estimated duration&nbsp;
<TextMd as="span" color="grey.500">
~ {getEstimatedDuration(amount ?? 0n, type)}
~ {getEstimatedDuration(amount, type)}
</TextMd>
</TextMd>
)
Expand Down

0 comments on commit 0abf238

Please sign in to comment.