@@ -115,14 +115,6 @@ export const AutoReloadSettingsPopup: React.FC<AutoReloadSettingsPopupProps> = (
115115
116116 const isPending = updateWalletSettings . isPending || createWalletSettings . isPending ;
117117
118- if ( isLoading ) {
119- return (
120- < div className = "flex items-center justify-center py-8" >
121- < div className = "h-6 w-6 animate-spin rounded-full border-2 border-primary border-t-transparent" />
122- </ div >
123- ) ;
124- }
125-
126118 return (
127119 < Popup
128120 open = { open }
@@ -145,72 +137,78 @@ export const AutoReloadSettingsPopup: React.FC<AutoReloadSettingsPopupProps> = (
145137 }
146138 ] }
147139 >
148- < div className = "space-y-4" >
149- < div className = "" >
150- < div className = "flex" >
151- < Label htmlFor = "reloadEnabled" className = "mr-4 self-center" >
152- Enable Auto Reload
153- </ Label >
154- < Switch id = "reloadEnabled" checked = { autoReloadEnabled } onCheckedChange = { handleToggleChange } disabled = { isPending } />
155- </ div >
156- < p className = "mt-1 text-xs text-muted-foreground" > You can enable or disable this at any time.</ p >
140+ { isLoading ? (
141+ < div className = "flex items-center justify-center py-8" >
142+ < div className = "h-6 w-6 animate-spin rounded-full border-2 border-primary border-t-transparent" />
157143 </ div >
158-
159- < div className = "grid gap-4 sm:grid-cols-1" >
160- < div className = "space-y-2" >
161- < Label htmlFor = "threshold-input" >
162- When credit balance goes below
163- < span className = "ml-1 text-muted-foreground" > (minimum ${ MIN_THRESHOLD } )</ span >
164- </ Label >
144+ ) : (
145+ < div className = "space-y-4" >
146+ < div className = "" >
165147 < div className = "flex" >
166- < span className = "self-center text-muted-foreground" > $</ span >
167- < Input
168- id = "threshold"
169- type = "number"
170- min = { MIN_THRESHOLD }
171- step = "1"
172- value = { threshold }
173- onChange = { handleThresholdChange }
174- disabled = { isPending }
175- className = "flex-grow pl-2"
176- placeholder = { DEFAULT_THRESHOLD . toString ( ) }
177- />
148+ < Label htmlFor = "reloadEnabled" className = "mr-4 self-center" >
149+ Enable Auto Reload
150+ </ Label >
151+ < Switch id = "reloadEnabled" checked = { autoReloadEnabled } onCheckedChange = { handleToggleChange } disabled = { isPending } />
178152 </ div >
179- { thresholdError && < p className = "text-xs text-destructive" > { thresholdError } </ p > }
180- < p className = "text-xs text-muted-foreground" >
181- If your current balance is below or equal to the threshold you set, your reload will immediately kick in once you click save.
182- </ p >
153+ < p className = "mt-1 text-xs text-muted-foreground" > You can enable or disable this at any time.</ p >
183154 </ div >
184155
185- < div className = "space-y-2" >
186- < Label htmlFor = "reloadAmount-input" >
187- Reload Credit Balance to
188- < span className = "ml-1 text-muted-foreground" > (minimum ${ MIN_RELOAD_AMOUNT } )</ span >
189- </ Label >
190- < div className = "flex" >
191- < span className = "self-center text-muted-foreground" > $</ span >
192- < Input
193- id = "reloadAmount"
194- type = "number"
195- min = { MIN_RELOAD_AMOUNT }
196- step = "1"
197- value = { reloadAmount }
198- onChange = { handleReloadAmountChange }
199- disabled = { isPending }
200- className = "flex-grow pl-2"
201- placeholder = { DEFAULT_RELOAD_AMOUNT . toString ( ) }
202- />
156+ < div className = "grid gap-4 sm:grid-cols-1" >
157+ < div className = "space-y-2" >
158+ < Label htmlFor = "threshold-input" >
159+ When credit balance goes below
160+ < span className = "ml-1 text-muted-foreground" > (minimum ${ MIN_THRESHOLD } )</ span >
161+ </ Label >
162+ < div className = "flex" >
163+ < span className = "self-center text-muted-foreground" > $</ span >
164+ < Input
165+ id = "threshold"
166+ type = "number"
167+ min = { MIN_THRESHOLD }
168+ step = "1"
169+ value = { threshold }
170+ onChange = { handleThresholdChange }
171+ disabled = { isPending }
172+ className = "flex-grow pl-2"
173+ placeholder = { DEFAULT_THRESHOLD . toString ( ) }
174+ />
175+ </ div >
176+ { thresholdError && < p className = "text-xs text-destructive" > { thresholdError } </ p > }
177+ < p className = "text-xs text-muted-foreground" >
178+ If your current balance is below or equal to the threshold you set, your reload will immediately kick in once you click save.
179+ </ p >
180+ </ div >
181+
182+ < div className = "space-y-2" >
183+ < Label htmlFor = "reloadAmount-input" >
184+ Reload Credit Balance to
185+ < span className = "ml-1 text-muted-foreground" > (minimum ${ MIN_RELOAD_AMOUNT } )</ span >
186+ </ Label >
187+ < div className = "flex" >
188+ < span className = "self-center text-muted-foreground" > $</ span >
189+ < Input
190+ id = "reloadAmount"
191+ type = "number"
192+ min = { MIN_RELOAD_AMOUNT }
193+ step = "1"
194+ value = { reloadAmount }
195+ onChange = { handleReloadAmountChange }
196+ disabled = { isPending }
197+ className = "flex-grow pl-2"
198+ placeholder = { DEFAULT_RELOAD_AMOUNT . toString ( ) }
199+ />
200+ </ div >
201+ { reloadAmountError && < p className = "text-xs text-destructive" > { reloadAmountError } </ p > }
203202 </ div >
204- { reloadAmountError && < p className = "text-xs text-destructive" > { reloadAmountError } </ p > }
203+ < Alert variant = "default" >
204+ < AlertTitle > How it works</ AlertTitle >
205+ < AlertDescription >
206+ When your balance drops below ${ threshold } , we'll automatically charge ${ reloadAmount } to your selected card.
207+ </ AlertDescription >
208+ </ Alert >
205209 </ div >
206- < Alert variant = "default" >
207- < AlertTitle > How it works</ AlertTitle >
208- < AlertDescription >
209- When your balance drops below ${ threshold } , we'll automatically charge ${ reloadAmount } to your selected card.
210- </ AlertDescription >
211- </ Alert >
212210 </ div >
213- </ div >
211+ ) }
214212 </ Popup >
215213 ) ;
216214} ;
0 commit comments