From a9e1950d8114d5e3d62788f09fe2314c6b52e7ff Mon Sep 17 00:00:00 2001 From: Leandro Date: Thu, 10 Mar 2022 15:02:47 -0800 Subject: [PATCH] Anoter round of mods updates. Hopefuly the last one --- cypress-custom/integration/swapMod.ts | 15 +++- .../useIsSwapUnsupportedMod.ts | 20 +++--- src/custom/pages/App/AppMod.tsx | 68 ++++++++++--------- src/custom/pages/Swap/SwapMod.tsx | 1 + 4 files changed, 60 insertions(+), 44 deletions(-) diff --git a/cypress-custom/integration/swapMod.ts b/cypress-custom/integration/swapMod.ts index 0191bf1d5f..29639e8c87 100644 --- a/cypress-custom/integration/swapMod.ts +++ b/cypress-custom/integration/swapMod.ts @@ -2,20 +2,33 @@ describe('Swap (mod)', () => { beforeEach(() => { cy.visit('/swap') }) + + /* it.skip('starts with an ETH/USDC swap and quotes it', () => { + cy.get('#swap-currency-input .token-amount-input').should('have.value', '1') + cy.get('#swap-currency-input .token-symbol-container').should('contain.text', 'ETH') + cy.get('#swap-currency-output .token-amount-input').should('not.have.value', '') + cy.get('#swap-currency-output .token-symbol-container').should('contain.text', 'USDC') + }) */ + it('can enter an amount into input', () => { cy.get('#swap-currency-input .token-amount-input') + // .clear() .type('0.001', { delay: 400, force: true }) .should('have.value', '0.001') }) it('zero swap amount', () => { cy.get('#swap-currency-input .token-amount-input') + // .clear() .type('0.0', { delay: 400, force: true }) .should('have.value', '0.0') }) it('invalid swap amount', () => { - cy.get('#swap-currency-input .token-amount-input').type('\\', { delay: 400, force: true }).should('have.value', '') + cy.get('#swap-currency-input .token-amount-input') + // .clear() + .type('\\', { delay: 400, force: true }) + .should('have.value', '') }) it.skip('can enter an amount into output', () => { diff --git a/src/custom/hooks/useIsSwapUnsupported/useIsSwapUnsupportedMod.ts b/src/custom/hooks/useIsSwapUnsupported/useIsSwapUnsupportedMod.ts index 0c91aaa272..0c0da6fddd 100644 --- a/src/custom/hooks/useIsSwapUnsupported/useIsSwapUnsupportedMod.ts +++ b/src/custom/hooks/useIsSwapUnsupported/useIsSwapUnsupportedMod.ts @@ -1,5 +1,6 @@ import { Currency /* , Token */ } from '@uniswap/sdk-core' // import { useMemo } from 'react' + import { useIsUnsupportedToken } from 'state/lists/hooks' /** @@ -13,18 +14,15 @@ export function useIsSwapUnsupported(currencyIn?: Currency | null, currencyOut?: const tokenIn = currencyIn?.wrapped const tokenOut = currencyOut?.wrapped - /* - const unsupportedTokens: { [address: string]: Token } = useUnsupportedTokens() - + /* const unsupportedTokens = useUnsupportedTokens() return useMemo(() => { - // if unsupported list loaded & either token on list, mark as unsupported - return Boolean( - unsupportedTokens && - ((currencyIn?.isToken && unsupportedTokens[currencyIn.address]) || - (currencyOut?.isToken && unsupportedTokens[currencyOut.address])) - ) - }, [currencyIn, currencyOut, unsupportedTokens]) - */ + if (!unsupportedTokens) { + return false + } + const currencyInUnsupported = Boolean(currencyIn?.isToken && unsupportedTokens[currencyIn.address]) + const currencyOutUnsupported = Boolean(currencyOut?.isToken && unsupportedTokens[currencyOut.address]) + return currencyInUnsupported || currencyOutUnsupported + }, [currencyIn, currencyOut, unsupportedTokens]) */ return isUnsupported(tokenIn?.address) || isUnsupported(tokenOut?.address) } diff --git a/src/custom/pages/App/AppMod.tsx b/src/custom/pages/App/AppMod.tsx index 09d9b48e8b..25788b12ba 100644 --- a/src/custom/pages/App/AppMod.tsx +++ b/src/custom/pages/App/AppMod.tsx @@ -1,6 +1,7 @@ +import Loader from 'components/Loader' import ApeModeQueryParamReader from 'hooks/useApeModeQueryParamReader' -import { Suspense, /* PropsWithChildren, */ ReactNode, useState, useEffect } from 'react' -import { Route, Switch, useLocation } from 'react-router-dom' +import { /*Lazy,*/ Suspense, /* PropsWithChildren, */ ReactNode, useState, useEffect } from 'react' +import { /*Redirect,*/ Route, Switch, useLocation } from 'react-router-dom' import styled from 'styled-components/macro' import GoogleAnalyticsReporter from 'components/analytics/GoogleAnalyticsReporter' import AddressClaimModal from 'components/claim/AddressClaimModal' @@ -9,15 +10,12 @@ import Header from 'components/Header' import Polling from 'components/Header/Polling' import Popups from 'components/Popups' import Web3ReactManager from 'components/Web3ReactManager' -import { ApplicationModal } from 'state/application/reducer' import { useModalOpen, useToggleModal } from 'state/application/hooks' +import { ApplicationModal } from 'state/application/reducer' import DarkModeQueryParamReader from 'theme' /* import AddLiquidity from './AddLiquidity' -import { - RedirectDuplicateTokenIds, -} from './AddLiquidity/redirects' +import { RedirectDuplicateTokenIds } from './AddLiquidity/redirects' import { RedirectDuplicateTokenIdsV2 } from './AddLiquidityV2/redirects' -import CreateProposal from './CreateProposal' import Earn from './Earn' import Manage from './Earn/Manage' import MigrateV2 from './MigrateV2' @@ -30,15 +28,17 @@ import RemoveLiquidity from './RemoveLiquidity' import RemoveLiquidityV3 from './RemoveLiquidity/V3' import Swap from './Swap' import { OpenClaimAddressModalAndRedirectToSwap, RedirectPathToSwapOnly, RedirectToSwap } from './Swap/redirects' -import Vote from './Vote' -import VotePage from './Vote/VotePage' */ + +// MOD imports import ReferralLinkUpdater from 'state/affiliate/updater' import URLWarning from 'components/Header/URLWarning' import Footer from 'components/Footer' import { BodyWrapper } from '.' import * as CSS from 'csstype' // mod +// const Vote = lazy(() => import('./Vote')) + interface AppWrapProps { bgBlur?: boolean } @@ -47,6 +47,7 @@ const AppWrapper = styled.div>` display: flex; flex-flow: column; align-items: flex-start; + // MOD min-height: 100vh; overflow-x: hidden; &:after { @@ -75,7 +76,7 @@ const AppWrapper = styled.div>` z-index: 1; ${({ theme }) => theme.mediaWidth.upToSmall` - padding: 6rem 16px 16px 16px; + padding: 4rem 8px 16px 8px; `}; ` */ @@ -83,6 +84,9 @@ const HeaderWrapper = styled.div` ${({ theme }) => theme.flexRowNoWrap} width: 100%; justify-content: space-between; + /* position: fixed; + top: 0; + z-index: 2; */ ` const FooterWrapper = styled(HeaderWrapper)` @@ -108,21 +112,21 @@ export default function App(props?: { children?: ReactNode }) { }, [location.pathname]) return ( - - - - - - + + + + + + + +
+ + - - -
- - - - - + + + + }> {props && props.children} {/* @@ -164,14 +168,14 @@ export default function App(props?: { children?: ReactNode }) { */} - - - -