You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -15,31 +16,45 @@ export function AutoTopupSettings() {
15
16
handleToggleAutoTopup,
16
17
handleThresholdChange,
17
18
handleTopUpAmountChange,
19
+
showConfirmDialog,
20
+
confirmDialogBalance,
21
+
confirmEnableAutoTopup,
22
+
cancelEnableAutoTopup,
18
23
}=useAutoTopup()
19
24
20
25
return(
21
-
<BaseAutoTopupSettings
22
-
isLoading={isLoadingProfile}
23
-
switchComponent={
24
-
<AutoTopupSwitch
25
-
isEnabled={isEnabled}
26
-
onToggle={handleToggleAutoTopup}
27
-
isPending={isPending}
28
-
autoTopupBlockedReason={
29
-
userProfile?.auto_topup_blocked_reason??null
30
-
}
31
-
/>
32
-
}
33
-
formComponent={
34
-
<AutoTopupSettingsForm
35
-
isEnabled={isEnabled}
36
-
threshold={threshold}
37
-
topUpAmountDollars={topUpAmountDollars}
38
-
onThresholdChange={handleThresholdChange}
39
-
onTopUpAmountChange={handleTopUpAmountChange}
40
-
isPending={isPending}
41
-
/>
42
-
}
43
-
/>
26
+
<>
27
+
<BaseAutoTopupSettings
28
+
isLoading={isLoadingProfile}
29
+
switchComponent={
30
+
<AutoTopupSwitch
31
+
isEnabled={isEnabled}
32
+
onToggle={handleToggleAutoTopup}
33
+
isPending={isPending}
34
+
autoTopupBlockedReason={
35
+
userProfile?.auto_topup_blocked_reason??null
36
+
}
37
+
/>
38
+
}
39
+
formComponent={
40
+
<AutoTopupSettingsForm
41
+
isEnabled={isEnabled}
42
+
threshold={threshold}
43
+
topUpAmountDollars={topUpAmountDollars}
44
+
onThresholdChange={handleThresholdChange}
45
+
onTopUpAmountChange={handleTopUpAmountChange}
46
+
isPending={isPending}
47
+
/>
48
+
}
49
+
/>
50
+
<ConfirmationDialog
51
+
isOpen={showConfirmDialog}
52
+
onClose={cancelEnableAutoTopup}
53
+
onConfirm={confirmEnableAutoTopup}
54
+
title="Enable Auto Top-up?"
55
+
description={`Your current balance (${(confirmDialogBalance??0).toLocaleString()} credits) is below your threshold (${threshold.toLocaleString()} credits). Enabling auto top-up will charge your payment method ~$${topUpAmountDollars.toFixed(2)} on your next usage.`}
0 commit comments