Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
ab65d258
authored
Jul 26, 2026
by
feitianbubu
Committed by
GitHub
Jul 26, 2026
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: allow topup amount input to be fully cleared (#6473)
parent
08f88d25
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
+13
-5
web/src/features/wallet/components/recharge-form-card.tsx
+8
-2
web/src/features/wallet/index.tsx
+5
-3
No files found.
web/src/features/wallet/components/recharge-form-card.tsx
View file @
ab65d258
...
...
@@ -116,7 +116,10 @@ export function RechargeFormCard({
const
[
localAmount
,
setLocalAmount
]
=
useState
(
topupAmount
.
toString
())
useEffect
(()
=>
{
setLocalAmount
(
topupAmount
.
toString
())
// Empty string must survive, otherwise the field can never be cleared
setLocalAmount
((
prev
)
=>
prev
===
''
&&
topupAmount
===
0
?
prev
:
topupAmount
.
toString
()
)
},
[
topupAmount
])
const
handleAmountChange
=
(
value
:
string
)
=>
{
...
...
@@ -317,7 +320,10 @@ export function RechargeFormCard({
{
hasStandardPaymentMethods
?
(
<
div
className=
'grid grid-cols-2 gap-1.5 sm:gap-3 lg:grid-cols-3'
>
{
topupInfo
?.
pay_methods
?.
map
((
method
)
=>
{
const
minTopup
=
method
.
min_topup
||
0
const
minTopup
=
Math
.
max
(
method
.
min_topup
||
0
,
getMinTopupAmount
(
topupInfo
)
)
const
disabled
=
minTopup
>
topupAmount
const
disabledReason
=
disabled
?
t
(
'
Minimum
topup
amount
:
{{
amount
}}
'
,
{
...
...
web/src/features/wallet/index.tsx
View file @
ab65d258
...
...
@@ -16,7 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import
{
useState
,
useEffect
,
useCallback
,
useMemo
}
from
'react'
import
{
useState
,
useEffect
,
useCallback
,
useMemo
,
useRef
}
from
'react'
import
{
useTranslation
}
from
'react-i18next'
import
{
SectionPageLayout
}
from
'@/components/layout'
...
...
@@ -137,8 +137,10 @@ export function Wallet(props: WalletProps) {
},
[
props
.
initialShowHistory
])
// Initialize topup amount when topup info is loaded
const
topupAmountInitializedRef
=
useRef
(
false
)
useEffect
(()
=>
{
if
(
topupInfo
&&
topupAmount
===
0
)
{
if
(
topupInfo
&&
!
topupAmountInitializedRef
.
current
)
{
topupAmountInitializedRef
.
current
=
true
const
minTopup
=
getMinTopupAmount
(
topupInfo
)
setTopupAmount
(
minTopup
)
...
...
@@ -146,7 +148,7 @@ export function Wallet(props: WalletProps) {
const
defaultPaymentType
=
getDefaultPaymentType
(
topupInfo
)
calculatePaymentAmount
(
minTopup
,
defaultPaymentType
)
}
},
[
topupInfo
,
topupAmount
,
calculatePaymentAmount
])
},
[
topupInfo
,
calculatePaymentAmount
])
// Get current payment type (selected or default)
const
getCurrentPaymentType
=
useCallback
(()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment