Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
997052869d | ||
|
|
9ec16c2ba8 | ||
|
|
e2cf8f1642 | ||
|
|
ed6952d1f7 | ||
|
|
3277d70e93 | ||
|
|
d1a31fe763 | ||
|
|
f88af029ae | ||
|
|
9f3e49b4d8 | ||
|
|
d4911d1054 | ||
|
|
90df9c4ced | ||
|
|
14f15d1fd6 |
4
.github/workflows/release.yaml
vendored
4
.github/workflows/release.yaml
vendored
@@ -7,7 +7,7 @@ on:
|
|||||||
# releases are triggered on changes to this file
|
# releases are triggered on changes to this file
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- v2
|
- master
|
||||||
paths:
|
paths:
|
||||||
- '.github/workflows/release.yaml'
|
- '.github/workflows/release.yaml'
|
||||||
- '.env.production'
|
- '.env.production'
|
||||||
@@ -47,7 +47,7 @@ jobs:
|
|||||||
run: yarn install --ignore-scripts --frozen-lockfile
|
run: yarn install --ignore-scripts --frozen-lockfile
|
||||||
|
|
||||||
- name: Build the IPFS bundle
|
- name: Build the IPFS bundle
|
||||||
run: yarn ipfs-build
|
run: yarn build
|
||||||
|
|
||||||
- name: Pin to IPFS
|
- name: Pin to IPFS
|
||||||
id: upload
|
id: upload
|
||||||
|
|||||||
4
.github/workflows/tests.yaml
vendored
4
.github/workflows/tests.yaml
vendored
@@ -2,10 +2,10 @@ name: Tests
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- v2
|
- master
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- v2
|
- master
|
||||||
jobs:
|
jobs:
|
||||||
integration-tests:
|
integration-tests:
|
||||||
name: Integration tests
|
name: Integration tests
|
||||||
|
|||||||
40
README.md
40
README.md
@@ -1,11 +1,12 @@
|
|||||||
# Uniswap Frontend
|
# Uniswap Frontend
|
||||||
|
|
||||||
[](https://github.com/Uniswap/uniswap-frontend/actions?query=workflow%3ATests)
|
[](https://github.com/Uniswap/uniswap-interface/actions?query=workflow%3ATests)
|
||||||
[](https://prettier.io/)
|
[](https://prettier.io/)
|
||||||
|
|
||||||
An open source interface for Uniswap -- a protocol for decentralized exchange of Ethereum tokens.
|
An open source interface for Uniswap -- a protocol for decentralized exchange of Ethereum tokens.
|
||||||
|
|
||||||
- Website: [uniswap.org](https://uniswap.org/)
|
- Website: [uniswap.org](https://uniswap.org/)
|
||||||
|
- Interface: [app.uniswap.org](https://app.uniswap.org)
|
||||||
- Docs: [uniswap.org/docs/](https://uniswap.org/docs/)
|
- Docs: [uniswap.org/docs/](https://uniswap.org/docs/)
|
||||||
- Twitter: [@UniswapProtocol](https://twitter.com/UniswapProtocol)
|
- Twitter: [@UniswapProtocol](https://twitter.com/UniswapProtocol)
|
||||||
- Reddit: [/r/Uniswap](https://www.reddit.com/r/Uniswap/)
|
- Reddit: [/r/Uniswap](https://www.reddit.com/r/Uniswap/)
|
||||||
@@ -13,11 +14,11 @@ An open source interface for Uniswap -- a protocol for decentralized exchange of
|
|||||||
- Discord: [Uniswap](https://discord.gg/Y7TF6QA)
|
- Discord: [Uniswap](https://discord.gg/Y7TF6QA)
|
||||||
- Whitepaper: [Link](https://hackmd.io/C-DvwDSfSxuh-Gd4WKE_ig)
|
- Whitepaper: [Link](https://hackmd.io/C-DvwDSfSxuh-Gd4WKE_ig)
|
||||||
|
|
||||||
## Accessing the frontend
|
## Accessing the Uniswap Interface
|
||||||
|
|
||||||
To access the front end, use an IPFS gateway link from the
|
To access the Uniswap Interface, use an IPFS gateway link from the
|
||||||
[latest release](https://github.com/Uniswap/uniswap-frontend/releases/latest)
|
[latest release](https://github.com/Uniswap/uniswap-interface/releases/latest),
|
||||||
or visit [uniswap.exchange](https://uniswap.exchange).
|
or visit [app.uniswap.org](https://app.uniswap.org).
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
@@ -27,31 +28,32 @@ or visit [uniswap.exchange](https://uniswap.exchange).
|
|||||||
yarn
|
yarn
|
||||||
```
|
```
|
||||||
|
|
||||||
### Configure Environment (optional)
|
|
||||||
|
|
||||||
Copy `.env` to `.env.local` and change the appropriate variables.
|
|
||||||
|
|
||||||
### Run
|
### Run
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
yarn start
|
yarn start
|
||||||
```
|
```
|
||||||
|
|
||||||
To have the frontend default to a different network, make a copy of `.env` named `.env.local`,
|
### Configuring the environment (optional)
|
||||||
change `REACT_APP_NETWORK_ID` to `"{yourNetworkId}"`, and change `REACT_APP_NETWORK_URL` to e.g.
|
|
||||||
`"https://{yourNetwork}.infura.io/v3/{yourKey}"`.
|
|
||||||
|
|
||||||
Note that the front end only works properly on testnets where both
|
To have the interface default to a different network when a wallet is not connected:
|
||||||
|
|
||||||
|
1. Make a copy of `.env` named `.env.local`
|
||||||
|
2. Change `REACT_APP_NETWORK_ID` to `"{YOUR_NETWORK_ID}"`
|
||||||
|
3. Change `REACT_APP_NETWORK_URL` to e.g. `"https://{YOUR_NETWORK_ID}.infura.io/v3/{YOUR_INFURA_KEY}"`
|
||||||
|
|
||||||
|
Note that the interface only works on testnets where both
|
||||||
[Uniswap V2](https://uniswap.org/docs/v2/smart-contracts/factory/) and
|
[Uniswap V2](https://uniswap.org/docs/v2/smart-contracts/factory/) and
|
||||||
[multicall](https://github.com/makerdao/multicall) are deployed.
|
[multicall](https://github.com/makerdao/multicall) are deployed.
|
||||||
The frontend will not work on other networks.
|
The interface will not work on other networks.
|
||||||
|
|
||||||
## Contributions
|
## Contributions
|
||||||
|
|
||||||
**Please open all pull requests against the `v2` branch.**
|
**Please open all pull requests against the `master` branch.**
|
||||||
CI checks will run against all PRs.
|
CI checks will run against all PRs.
|
||||||
|
|
||||||
## Accessing Uniswap V1 interface
|
## Accessing Uniswap Interface V1
|
||||||
|
|
||||||
The Uniswap V1 interface for mainnet and testnets is accessible via IPFS gateways linked
|
The Uniswap Interface supports swapping against, and migrating or removing liquidity from Uniswap V1. However,
|
||||||
from the [v1.0.0 release](https://github.com/Uniswap/uniswap-frontend/releases/tag/v1.0.0).
|
if you would like to use Uniswap V1, the Uniswap V1 interface for mainnet and testnets is accessible via IPFS gateways
|
||||||
|
linked from the [v1.0.0 release](https://github.com/Uniswap/uniswap-interface/releases/tag/v1.0.0).
|
||||||
@@ -69,13 +69,13 @@ class CustomizedBridge extends _Eip1193Bridge {
|
|||||||
|
|
||||||
// sets up the injected provider to be a mock ethereum provider with the given mnemonic/index
|
// sets up the injected provider to be a mock ethereum provider with the given mnemonic/index
|
||||||
Cypress.Commands.overwrite('visit', (original, url, options) => {
|
Cypress.Commands.overwrite('visit', (original, url, options) => {
|
||||||
return original(url, {
|
return original(url.startsWith('/') && url.length > 2 && !url.startsWith('/#') ? `/#${url}` : url, {
|
||||||
...options,
|
...options,
|
||||||
onBeforeLoad(win) {
|
onBeforeLoad(win) {
|
||||||
options && options.onBeforeLoad && options.onBeforeLoad(win)
|
options && options.onBeforeLoad && options.onBeforeLoad(win)
|
||||||
const provider = new JsonRpcProvider('https://rinkeby.infura.io/v3/acb7e55995d04c49bfb52b7141599467', 4)
|
const provider = new JsonRpcProvider('https://rinkeby.infura.io/v3/acb7e55995d04c49bfb52b7141599467', 4)
|
||||||
const signer = new Wallet(PRIVATE_KEY_TEST_NEVER_USE, provider)
|
const signer = new Wallet(PRIVATE_KEY_TEST_NEVER_USE, provider)
|
||||||
win.ethereum = new CustomizedBridge(signer, provider)
|
win.ethereum = new CustomizedBridge(signer, provider)
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
27
netlify.toml
27
netlify.toml
@@ -1,27 +0,0 @@
|
|||||||
# block some countries
|
|
||||||
[[redirects]]
|
|
||||||
from = "/*"
|
|
||||||
to = "/451.html"
|
|
||||||
status = 451
|
|
||||||
force = true
|
|
||||||
conditions = {Country=["BY","CU","IR","IQ","CI","LR","KP","SD","SY","ZW"]}
|
|
||||||
headers = {Link="<https://uniswap.exchange>"}
|
|
||||||
|
|
||||||
# forward migrate
|
|
||||||
[[redirects]]
|
|
||||||
from = "https://migrate.uniswap.exchange/*"
|
|
||||||
to = "https://uniswap.exchange/migrate/v1"
|
|
||||||
status = 301
|
|
||||||
force = true
|
|
||||||
|
|
||||||
# forward v2 subdomain to apex
|
|
||||||
[[redirects]]
|
|
||||||
from = "https://v2.uniswap.exchange/*"
|
|
||||||
to = "https://uniswap.exchange/:splat"
|
|
||||||
status = 301
|
|
||||||
|
|
||||||
# support SPA setup
|
|
||||||
[[redirects]]
|
|
||||||
from = "/*"
|
|
||||||
to = "/index.html"
|
|
||||||
status = 200
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@uniswap/interface",
|
"name": "@uniswap/interface",
|
||||||
"description": "Uniswap Interface",
|
"description": "Uniswap Interface",
|
||||||
"homepage": "https://uniswap.exchange",
|
"homepage": ".",
|
||||||
"private": true,
|
"private": true,
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@ethersproject/address": "^5.0.0-beta.134",
|
"@ethersproject/address": "^5.0.0-beta.134",
|
||||||
@@ -51,6 +51,7 @@
|
|||||||
"i18next": "^15.0.9",
|
"i18next": "^15.0.9",
|
||||||
"i18next-browser-languagedetector": "^3.0.1",
|
"i18next-browser-languagedetector": "^3.0.1",
|
||||||
"i18next-xhr-backend": "^2.0.1",
|
"i18next-xhr-backend": "^2.0.1",
|
||||||
|
"inter-ui": "^3.13.1",
|
||||||
"jazzicon": "^1.5.0",
|
"jazzicon": "^1.5.0",
|
||||||
"lodash.flatmap": "^4.5.0",
|
"lodash.flatmap": "^4.5.0",
|
||||||
"polished": "^3.3.2",
|
"polished": "^3.3.2",
|
||||||
@@ -81,7 +82,6 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "react-scripts start",
|
"start": "react-scripts start",
|
||||||
"build": "react-scripts build",
|
"build": "react-scripts build",
|
||||||
"ipfs-build": "cross-env PUBLIC_URL=\".\" react-scripts build",
|
|
||||||
"test": "react-scripts test --env=jsdom",
|
"test": "react-scripts test --env=jsdom",
|
||||||
"eject": "react-scripts eject",
|
"eject": "react-scripts eject",
|
||||||
"lint": "eslint 'src/**/*.{js,jsx,ts,tsx}'",
|
"lint": "eslint 'src/**/*.{js,jsx,ts,tsx}'",
|
||||||
|
|||||||
@@ -1,75 +0,0 @@
|
|||||||
{
|
|
||||||
"noWallet": "לא נמצא ארנק",
|
|
||||||
"wrongNetwork": "נבחרה רשת לא נכונה",
|
|
||||||
"switchNetwork": "{{ correctNetwork }} יש צורך לשנות את הרשת ל",
|
|
||||||
"installWeb3MobileBrowser": "יש צורך בארנק ווב3.0, תתקין מטאמאסק או ארנק דומה",
|
|
||||||
"installMetamask": " Metamask יש צורך להתקין תוסף מטאמאסק לדפדפן, חפשו בגוגל ",
|
|
||||||
"disconnected": "מנותק",
|
|
||||||
"swap": "המרה",
|
|
||||||
"send": "שליחה",
|
|
||||||
"pool": "להפקיד",
|
|
||||||
"betaWarning": "הפרויקט נמצא בשלב בטא, השתמשו באחריות",
|
|
||||||
"input": "מוכר",
|
|
||||||
"output": "אקבל",
|
|
||||||
"estimated": "הערכה",
|
|
||||||
"balance": "בארנק שלי {{ balanceInput }}",
|
|
||||||
"unlock": "שחרור נעילת ארנק",
|
|
||||||
"pending": "ממתין לאישור",
|
|
||||||
"selectToken": "בחרו את הטוקן להמרה",
|
|
||||||
"searchOrPaste": "הכניסו שם או כתובת של טוקן לחיפוש",
|
|
||||||
"noExchange": "לא מתאפשרת המרה",
|
|
||||||
"exchangeRate": "שער המרה",
|
|
||||||
"enterValueCont": "כדי להמשיך {{ missingCurrencyValue }} הזינו ",
|
|
||||||
"selectTokenCont": "בחרו טוקן כדי להמשיך",
|
|
||||||
"noLiquidity": "אין נזילות",
|
|
||||||
"unlockTokenCont": "יש צורך לאשר את הטוקן למסחר",
|
|
||||||
"transactionDetails": "פרטי הטרנזקציה",
|
|
||||||
"hideDetails": "הסתר פרטים נוספים",
|
|
||||||
"youAreSelling": "למכירה",
|
|
||||||
"orTransFail": "או שהטרנזקציה תיכשל",
|
|
||||||
"youWillReceive": "תוצר המרה מינימלי",
|
|
||||||
"youAreBuying": "קונה",
|
|
||||||
"itWillCost": "זה יעלה",
|
|
||||||
"insufficientBalance": "אין בחשבון מספיק מטבעות",
|
|
||||||
"inputNotValid": "קלט לא תקין",
|
|
||||||
"differentToken": "יש צורך בטוקנים שונים",
|
|
||||||
"noRecipient": "לא הוכנסה כתובת ארנק יעד",
|
|
||||||
"invalidRecipient": "לא הוכנסה כתובת תקינה",
|
|
||||||
"recipientAddress": "כתובת יעד",
|
|
||||||
"youAreSending": "כמות לשליחה",
|
|
||||||
"willReceive": "יתקבל לכל הפחות",
|
|
||||||
"to": "אל",
|
|
||||||
"addLiquidity": "להוספת נזילות למאגר",
|
|
||||||
"deposit": "הפקדה",
|
|
||||||
"currentPoolSize": "גודל מאגר הנזילות הכולל",
|
|
||||||
"yourPoolShare": "חלקך במאגר הנזילות",
|
|
||||||
"noZero": "אפס אינו ערך תקין",
|
|
||||||
"mustBeETH": "ETH חייב להופיע באחד מהצדדים",
|
|
||||||
"enterCurrencyOrLabelCont": "כדי להמשיך {{ inputCurrency }} או {{ label }} הכנס",
|
|
||||||
"youAreAdding": "מתווספים למאגר",
|
|
||||||
"and": "וגם",
|
|
||||||
"intoPool": "לתוך הנזילות",
|
|
||||||
"outPool": "מתוך",
|
|
||||||
"youWillMint": "יונפקו לכם",
|
|
||||||
"liquidityTokens": "טוקנים של נזילות",
|
|
||||||
"totalSupplyIs": "חלקך במאגר הנזילות",
|
|
||||||
"youAreSettingExRate": "שער ההמרה יקבע על ידך",
|
|
||||||
"totalSupplyIs0": "אין לך טוקנים של נזילות",
|
|
||||||
"tokenWorth": "שווי כל טוקן נזילות הינו",
|
|
||||||
"firstLiquidity": "את\ה הראשון\ה שמזרים נזילות למאגר",
|
|
||||||
"initialExchangeRate": "ושל האית'ר הינן בערך שווה {{ label }} תוודאו שההפקדה של הטוקן",
|
|
||||||
"removeLiquidity": "הוצאה של נזילות",
|
|
||||||
"poolTokens": "טוקנים של מאגר הנזילות",
|
|
||||||
"enterLabelCont": "כדי להמשיך {{ label }} הכנס ",
|
|
||||||
"youAreRemoving": "יוסרו",
|
|
||||||
"youWillRemove": "יוסרו",
|
|
||||||
"createExchange": "ליצירת זוג מסחר",
|
|
||||||
"invalidTokenAddress": "כתובת טוקן לא נכונה",
|
|
||||||
"exchangeExists": "{{ label }} כבר קיים זוג המרה עבור",
|
|
||||||
"invalidSymbol": "תו שגוי",
|
|
||||||
"invalidDecimals": "ספרות עשרוניות שגויות",
|
|
||||||
"tokenAddress": "כתובת הטוקן",
|
|
||||||
"label": "שם",
|
|
||||||
"decimals": "ספרות עשרויות",
|
|
||||||
"enterTokenCont": "הכניסו כתובת טוקן כדי להמשיך"
|
|
||||||
}
|
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
"youAreSettingExRate": "שער ההמרה יקבע על ידך",
|
"youAreSettingExRate": "שער ההמרה יקבע על ידך",
|
||||||
"totalSupplyIs0": "אין לך טוקנים של נזילות",
|
"totalSupplyIs0": "אין לך טוקנים של נזילות",
|
||||||
"tokenWorth": "שווי כל טוקן נזילות הינו",
|
"tokenWorth": "שווי כל טוקן נזילות הינו",
|
||||||
"firstLiquidity": "את\ה הראשון\ה שמזרים נזילות למאגר",
|
"firstLiquidity": "אתה הראשוןה שמזרים נזילות למאגר",
|
||||||
"initialExchangeRate": "ושל האית'ר הינן בערך שווה {{ label }} תוודאו שההפקדה של הטוקן",
|
"initialExchangeRate": "ושל האית'ר הינן בערך שווה {{ label }} תוודאו שההפקדה של הטוקן",
|
||||||
"removeLiquidity": "הוצאה של נזילות",
|
"removeLiquidity": "הוצאה של נזילות",
|
||||||
"poolTokens": "טוקנים של מאגר הנזילות",
|
"poolTokens": "טוקנים של מאגר הנזילות",
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
import React from 'react'
|
|
||||||
import styled from 'styled-components'
|
|
||||||
import { Send, Sun, Moon } from 'react-feather'
|
|
||||||
import { useDarkModeManager } from '../../state/user/hooks'
|
|
||||||
|
|
||||||
import { ButtonSecondary } from '../Button'
|
|
||||||
|
|
||||||
const FooterFrame = styled.div`
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: flex-end;
|
|
||||||
position: fixed;
|
|
||||||
right: 1rem;
|
|
||||||
bottom: 1rem;
|
|
||||||
${({ theme }) => theme.mediaWidth.upToExtraSmall`
|
|
||||||
display: none;
|
|
||||||
`};
|
|
||||||
`
|
|
||||||
|
|
||||||
export default function Footer() {
|
|
||||||
const [darkMode, toggleDarkMode] = useDarkModeManager()
|
|
||||||
|
|
||||||
return (
|
|
||||||
<FooterFrame>
|
|
||||||
<form action="https://forms.gle/DaLuqvJsVhVaAM3J9" target="_blank">
|
|
||||||
<ButtonSecondary p="8px 12px">
|
|
||||||
<Send size={16} style={{ marginRight: '8px' }} /> Feedback
|
|
||||||
</ButtonSecondary>
|
|
||||||
</form>
|
|
||||||
<ButtonSecondary onClick={toggleDarkMode} p="8px 12px" ml="0.5rem" width="min-content">
|
|
||||||
{darkMode ? <Sun size={16} /> : <Moon size={16} />}
|
|
||||||
</ButtonSecondary>
|
|
||||||
</FooterFrame>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -6,16 +6,16 @@ import useParsedQueryString from '../../hooks/useParsedQueryString'
|
|||||||
import useToggledVersion, { Version } from '../../hooks/useToggledVersion'
|
import useToggledVersion, { Version } from '../../hooks/useToggledVersion'
|
||||||
|
|
||||||
const VersionLabel = styled.span<{ enabled: boolean }>`
|
const VersionLabel = styled.span<{ enabled: boolean }>`
|
||||||
padding: ${({ enabled }) => (enabled ? '0.15rem 0.5rem 0.16rem 0.45rem' : '0.15rem 0.5rem 0.16rem 0.35rem')};
|
padding: 0.35rem 0.6rem;
|
||||||
border-radius: 14px;
|
border-radius: 12px;
|
||||||
background: ${({ theme, enabled }) => (enabled ? theme.primary1 : 'none')};
|
background: ${({ theme, enabled }) => (enabled ? theme.primary1 : 'none')};
|
||||||
color: ${({ theme, enabled }) => (enabled ? theme.white : theme.primary1)};
|
color: ${({ theme, enabled }) => (enabled ? theme.white : theme.text1)};
|
||||||
font-size: 0.825rem;
|
font-size: 1rem;
|
||||||
font-weight: 400;
|
font-weight: ${({ enabled }) => (enabled ? '500' : '400')};
|
||||||
:hover {
|
:hover {
|
||||||
user-select: ${({ enabled }) => (enabled ? 'none' : 'initial')};
|
user-select: ${({ enabled }) => (enabled ? 'none' : 'initial')};
|
||||||
background: ${({ theme, enabled }) => (enabled ? theme.primary1 : 'none')};
|
background: ${({ theme, enabled }) => (enabled ? theme.primary1 : 'none')};
|
||||||
color: ${({ theme, enabled }) => (enabled ? theme.white : theme.primary3)};
|
color: ${({ theme, enabled }) => (enabled ? theme.white : theme.text1)};
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
@@ -25,21 +25,21 @@ interface VersionToggleProps extends React.ComponentProps<typeof Link> {
|
|||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
const VersionToggle = styled(({ enabled, ...rest }: VersionToggleProps) => <Link {...rest} />)<VersionToggleProps>`
|
const VersionToggle = styled(({ enabled, ...rest }: VersionToggleProps) => <Link {...rest} />)<VersionToggleProps>`
|
||||||
border-radius: 16px;
|
border-radius: 12px;
|
||||||
opacity: ${({ enabled }) => (enabled ? 1 : 0.5)};
|
opacity: ${({ enabled }) => (enabled ? 1 : 0.5)};
|
||||||
cursor: ${({ enabled }) => (enabled ? 'pointer' : 'default')};
|
cursor: ${({ enabled }) => (enabled ? 'pointer' : 'default')};
|
||||||
background: ${({ theme }) => theme.primary5};
|
background: ${({ theme }) => theme.bg3};
|
||||||
border: 1px solid ${({ theme }) => theme.primary4};
|
|
||||||
color: ${({ theme }) => theme.primary1};
|
color: ${({ theme }) => theme.primary1};
|
||||||
display: flex;
|
display: flex;
|
||||||
width: fit-content;
|
width: fit-content;
|
||||||
|
margin-left: 0.5rem;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
:hover {
|
:hover {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
export function VersionSwitch() {
|
export default function VersionSwitch() {
|
||||||
const version = useToggledVersion()
|
const version = useToggledVersion()
|
||||||
const location = useLocation()
|
const location = useLocation()
|
||||||
const query = useParsedQueryString()
|
const query = useParsedQueryString()
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import Menu from '../Menu'
|
|||||||
|
|
||||||
import Row, { RowBetween } from '../Row'
|
import Row, { RowBetween } from '../Row'
|
||||||
import Web3Status from '../Web3Status'
|
import Web3Status from '../Web3Status'
|
||||||
import { VersionSwitch } from './VersionSwitch'
|
import VersionSwitch from './VersionSwitch'
|
||||||
|
|
||||||
const HeaderFrame = styled.div`
|
const HeaderFrame = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -45,6 +45,15 @@ const HeaderElement = styled.div`
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
`
|
`
|
||||||
|
|
||||||
|
const HeaderElementWrap = styled.div`
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
${({ theme }) => theme.mediaWidth.upToExtraSmall`
|
||||||
|
margin-top: 0.5rem;
|
||||||
|
`};
|
||||||
|
`
|
||||||
|
|
||||||
const Title = styled.div`
|
const Title = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -70,6 +79,7 @@ const AccountElement = styled.div<{ active: boolean }>`
|
|||||||
background-color: ${({ theme, active }) => (!active ? theme.bg1 : theme.bg3)};
|
background-color: ${({ theme, active }) => (!active ? theme.bg1 : theme.bg3)};
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
:focus {
|
:focus {
|
||||||
border: 1px solid blue;
|
border: 1px solid blue;
|
||||||
@@ -80,10 +90,7 @@ const TestnetWrapper = styled.div`
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
width: fit-content;
|
width: fit-content;
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
|
pointer-events: auto;
|
||||||
${({ theme }) => theme.mediaWidth.upToSmall`
|
|
||||||
display: none;
|
|
||||||
`};
|
|
||||||
`
|
`
|
||||||
|
|
||||||
const NetworkCard = styled(YellowCard)`
|
const NetworkCard = styled(YellowCard)`
|
||||||
@@ -120,6 +127,16 @@ const MigrateBanner = styled(AutoColumn)`
|
|||||||
`};
|
`};
|
||||||
`
|
`
|
||||||
|
|
||||||
|
const HeaderControls = styled.div`
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: flex-end;
|
||||||
|
|
||||||
|
${({ theme }) => theme.mediaWidth.upToSmall`
|
||||||
|
flex-direction: column;
|
||||||
|
`};
|
||||||
|
`
|
||||||
|
|
||||||
const NETWORK_LABELS: { [chainId in ChainId]: string | null } = {
|
const NETWORK_LABELS: { [chainId in ChainId]: string | null } = {
|
||||||
[ChainId.MAINNET]: null,
|
[ChainId.MAINNET]: null,
|
||||||
[ChainId.RINKEBY]: 'Rinkeby',
|
[ChainId.RINKEBY]: 'Rinkeby',
|
||||||
@@ -128,12 +145,6 @@ const NETWORK_LABELS: { [chainId in ChainId]: string | null } = {
|
|||||||
[ChainId.KOVAN]: 'Kovan'
|
[ChainId.KOVAN]: 'Kovan'
|
||||||
}
|
}
|
||||||
|
|
||||||
const BalanceWrapper = styled.div`
|
|
||||||
${({ theme }) => theme.mediaWidth.upToExtraSmall`
|
|
||||||
display: none;
|
|
||||||
`};
|
|
||||||
`
|
|
||||||
|
|
||||||
export default function Header() {
|
export default function Header() {
|
||||||
const { account, chainId } = useActiveWeb3React()
|
const { account, chainId } = useActiveWeb3React()
|
||||||
|
|
||||||
@@ -153,7 +164,7 @@ export default function Header() {
|
|||||||
</StyledInternalLink>
|
</StyledInternalLink>
|
||||||
.
|
.
|
||||||
</MigrateBanner>
|
</MigrateBanner>
|
||||||
<RowBetween padding="1rem">
|
<RowBetween style={{ alignItems: 'flex-start' }} padding="1rem 1rem 0 1rem">
|
||||||
<HeaderElement>
|
<HeaderElement>
|
||||||
<Title>
|
<Title>
|
||||||
<UniIcon id="link" to="/">
|
<UniIcon id="link" to="/">
|
||||||
@@ -171,25 +182,27 @@ export default function Header() {
|
|||||||
</TitleText>
|
</TitleText>
|
||||||
)}
|
)}
|
||||||
</Title>
|
</Title>
|
||||||
<TestnetWrapper style={{ pointerEvents: 'auto' }}>{!isMobile && <VersionSwitch />}</TestnetWrapper>
|
|
||||||
</HeaderElement>
|
</HeaderElement>
|
||||||
<HeaderElement>
|
<HeaderControls>
|
||||||
<TestnetWrapper>
|
<HeaderElement>
|
||||||
{!isMobile && NETWORK_LABELS[chainId] && <NetworkCard>{NETWORK_LABELS[chainId]}</NetworkCard>}
|
<TestnetWrapper>
|
||||||
</TestnetWrapper>
|
{!isMobile && NETWORK_LABELS[chainId] && <NetworkCard>{NETWORK_LABELS[chainId]}</NetworkCard>}
|
||||||
<AccountElement active={!!account} style={{ pointerEvents: 'auto' }}>
|
</TestnetWrapper>
|
||||||
<BalanceWrapper>
|
<AccountElement active={!!account} style={{ pointerEvents: 'auto' }}>
|
||||||
{account && userEthBalance ? (
|
{account && userEthBalance ? (
|
||||||
<Text style={{ flexShrink: 0 }} pl="0.75rem" pr="0.5rem" fontWeight={500}>
|
<Text style={{ flexShrink: 0 }} pl="0.75rem" pr="0.5rem" fontWeight={500}>
|
||||||
{userEthBalance?.toSignificant(4)} ETH
|
{userEthBalance?.toSignificant(4)} ETH
|
||||||
</Text>
|
</Text>
|
||||||
) : null}
|
) : null}
|
||||||
</BalanceWrapper>
|
<Web3Status />
|
||||||
<Web3Status />
|
</AccountElement>
|
||||||
</AccountElement>
|
</HeaderElement>
|
||||||
<Settings />
|
<HeaderElementWrap>
|
||||||
<Menu />
|
<VersionSwitch />
|
||||||
</HeaderElement>
|
<Settings />
|
||||||
|
<Menu />
|
||||||
|
</HeaderElementWrap>
|
||||||
|
</HeaderControls>
|
||||||
</RowBetween>
|
</RowBetween>
|
||||||
</HeaderFrame>
|
</HeaderFrame>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ const MenuItem = styled(ExternalLink)`
|
|||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
const CODE_LINK = 'https://github.com/Uniswap/uniswap-frontend'
|
const CODE_LINK = 'https://github.com/Uniswap/uniswap-interface'
|
||||||
|
|
||||||
export default function Menu() {
|
export default function Menu() {
|
||||||
const node = useRef<HTMLDivElement>()
|
const node = useRef<HTMLDivElement>()
|
||||||
|
|||||||
@@ -3,15 +3,13 @@ import { initReactI18next } from 'react-i18next'
|
|||||||
import XHR from 'i18next-xhr-backend'
|
import XHR from 'i18next-xhr-backend'
|
||||||
import LanguageDetector from 'i18next-browser-languagedetector'
|
import LanguageDetector from 'i18next-browser-languagedetector'
|
||||||
|
|
||||||
const LOAD_PATH: string = process.env.PUBLIC_URL === '.' ? `./locales/{{lng}}.json` : '/locales/{{lng}}.json'
|
|
||||||
|
|
||||||
i18next
|
i18next
|
||||||
.use(XHR)
|
.use(XHR)
|
||||||
.use(LanguageDetector)
|
.use(LanguageDetector)
|
||||||
.use(initReactI18next)
|
.use(initReactI18next)
|
||||||
.init({
|
.init({
|
||||||
backend: {
|
backend: {
|
||||||
loadPath: LOAD_PATH
|
loadPath: `./locales/{{lng}}.json`
|
||||||
},
|
},
|
||||||
react: {
|
react: {
|
||||||
useSuspense: true
|
useSuspense: true
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import ReactDOM from 'react-dom'
|
|||||||
import ReactGA from 'react-ga'
|
import ReactGA from 'react-ga'
|
||||||
import { Provider } from 'react-redux'
|
import { Provider } from 'react-redux'
|
||||||
import { NetworkContextName } from './constants'
|
import { NetworkContextName } from './constants'
|
||||||
|
import 'inter-ui'
|
||||||
import './i18n'
|
import './i18n'
|
||||||
import App from './pages/App'
|
import App from './pages/App'
|
||||||
import store from './state'
|
import store from './state'
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import React, { Suspense } from 'react'
|
import React, { Suspense } from 'react'
|
||||||
import { BrowserRouter, HashRouter, Route, Switch } from 'react-router-dom'
|
import { HashRouter, Route, Switch } from 'react-router-dom'
|
||||||
import styled from 'styled-components'
|
import styled from 'styled-components'
|
||||||
import GoogleAnalyticsReporter from '../components/analytics/GoogleAnalyticsReporter'
|
import GoogleAnalyticsReporter from '../components/analytics/GoogleAnalyticsReporter'
|
||||||
import Footer from '../components/Footer'
|
|
||||||
import Header from '../components/Header'
|
import Header from '../components/Header'
|
||||||
import Popups from '../components/Popups'
|
import Popups from '../components/Popups'
|
||||||
import Web3ReactManager from '../components/Web3ReactManager'
|
import Web3ReactManager from '../components/Web3ReactManager'
|
||||||
@@ -54,17 +53,10 @@ const Marginer = styled.div`
|
|||||||
margin-top: 5rem;
|
margin-top: 5rem;
|
||||||
`
|
`
|
||||||
|
|
||||||
let Router: React.ComponentType
|
|
||||||
if (process.env.PUBLIC_URL === '.') {
|
|
||||||
Router = HashRouter
|
|
||||||
} else {
|
|
||||||
Router = BrowserRouter
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
return (
|
return (
|
||||||
<Suspense fallback={null}>
|
<Suspense fallback={null}>
|
||||||
<Router>
|
<HashRouter>
|
||||||
<Route component={GoogleAnalyticsReporter} />
|
<Route component={GoogleAnalyticsReporter} />
|
||||||
<Route component={DarkModeQueryParamReader} />
|
<Route component={DarkModeQueryParamReader} />
|
||||||
<AppWrapper>
|
<AppWrapper>
|
||||||
@@ -90,10 +82,9 @@ export default function App() {
|
|||||||
</Switch>
|
</Switch>
|
||||||
</Web3ReactManager>
|
</Web3ReactManager>
|
||||||
<Marginer />
|
<Marginer />
|
||||||
<Footer />
|
|
||||||
</BodyWrapper>
|
</BodyWrapper>
|
||||||
</AppWrapper>
|
</AppWrapper>
|
||||||
</Router>
|
</HashRouter>
|
||||||
</Suspense>
|
</Suspense>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -168,8 +168,6 @@ export const TYPE = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const FixedGlobalStyle = createGlobalStyle`
|
export const FixedGlobalStyle = createGlobalStyle`
|
||||||
@import url('https://rsms.me/inter/inter.css');
|
|
||||||
|
|
||||||
html, input, textarea, button {
|
html, input, textarea, button {
|
||||||
font-family: 'Inter', sans-serif;
|
font-family: 'Inter', sans-serif;
|
||||||
letter-spacing: -0.018em;
|
letter-spacing: -0.018em;
|
||||||
|
|||||||
@@ -8419,6 +8419,11 @@ inquirer@^7.0.0:
|
|||||||
strip-ansi "^6.0.0"
|
strip-ansi "^6.0.0"
|
||||||
through "^2.3.6"
|
through "^2.3.6"
|
||||||
|
|
||||||
|
inter-ui@^3.13.1:
|
||||||
|
version "3.13.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/inter-ui/-/inter-ui-3.13.1.tgz#3b3841c1ab425035d0146b38c7ee7a640d3da3d8"
|
||||||
|
integrity sha512-A+gHBm9WXZZmIYHdQci9ZoIrsPkzwYvWqG2+DyrwOuxjZVnRyz3b73ridPUWI/JvZ1nGf2j0VdJ+vxh0/bKBwg==
|
||||||
|
|
||||||
internal-ip@^4.3.0:
|
internal-ip@^4.3.0:
|
||||||
version "4.3.0"
|
version "4.3.0"
|
||||||
resolved "https://registry.yarnpkg.com/internal-ip/-/internal-ip-4.3.0.tgz#845452baad9d2ca3b69c635a137acb9a0dad0907"
|
resolved "https://registry.yarnpkg.com/internal-ip/-/internal-ip-4.3.0.tgz#845452baad9d2ca3b69c635a137acb9a0dad0907"
|
||||||
|
|||||||
Reference in New Issue
Block a user