better handle clearing swap form

This commit is contained in:
tjs 2022-12-07 20:04:48 -05:00
parent 5e113692f4
commit 986c6ce57a
2 changed files with 7 additions and 1 deletions

View File

@ -101,12 +101,18 @@ const SwapForm = () => {
const setAmountInFormValue = useCallback((amountIn: string) => { const setAmountInFormValue = useCallback((amountIn: string) => {
set((s) => { set((s) => {
s.swap.amountIn = amountIn s.swap.amountIn = amountIn
if (!parseFloat(amountIn)) {
s.swap.amountOut = ''
}
}) })
}, []) }, [])
const setAmountOutFormValue = useCallback((amountOut: string) => { const setAmountOutFormValue = useCallback((amountOut: string) => {
set((s) => { set((s) => {
s.swap.amountOut = amountOut s.swap.amountOut = amountOut
if (!parseFloat(amountOut)) {
s.swap.amountIn = ''
}
}) })
}, []) }, [])

View File

@ -63,7 +63,7 @@ function MyApp({ Component, pageProps }: AppProps) {
<ConnectionProvider endpoint={endpoint}> <ConnectionProvider endpoint={endpoint}>
<WalletProvider wallets={wallets} onError={onError}> <WalletProvider wallets={wallets} onError={onError}>
<EnhancedWalletProvider> <EnhancedWalletProvider>
<ThemeProvider defaultTheme="Dark"> <ThemeProvider defaultTheme="Mango Classic">
<ViewportProvider> <ViewportProvider>
<Layout> <Layout>
<Component {...pageProps} /> <Component {...pageProps} />