Generated
+17927
File diff suppressed because it is too large
Load Diff
@@ -114,16 +114,19 @@ export function InitialModal({
|
|||||||
|
|
||||||
const handleCostFetch = useCallback(
|
const handleCostFetch = useCallback(
|
||||||
(cost: BZZ) => {
|
(cost: BZZ) => {
|
||||||
safeSetState(isMountedRef, setIsNodeSyncing)(false)
|
setIsNodeSyncing(false)
|
||||||
checkBalances(cost)
|
checkBalances(cost)
|
||||||
safeSetState(isMountedRef, setCost)(cost.toSignificantDigits(2))
|
const costDecimal = parseFloat(cost.toDecimalString())
|
||||||
|
const formattedCost =
|
||||||
|
costDecimal < 0.01 && costDecimal > 0 ? costDecimal.toExponential(1) : costDecimal.toPrecision(2)
|
||||||
|
setCost(formattedCost)
|
||||||
},
|
},
|
||||||
[checkBalances],
|
[checkBalances],
|
||||||
)
|
)
|
||||||
|
|
||||||
const handleCostFetchError = useCallback(() => {
|
const handleCostFetchError = useCallback(() => {
|
||||||
safeSetState(isMountedRef, setIsNodeSyncing)(true)
|
setIsNodeSyncing(true)
|
||||||
safeSetState(isMountedRef, setCost)('0')
|
setCost('0')
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const createAdminDrive = useCallback(async () => {
|
const createAdminDrive = useCallback(async () => {
|
||||||
@@ -195,26 +198,19 @@ export function InitialModal({
|
|||||||
currentFetch,
|
currentFetch,
|
||||||
handleCostFetchError,
|
handleCostFetchError,
|
||||||
)
|
)
|
||||||
|
|
||||||
if (lifetimeIndex >= 0 && !isNodeSyncing) {
|
|
||||||
setIsCreateEnabled(true)
|
|
||||||
} else {
|
|
||||||
setIsCreateEnabled(false)
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
setCost('0')
|
setCost('0')
|
||||||
setIsCreateEnabled(false)
|
setIsCreateEnabled(false)
|
||||||
}
|
}
|
||||||
}, [
|
}, [validityEndDate, erasureCodeLevel, beeApi, capacity, handleCostFetch, handleCostFetchError])
|
||||||
validityEndDate,
|
|
||||||
erasureCodeLevel,
|
useEffect(() => {
|
||||||
beeApi,
|
if (lifetimeIndex >= 0 && !isNodeSyncing) {
|
||||||
capacity,
|
setIsCreateEnabled(true)
|
||||||
lifetimeIndex,
|
} else {
|
||||||
isNodeSyncing,
|
setIsCreateEnabled(false)
|
||||||
handleCostFetch,
|
}
|
||||||
handleCostFetchError,
|
}, [lifetimeIndex, isNodeSyncing])
|
||||||
])
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setValidityEndDate(getExpiryDateByLifetime(lifetimeIndex))
|
setValidityEndDate(getExpiryDateByLifetime(lifetimeIndex))
|
||||||
|
|||||||
Reference in New Issue
Block a user