From 5f1105f6cd755fd11a0dbd6b7a9a4afb06013559 Mon Sep 17 00:00:00 2001 From: Hugo Montenegro Date: Tue, 4 Nov 2025 18:51:47 -0300 Subject: [PATCH 1/4] gix --- src/components/Global/ProgressBar/index.tsx | 10 ++++++-- .../Global/TokenAmountInput/index.tsx | 23 +++++++++++++++---- src/components/Payment/PaymentForm/index.tsx | 1 + 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/components/Global/ProgressBar/index.tsx b/src/components/Global/ProgressBar/index.tsx index 7f1b1ea93..412274ef5 100644 --- a/src/components/Global/ProgressBar/index.tsx +++ b/src/components/Global/ProgressBar/index.tsx @@ -94,11 +94,17 @@ const ProgressBar: React.FC = ({ goal, progress, isClosed }) = if (isGoalAchieved) return null + // Check if progress percentage is too close to 100% to prevent overlap + const isTooCloseToGoal = progressPercentage > 90 + return (

{formatCurrency(progress)}

diff --git a/src/components/Global/TokenAmountInput/index.tsx b/src/components/Global/TokenAmountInput/index.tsx index 003c3404a..ad88d9014 100644 --- a/src/components/Global/TokenAmountInput/index.tsx +++ b/src/components/Global/TokenAmountInput/index.tsx @@ -31,6 +31,7 @@ interface TokenAmountInputProps { infoText?: string showSlider?: boolean maxAmount?: number + amountCollected?: number isInitialInputUsd?: boolean defaultSliderValue?: number defaultSliderSuggestedAmount?: number @@ -53,6 +54,7 @@ const TokenAmountInput = ({ showInfoText, showSlider = false, maxAmount, + amountCollected = 0, isInitialInputUsd = false, defaultSliderValue, defaultSliderSuggestedAmount, @@ -153,15 +155,28 @@ const TokenAmountInput = ({ (value: number[]) => { if (maxAmount) { const selectedPercentage = value[0] - const selectedAmount = parseFloat(((selectedPercentage / 100) * maxAmount).toFixed(4)).toString() + let selectedAmount = (selectedPercentage / 100) * maxAmount + + // Only snap to exact remaining amount when user selects the 33.33% magnetic snap point + // This ensures equal splits fill the pot exactly to 100% + const isAt33SnapPoint = Math.abs(selectedPercentage - 100 / 3) < 0.5 + if (isAt33SnapPoint && amountCollected > 0) { + const remainingAmount = maxAmount - amountCollected + // If the 33.33% would nearly complete the pot (within 2%), use exact remaining + if (selectedAmount >= remainingAmount * 0.98) { + selectedAmount = remainingAmount + } + } + + const selectedAmountStr = parseFloat(selectedAmount.toFixed(4)).toString() const maxDecimals = displayMode === 'FIAT' || displayMode === 'STABLE' || isInputUsd ? 2 : decimals - const formattedAmount = formatTokenAmount(selectedAmount, maxDecimals, true) + const formattedAmount = formatTokenAmount(selectedAmountStr, maxDecimals, true) if (formattedAmount) { onChange(formattedAmount, isInputUsd) } } }, - [maxAmount, onChange] + [maxAmount, amountCollected, onChange, displayMode, isInputUsd, decimals] ) const showConversion = useMemo(() => { @@ -304,7 +319,7 @@ const TokenAmountInput = ({ /> {/* Fake blinking caret shown when not focused and input is empty */} {!isFocused && !displayValue && ( -
+
)}
diff --git a/src/components/Payment/PaymentForm/index.tsx b/src/components/Payment/PaymentForm/index.tsx index e5b02e81e..a12276757 100644 --- a/src/components/Payment/PaymentForm/index.tsx +++ b/src/components/Payment/PaymentForm/index.tsx @@ -785,6 +785,7 @@ export const PaymentForm = ({ hideBalance={isExternalWalletFlow} showSlider={showRequestPotInitialView && amount ? Number(amount) > 0 : false} maxAmount={showRequestPotInitialView && amount ? Number(amount) : undefined} + amountCollected={showRequestPotInitialView ? totalAmountCollected : 0} defaultSliderValue={defaultSliderValue.percentage} defaultSliderSuggestedAmount={defaultSliderValue.suggestedAmount} /> From 4c1aa155dcc573b76a1c6aa545af78c17f906ffc Mon Sep 17 00:00:00 2001 From: Hugo Montenegro Date: Tue, 4 Nov 2025 18:54:22 -0300 Subject: [PATCH 2/4] format --- src/components/Global/TokenAmountInput/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Global/TokenAmountInput/index.tsx b/src/components/Global/TokenAmountInput/index.tsx index ad88d9014..b0c3f9c0f 100644 --- a/src/components/Global/TokenAmountInput/index.tsx +++ b/src/components/Global/TokenAmountInput/index.tsx @@ -319,7 +319,7 @@ const TokenAmountInput = ({ /> {/* Fake blinking caret shown when not focused and input is empty */} {!isFocused && !displayValue && ( -
+
)}
From 831abc04ccf212bdd970e76caa12dd97fa6cb926 Mon Sep 17 00:00:00 2001 From: Hugo Montenegro Date: Tue, 4 Nov 2025 19:05:16 -0300 Subject: [PATCH 3/4] fix --- src/components/Global/TokenAmountInput/index.tsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/components/Global/TokenAmountInput/index.tsx b/src/components/Global/TokenAmountInput/index.tsx index b0c3f9c0f..574666d59 100644 --- a/src/components/Global/TokenAmountInput/index.tsx +++ b/src/components/Global/TokenAmountInput/index.tsx @@ -159,11 +159,15 @@ const TokenAmountInput = ({ // Only snap to exact remaining amount when user selects the 33.33% magnetic snap point // This ensures equal splits fill the pot exactly to 100% - const isAt33SnapPoint = Math.abs(selectedPercentage - 100 / 3) < 0.5 + const SNAP_POINT_TOLERANCE = 0.5 // percentage points - allows magnetic snapping + const COMPLETION_THRESHOLD = 0.98 // 98% - if 33.33% would nearly complete pot + const EQUAL_SPLIT_PERCENTAGE = 100 / 3 // 33.333...% + + const isAt33SnapPoint = Math.abs(selectedPercentage - EQUAL_SPLIT_PERCENTAGE) < SNAP_POINT_TOLERANCE if (isAt33SnapPoint && amountCollected > 0) { const remainingAmount = maxAmount - amountCollected - // If the 33.33% would nearly complete the pot (within 2%), use exact remaining - if (selectedAmount >= remainingAmount * 0.98) { + // Only snap if there's remaining amount and 33.33% would nearly complete the pot + if (remainingAmount > 0 && selectedAmount >= remainingAmount * COMPLETION_THRESHOLD) { selectedAmount = remainingAmount } } @@ -319,7 +323,7 @@ const TokenAmountInput = ({ /> {/* Fake blinking caret shown when not focused and input is empty */} {!isFocused && !displayValue && ( -
+
)}
From b9fa710facfa3998a912081bd6f982d6cd1eabcf Mon Sep 17 00:00:00 2001 From: Hugo Montenegro Date: Tue, 4 Nov 2025 19:07:32 -0300 Subject: [PATCH 4/4] . --- src/components/Global/TokenAmountInput/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Global/TokenAmountInput/index.tsx b/src/components/Global/TokenAmountInput/index.tsx index 574666d59..96bfdfce9 100644 --- a/src/components/Global/TokenAmountInput/index.tsx +++ b/src/components/Global/TokenAmountInput/index.tsx @@ -323,7 +323,7 @@ const TokenAmountInput = ({ /> {/* Fake blinking caret shown when not focused and input is empty */} {!isFocused && !displayValue && ( -
+
)}