fix: ui fixes on the add liquidity flow (#7352)

This commit is contained in:
eddie 2023-09-22 09:40:10 -07:00 committed by GitHub
parent 0a31428d7a
commit 59e7a2867a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 26 deletions

@ -161,6 +161,10 @@ const StyledNumericalInput = styled(NumericalInput)<{ $loading: boolean }>`
text-align: left; text-align: left;
` `
const StyledPrefetchBalancesWrapper = styled(PrefetchBalancesWrapper)<{ $fullWidth: boolean }>`
width: ${({ $fullWidth }) => ($fullWidth ? '100%' : 'auto')};
`
interface CurrencyInputPanelProps { interface CurrencyInputPanelProps {
value: string value: string
onUserInput: (value: string) => void onUserInput: (value: string) => void
@ -231,7 +235,7 @@ export default function CurrencyInputPanel({
/> />
)} )}
<PrefetchBalancesWrapper shouldFetchOnAccountUpdate={modalOpen}> <StyledPrefetchBalancesWrapper shouldFetchOnAccountUpdate={modalOpen} $fullWidth={hideInput}>
<CurrencySelect <CurrencySelect
disabled={!chainAllowed} disabled={!chainAllowed}
visible={currency !== undefined} visible={currency !== undefined}
@ -274,7 +278,7 @@ export default function CurrencyInputPanel({
{onCurrencySelect && <StyledDropDown selected={!!currency} />} {onCurrencySelect && <StyledDropDown selected={!!currency} />}
</Aligner> </Aligner>
</CurrencySelect> </CurrencySelect>
</PrefetchBalancesWrapper> </StyledPrefetchBalancesWrapper>
</InputRow> </InputRow>
{Boolean(!hideInput && !hideBalance && currency) && ( {Boolean(!hideInput && !hideBalance && currency) && (
<FiatRow> <FiatRow>

@ -21,6 +21,8 @@ const Tabs = styled.div`
const StyledLink = styled(Link)<{ flex?: string }>` const StyledLink = styled(Link)<{ flex?: string }>`
flex: ${({ flex }) => flex ?? 'none'}; flex: ${({ flex }) => flex ?? 'none'};
display: flex;
align-items: center;
${({ theme }) => theme.deprecated_mediaWidth.deprecated_upToMedium` ${({ theme }) => theme.deprecated_mediaWidth.deprecated_upToMedium`
flex: none; flex: none;
@ -82,7 +84,7 @@ export function AddRemoveTabs({
return ( return (
<Tabs> <Tabs>
<RowBetween style={{ padding: '1rem 1rem 0 1rem' }}> <RowBetween style={{ padding: '1rem 1rem 0 1rem' }} align="center">
<StyledLink <StyledLink
to={poolLink} to={poolLink}
onClick={() => { onClick={() => {

@ -30,7 +30,8 @@ const hasUnfetchedBalancesAtom = atom<boolean>(true)
export default function PrefetchBalancesWrapper({ export default function PrefetchBalancesWrapper({
children, children,
shouldFetchOnAccountUpdate, shouldFetchOnAccountUpdate,
}: PropsWithChildren<{ shouldFetchOnAccountUpdate: boolean }>) { className,
}: PropsWithChildren<{ shouldFetchOnAccountUpdate: boolean; className?: string }>) {
const { account } = useWeb3React() const { account } = useWeb3React()
const [prefetchPortfolioBalances] = usePortfolioBalancesLazyQuery() const [prefetchPortfolioBalances] = usePortfolioBalancesLazyQuery()
@ -64,5 +65,9 @@ export default function PrefetchBalancesWrapper({
if (hasUnfetchedBalances) fetchBalances() if (hasUnfetchedBalances) fetchBalances()
}, [fetchBalances, hasUnfetchedBalances]) }, [fetchBalances, hasUnfetchedBalances])
return <div onMouseEnter={onHover}>{children}</div> return (
<div onMouseEnter={onHover} className={className}>
{children}
</div>
)
} }

@ -65,15 +65,7 @@ import { currencyId } from '../../utils/currencyId'
import { maxAmountSpend } from '../../utils/maxAmountSpend' import { maxAmountSpend } from '../../utils/maxAmountSpend'
import { Dots } from '../Pool/styled' import { Dots } from '../Pool/styled'
import { Review } from './Review' import { Review } from './Review'
import { import { DynamicSection, MediumOnly, ResponsiveTwoColumns, ScrollablePage, StyledInput, Wrapper } from './styled'
CurrencyDropdown,
DynamicSection,
MediumOnly,
ResponsiveTwoColumns,
ScrollablePage,
StyledInput,
Wrapper,
} from './styled'
const DEFAULT_ADD_IN_RANGE_SLIPPAGE_TOLERANCE = new Percent(50, 10_000) const DEFAULT_ADD_IN_RANGE_SLIPPAGE_TOLERANCE = new Percent(50, 10_000)
@ -631,11 +623,11 @@ function AddLiquidity() {
<Trans>Select Pair</Trans> <Trans>Select Pair</Trans>
</ThemedText.DeprecatedLabel> </ThemedText.DeprecatedLabel>
</RowBetween> </RowBetween>
<RowBetween> <RowBetween gap="md">
<CurrencyDropdown <CurrencyInputPanel
value={formattedAmounts[Field.CURRENCY_A]} value={formattedAmounts[Field.CURRENCY_A]}
onUserInput={onFieldAInput} onUserInput={onFieldAInput}
hideInput={true} hideInput
onMax={() => { onMax={() => {
onFieldAInput(maxAmounts[Field.CURRENCY_A]?.toExact() ?? '') onFieldAInput(maxAmounts[Field.CURRENCY_A]?.toExact() ?? '')
}} }}
@ -646,11 +638,9 @@ function AddLiquidity() {
showCommonBases showCommonBases
/> />
<div style={{ width: '12px' }} /> <CurrencyInputPanel
<CurrencyDropdown
value={formattedAmounts[Field.CURRENCY_B]} value={formattedAmounts[Field.CURRENCY_B]}
hideInput={true} hideInput
onUserInput={onFieldBInput} onUserInput={onFieldBInput}
onCurrencySelect={handleCurrencyBSelect} onCurrencySelect={handleCurrencyBSelect}
onMax={() => { onMax={() => {

@ -1,5 +1,4 @@
import { AutoColumn } from 'components/Column' import { AutoColumn } from 'components/Column'
import CurrencyInputPanel from 'components/CurrencyInputPanel'
import { Input } from 'components/NumericalInput' import { Input } from 'components/NumericalInput'
import styled from 'styled-components' import styled from 'styled-components'
@ -32,10 +31,6 @@ export const DynamicSection = styled(AutoColumn)<{ disabled?: boolean }>`
pointer-events: ${({ disabled }) => (disabled ? 'none' : 'initial')}; pointer-events: ${({ disabled }) => (disabled ? 'none' : 'initial')};
` `
export const CurrencyDropdown = styled(CurrencyInputPanel)`
width: 48.5%;
`
export const StyledInput = styled(Input)` export const StyledInput = styled(Input)`
background-color: ${({ theme }) => theme.surface1}; background-color: ${({ theme }) => theme.surface1};
text-align: left; text-align: left;