1
- import { ChevronDownIcon } from "@radix-ui/react-icons" ;
2
1
import { useState } from "react" ;
3
2
import { trackPayEvent } from "../../../../../../../analytics/track/pay.js" ;
4
3
import type { Chain } from "../../../../../../../chains/types.js" ;
@@ -8,11 +7,7 @@ import {
8
7
type FiatProvider ,
9
8
FiatProviders ,
10
9
} from "../../../../../../../pay/utils/commonTypes.js" ;
11
- import {
12
- type Theme ,
13
- iconSize ,
14
- spacing ,
15
- } from "../../../../../../core/design-system/index.js" ;
10
+ import type { Theme } from "../../../../../../core/design-system/index.js" ;
16
11
import type { PayUIOptions } from "../../../../../../core/hooks/connection/ConnectButtonProps.js" ;
17
12
import { useBuyWithFiatQuote } from "../../../../../../core/hooks/pay/useBuyWithFiatQuote.js" ;
18
13
import { PREFERRED_FIAT_PROVIDER_STORAGE_KEY } from "../../../../../../core/utils/storage.js" ;
@@ -29,11 +24,11 @@ import { Button } from "../../../../components/buttons.js";
29
24
import { Text } from "../../../../components/text.js" ;
30
25
import { type ERC20OrNativeToken , isNativeToken } from "../../nativeToken.js" ;
31
26
import { EstimatedTimeAndFees } from "../EstimatedTimeAndFees.js" ;
27
+ import { PayProviderSelection } from "../PayProviderSelection.js" ;
32
28
import { PayWithCreditCard } from "../PayWIthCreditCard.js" ;
33
29
import type { SelectedScreen } from "../main/types.js" ;
34
30
import { FiatFees } from "../swap/Fees.js" ;
35
31
import type { PayerInfo } from "../types.js" ;
36
- import { uppercaseFirstLetter } from "../utils.js" ;
37
32
import { Providers } from "./Providers.js" ;
38
33
import type { CurrencyMeta } from "./currencies.js" ;
39
34
@@ -89,7 +84,7 @@ export function FiatScreenContent(props: {
89
84
) ;
90
85
91
86
const supportedProviders = ( ( ) => {
92
- if ( ! buyWithFiatOptions ) return [ ] ;
87
+ if ( ! buyWithFiatOptions ) return [ ... FiatProviders ] ;
93
88
const options = buyWithFiatOptions ?. supportedProviders ?? [ ] ;
94
89
return options . length > 0 &&
95
90
( ! preferredProvider || options . includes ( preferredProvider ) )
@@ -202,35 +197,13 @@ export function FiatScreenContent(props: {
202
197
currency = { selectedCurrency }
203
198
onSelectCurrency = { showCurrencySelector }
204
199
/>
205
- < Container
206
- bg = "tertiaryBg"
207
- flex = "row"
208
- borderColor = "borderColor"
209
- style = { {
210
- paddingLeft : spacing . md ,
211
- justifyContent : "space-between" ,
212
- alignItems : "center" ,
213
- borderWidth : "1px" ,
214
- borderStyle : "solid" ,
215
- borderBottom : "none" ,
216
- } }
217
- >
218
- < Text size = "xs" color = "secondaryText" >
219
- Provider
220
- </ Text >
221
- < Button variant = "ghost" onClick = { showProviders } >
222
- < Container flex = "row" center = "y" gap = "xxs" color = "secondaryText" >
223
- < Text size = "xs" >
224
- { preferredProvider
225
- ? `${ uppercaseFirstLetter ( preferredProvider ) } `
226
- : fiatQuoteQuery . data ?. provider
227
- ? `${ uppercaseFirstLetter ( fiatQuoteQuery . data ?. provider ) } `
228
- : "" }
229
- </ Text >
230
- < ChevronDownIcon width = { iconSize . sm } height = { iconSize . sm } />
231
- </ Container >
232
- </ Button >
233
- </ Container >
200
+ { /** Shows preferred or quoted provider and conditional selection */ }
201
+ < PayProviderSelection
202
+ onShowProviders = { showProviders }
203
+ quotedProvider = { fiatQuoteQuery . data ?. provider }
204
+ preferredProvider = { preferredProvider }
205
+ supportedProviders = { supportedProviders }
206
+ />
234
207
{ /* Estimated time + View fees button */ }
235
208
< EstimatedTimeAndFees
236
209
quoteIsLoading = { fiatQuoteQuery . isLoading }
0 commit comments