Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Danh/type and swap #1148

Merged
merged 188 commits into from
Aug 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
188 commits
Select commit Hold shift + click to select a range
fd2b254
init
viet-nv Jun 26, 2022
dfc30ea
Merge branch 'main' of github.com:KyberNetwork/dmm-interface into fea…
viet-nv Jun 27, 2022
fed4bbd
Merge branch 'main' of github.com:KyberNetwork/dmm-interface into fea…
viet-nv Jun 27, 2022
39b706a
style: change background color
viet-nv Jun 28, 2022
0bfbb04
Merge branch 'main' of github.com:KyberNetwork/dmm-interface into fea…
viet-nv Jun 28, 2022
059b34c
Merge branch 'main' of github.com:KyberNetwork/dmm-interface into fea…
viet-nv Jun 29, 2022
d4c2fa1
style: swwap page
viet-nv Jun 29, 2022
a032884
Merge branch 'main' of github.com:KyberNetwork/dmm-interface into fea…
viet-nv Jun 29, 2022
0b575d0
style: swap form
viet-nv Jun 30, 2022
ed3607e
Merge branch 'main' of github.com:KyberNetwork/dmm-interface into fea…
viet-nv Jun 30, 2022
c22fff4
move recipient to address input
viet-nv Jun 30, 2022
a98c220
finish swap page
viet-nv Jul 1, 2022
8cf4946
fix: detail box animation
viet-nv Jul 1, 2022
5158f24
style: pools page
viet-nv Jul 3, 2022
a956e7e
Merge branch 'main' of github.com:KyberNetwork/dmm-interface into fea…
viet-nv Jul 3, 2022
26e01aa
style: redesign pools page
viet-nv Jul 4, 2022
7ec4f62
Merge branch 'main' of github.com:KyberNetwork/dmm-interface into fea…
viet-nv Jul 4, 2022
3a5f25f
update action button icon
viet-nv Jul 4, 2022
ba6eca5
Merge branch 'main' of github.com:KyberNetwork/dmm-interface into fea…
viet-nv Jul 4, 2022
abafe04
pools page
viet-nv Jul 4, 2022
1bfae68
mypools page
viet-nv Jul 4, 2022
32eebe4
mypools page
viet-nv Jul 5, 2022
1b5916f
Merge branch 'main' of github.com:KyberNetwork/dmm-interface into fea…
viet-nv Jul 5, 2022
4381b22
classic pools page
viet-nv Jul 5, 2022
7c07a7e
Merge branch 'main' of github.com:KyberNetwork/dmm-interface into fea…
viet-nv Jul 6, 2022
b335403
Merge branch 'main' of github.com:KyberNetwork/dmm-interface into fea…
viet-nv Jul 6, 2022
9638d85
style: about page
viet-nv Jul 6, 2022
0ca24ff
style: trending soon
viet-nv Jul 6, 2022
dd72b6a
Merge branch 'main' of github.com:KyberNetwork/dmm-interface into fea…
viet-nv Jul 6, 2022
9693529
Merge branch 'main' of github.com:KyberNetwork/dmm-interface into fea…
viet-nv Jul 6, 2022
47bfff4
style: truesight
viet-nv Jul 6, 2022
552d3aa
Merge branch 'main' of github.com:KyberNetwork/dmm-interface into fea…
viet-nv Jul 6, 2022
01fce98
Merge branch 'main' of github.com:KyberNetwork/dmm-interface into fea…
viet-nv Jul 7, 2022
054e49c
add/remove liquidity elastic
viet-nv Jul 7, 2022
028e8ca
addliquidity classic
viet-nv Jul 7, 2022
7e22266
Merge branch 'main' of github.com:KyberNetwork/dmm-interface into fea…
viet-nv Jul 7, 2022
02853e6
add/remove liquidity
viet-nv Jul 7, 2022
11bacaf
Merge branch 'main' of github.com:KyberNetwork/dmm-interface into fea…
viet-nv Jul 7, 2022
32d6a78
leader board
viet-nv Jul 8, 2022
bcae143
fiX: increase liquidity rinkeby
viet-nv Jul 8, 2022
b46129d
feat(add liquidity elastic): change select fee style
viet-nv Jul 8, 2022
f048ca6
Merge branch 'main' of github.com:KyberNetwork/dmm-interface into fea…
viet-nv Jul 11, 2022
10b5aab
style: update max/half btn
viet-nv Jul 11, 2022
9b9d385
feat: fee tier distribution
viet-nv Jul 11, 2022
7f65790
feat: add instruction text for pools
viet-nv Jul 11, 2022
a4292fd
farm guide
viet-nv Jul 12, 2022
807db0c
Swap Transaction settings (#1123)
hungdoansy Jul 12, 2022
52bfc1c
style: elastic farm
viet-nv Jul 12, 2022
17c9f62
Merge branch 'main' of github.com:KyberNetwork/dmm-interface into fea…
viet-nv Jul 13, 2022
7a98a82
style: classic farm
viet-nv Jul 13, 2022
798ff05
Merge branch 'main' of github.com:KyberNetwork/dmm-interface into fea…
viet-nv Jul 13, 2022
963baee
Merge branch 'main' of github.com:KyberNetwork/dmm-interface into fea…
viet-nv Jul 15, 2022
a325dce
fix: mix panel crash
viet-nv Jul 15, 2022
abeea8f
style: fix farm page css
viet-nv Jul 18, 2022
bc051a5
Merge branch 'main' of github.com:KyberNetwork/dmm-interface into fea…
viet-nv Jul 18, 2022
0b52148
fix: switch token on swap page
viet-nv Jul 18, 2022
082d158
Merge branch 'main' of github.com:KyberNetwork/dmm-interface into fea…
viet-nv Jul 18, 2022
01668bd
feat(swap-settings): add liquidity sources setting/panel (#1130)
hungdoansy Jul 18, 2022
35a4337
feat(swap-settings): implement GasPriceTracker panel (#1129)
hungdoansy Jul 18, 2022
1efef1c
Merge branch 'main' of github.com:KyberNetwork/dmm-interface into fea…
viet-nv Jul 18, 2022
b3501c6
style: fix select a token text on add liquidity when screen is too small
viet-nv Jul 18, 2022
b6f873c
fix: receipient issue when turn off expert mode
viet-nv Jul 18, 2022
db87bea
style: my pool layout
viet-nv Jul 18, 2022
01a25d7
Merge branch 'main' of github.com:KyberNetwork/dmm-interface into fea…
viet-nv Jul 18, 2022
538d998
fix: liquidity source
viet-nv Jul 18, 2022
aae608e
popups
viet-nv Jul 18, 2022
c783941
fix(gas-price-tracker): correct DeBank slug for optimism
hungdoansy Jul 18, 2022
6dbd3f1
fix: cant switch/select token when we have in/output currency on url
viet-nv Jul 18, 2022
6029687
style(token-modal): update ui
viet-nv Jul 18, 2022
b1c50d9
show common bases on pools select token
viet-nv Jul 18, 2022
d767cf9
refactor(network-modal): duplicate component on wrong network modal
viet-nv Jul 18, 2022
5565b0a
Highlight buttons when redirecting from About page (#1142)
hungdoansy Jul 19, 2022
9482e91
fix: recipient still there when turn off advance mode
viet-nv Jul 19, 2022
7b25119
Merge branch 'feature/modern-theme' of github.com:KyberNetwork/dmm-in…
viet-nv Jul 19, 2022
4261d8e
style(pro-chart): update background color
viet-nv Jul 19, 2022
80ad304
feat(pools): add stable pools filter
viet-nv Jul 19, 2022
3f73375
Merge branch 'main' of github.com:KyberNetwork/dmm-interface into fea…
viet-nv Jul 19, 2022
c1275bd
style(farm)
viet-nv Jul 19, 2022
f3b9449
fix: reset page to 1 when select stable pools
viet-nv Jul 19, 2022
14839d0
style(classic-vesting): vesting summary
viet-nv Jul 19, 2022
e90b272
type && swap
nguyenhoaidanh Jul 19, 2022
e530995
Merge remote-tracking branch 'origin/main' into type-swap
nguyenhoaidanh Jul 19, 2022
04f1c19
chore
nguyenhoaidanh Jul 20, 2022
3d9848b
Merge branch 'type-swap' into feature/modern-theme
nguyenhoaidanh Jul 20, 2022
54c98f2
style: classic vesting
viet-nv Jul 20, 2022
43527a3
split component
nguyenhoaidanh Jul 20, 2022
e1b5604
Merge remote-tracking branch 'origin/feature/modern-theme' into danh/…
nguyenhoaidanh Jul 20, 2022
b9bb35e
refactor(slippage-setting): split components
hungdoansy Jul 20, 2022
94b768c
fix: layout issue
viet-nv Jul 20, 2022
1cfbbd2
feat(liquidity-sources-panel): show scroll bar
hungdoansy Jul 20, 2022
af7a1ea
feat(swap): highlight Swap box when redirecting from About page
hungdoansy Jul 20, 2022
6e08855
Merge pull request #1145 from KyberNetwork/refactor/update-style-for-…
hungdoansy Jul 20, 2022
769fbe6
Merge pull request #1147 from KyberNetwork/feature/highlight-swap-box
hungdoansy Jul 20, 2022
e594788
add claim popup
viet-nv Jul 20, 2022
2918858
token info Accordion
nguyenhoaidanh Jul 20, 2022
401953a
change bnb elastic subgraph to prod account
viet-nv Jul 20, 2022
434f1ce
Merge branch 'main' of github.com:KyberNetwork/dmm-interface into fea…
viet-nv Jul 21, 2022
5546c0f
update live chart mobile
viet-nv Jul 21, 2022
c0630a2
update knc about text
viet-nv Jul 21, 2022
98ca589
Merge remote-tracking branch 'origin/feature/modern-theme' into danh/…
nguyenhoaidanh Jul 21, 2022
f584109
update tutorial linkl
viet-nv Jul 21, 2022
2d15ff2
rm unuse package
nguyenhoaidanh Jul 21, 2022
a45824b
Merge remote-tracking branch 'origin/feature/modern-theme' into danh/…
nguyenhoaidanh Jul 21, 2022
04bae52
update tutorial linkl
viet-nv Jul 21, 2022
ed8fc48
style: farm page
viet-nv Jul 21, 2022
bab4314
syle: tweak some ui
viet-nv Jul 21, 2022
eae5030
update ux
nguyenhoaidanh Jul 21, 2022
e2c9219
Merge remote-tracking branch 'origin/feature/modern-theme' into danh/…
nguyenhoaidanh Jul 21, 2022
67c9f03
fix some eslint
nguyenhoaidanh Jul 22, 2022
c1bf615
fix: kami comment
viet-nv Jul 22, 2022
56c32fe
fix: prakhar comment
viet-nv Jul 22, 2022
2dcd7aa
style(about): use ButtonLight for View Farms
hungdoansy Jul 22, 2022
06f40b5
fix: balace
viet-nv Jul 22, 2022
f1d8419
Merge branch 'main' of github.com:KyberNetwork/dmm-interface into fea…
viet-nv Jul 22, 2022
bb7a10a
update tutorial popup
viet-nv Jul 22, 2022
f46ad61
Merge remote-tracking branch 'origin/feature/modern-theme' into danh/…
nguyenhoaidanh Jul 22, 2022
12a011c
update tutorial popup
viet-nv Jul 22, 2022
4653aa5
fixed comment
viet-nv Jul 22, 2022
566597a
Merge remote-tracking branch 'origin/feature/modern-theme' into danh/…
nguyenhoaidanh Jul 22, 2022
d2b2dc1
chore: highlight buttons when URL params match the condition
hungdoansy Jul 24, 2022
d6dcc81
Merge branch 'main' of github.com:KyberNetwork/dmm-interface into fea…
viet-nv Jul 25, 2022
3bdc22f
chore(aggregator-stats): add header to get the latest version of API
hungdoansy Jul 25, 2022
2a0952d
style(advance-mode-popup): refactor to reuse advance mode popup
viet-nv Jul 25, 2022
4e5c870
Merge branch 'feature/modern-theme' of github.com:KyberNetwork/dmm-in…
viet-nv Jul 25, 2022
dab30f4
change container size of campaign and truesight
viet-nv Jul 25, 2022
d19e37d
add tooltip on swap setting
viet-nv Jul 25, 2022
7895d7b
Merge branch 'main' of github.com:KyberNetwork/dmm-interface into fea…
viet-nv Jul 25, 2022
9b6fa0c
fix: swap form is not central
viet-nv Jul 25, 2022
2fb6f80
only show 5 tx in account detail popup
viet-nv Jul 25, 2022
4f4b5b0
fix: header dropdown
viet-nv Jul 25, 2022
3984ef3
Merge remote-tracking branch 'origin/feature/modern-theme' into danh/…
nguyenhoaidanh Jul 25, 2022
2b1feb8
Merge remote-tracking branch 'origin/main' into danh/type-and-swap
nguyenhoaidanh Jul 25, 2022
42ff1ac
fix conflict
nguyenhoaidanh Jul 25, 2022
631c006
connect api get
nguyenhoaidanh Jul 25, 2022
b07f48a
build
nguyenhoaidanh Jul 26, 2022
ac7b088
use logo
nguyenhoaidanh Jul 26, 2022
8f4f9ac
Merge remote-tracking branch 'origin/main' into danh/type-and-swap
nguyenhoaidanh Jul 26, 2022
e8f8a5e
build
nguyenhoaidanh Jul 26, 2022
ec9e7d5
update ux
nguyenhoaidanh Jul 27, 2022
2c36cde
Merge remote-tracking branch 'origin/main' into danh/type-and-swap
nguyenhoaidanh Jul 27, 2022
1e2cf1b
fix conflict
nguyenhoaidanh Jul 27, 2022
6abd54d
Merge remote-tracking branch 'origin/main' into danh/type-and-swap
nguyenhoaidanh Jul 27, 2022
c267d19
update ux
nguyenhoaidanh Jul 27, 2022
95c8be7
Merge remote-tracking branch 'origin/main' into danh/type-and-swap
nguyenhoaidanh Jul 27, 2022
1ee8192
Merge remote-tracking branch 'origin/main' into danh/type-and-swap
nguyenhoaidanh Jul 27, 2022
9a44b2c
Merge remote-tracking branch 'origin/main' into danh/type-and-swap
nguyenhoaidanh Jul 27, 2022
91895e5
sort pair
nguyenhoaidanh Jul 27, 2022
3a2b9b3
fix: chain network not refetch
nguyenhoaidanh Jul 27, 2022
c15c542
fix ctrl+k window
nguyenhoaidanh Jul 27, 2022
fbe2159
Merge remote-tracking branch 'origin/main' into danh/type-and-swap
nguyenhoaidanh Jul 28, 2022
529eaf2
fix amount wrong
nguyenhoaidanh Jul 31, 2022
e0f7e08
Merge remote-tracking branch 'origin/main' into danh/type-and-swap
nguyenhoaidanh Jul 31, 2022
0186abe
remove conflict qs
nguyenhoaidanh Aug 1, 2022
6ec321d
enter to import token modal
nguyenhoaidanh Aug 1, 2022
d7bd287
icon enter button
nguyenhoaidanh Aug 1, 2022
3da3057
update api
nguyenhoaidanh Aug 2, 2022
9a6806c
Merge remote-tracking branch 'origin/main' into danh/type-and-swap
nguyenhoaidanh Aug 2, 2022
ae71557
update feedback
nguyenhoaidanh Aug 2, 2022
1c20d15
fix feedback
nguyenhoaidanh Aug 2, 2022
6773c42
update feedback
nguyenhoaidanh Aug 2, 2022
b068ec9
Merge remote-tracking branch 'origin/main' into danh/type-and-swap
nguyenhoaidanh Aug 2, 2022
48a20bc
add comment
nguyenhoaidanh Aug 2, 2022
e2957f7
update feedback
nguyenhoaidanh Aug 2, 2022
c8ffabb
update feedback
nguyenhoaidanh Aug 2, 2022
8344b52
update text token info
nguyenhoaidanh Aug 2, 2022
a046c12
Merge remote-tracking branch 'origin/main' into danh/type-and-swap
nguyenhoaidanh Aug 2, 2022
8a072cf
update feedback
nguyenhoaidanh Aug 3, 2022
7afe20c
update feedback
nguyenhoaidanh Aug 3, 2022
a56d87f
update feedback
nguyenhoaidanh Aug 3, 2022
8b04206
update feedback
nguyenhoaidanh Aug 3, 2022
7e0a5a1
fix issues: chớp token warning
nguyenhoaidanh Aug 3, 2022
26d685f
fix css
nguyenhoaidanh Aug 3, 2022
bfe9078
fix ios outline
nguyenhoaidanh Aug 3, 2022
ab90dc4
tracking, toast.
nguyenhoaidanh Aug 4, 2022
a04e5fd
Merge remote-tracking branch 'origin/main' into danh/type-and-swap
nguyenhoaidanh Aug 4, 2022
42b5486
fix conflict
nguyenhoaidanh Aug 4, 2022
40db6d3
add tracking
nguyenhoaidanh Aug 4, 2022
e39d3c2
update tooltip
nguyenhoaidanh Aug 4, 2022
93da0cb
update font
nguyenhoaidanh Aug 4, 2022
1272c20
fix bug: not show toast after typing
nguyenhoaidanh Aug 4, 2022
91710cf
fix: popup close nearest
nguyenhoaidanh Aug 4, 2022
8799cf4
fix notipopup
nguyenhoaidanh Aug 4, 2022
ef8362a
fix bug change change
nguyenhoaidanh Aug 4, 2022
24b2256
fix blur
nguyenhoaidanh Aug 4, 2022
c8214f3
refactor popup
nguyenhoaidanh Aug 4, 2022
b0c3046
fix bug can not like pair
nguyenhoaidanh Aug 4, 2022
c4f9a73
Merge remote-tracking branch 'origin/main' into danh/type-and-swap
nguyenhoaidanh Aug 5, 2022
38d1ca9
update api
nguyenhoaidanh Aug 5, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ REACT_APP_FIREBASE_VAPID_KEY=BGO4YGVpmvxoMlqILCfVUVfyA0M5ohAKp_0-p1jqfGm15evDld0
REACT_APP_NOTIFICATION_API=https://notification.kyberswap.com/api

REACT_APP_CAMPAIGN_BASE_URL=https://campaigns.kyberswap.com
REACT_APP_TYPE_AND_SWAP_URL=https://type-swap.dev.kyberengineering.io/api

REACT_APP_TRANSAK_URL=https://global.transak.com
REACT_APP_TRANSAK_API_KEY=48949c0b-2d20-4e3a-a311-51ca91ae8c0d
Expand Down
1 change: 1 addition & 0 deletions .env.dev
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ REACT_APP_FIREBASE_VAPID_KEY=BCH2laZcZj5fJyW2Od-iXyAy8OhJ2jpJDWJornW6JDSOi29IFeN
REACT_APP_NOTIFICATION_API=https://notification.dev.kyberengineering.io/api

REACT_APP_CAMPAIGN_BASE_URL=https://campaigns.dev.kyberengineering.io
REACT_APP_TYPE_AND_SWAP_URL=https://type-swap.dev.kyberengineering.io/api

REACT_APP_TRANSAK_URL=https://staging-global.transak.com
REACT_APP_TRANSAK_API_KEY=327b8b63-626b-4376-baf2-70a304c48488
Expand Down
1 change: 1 addition & 0 deletions .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ REACT_APP_FIREBASE_VAPID_KEY=BGO4YGVpmvxoMlqILCfVUVfyA0M5ohAKp_0-p1jqfGm15evDld0
REACT_APP_NOTIFICATION_API=https://notification.kyberswap.com/api

REACT_APP_CAMPAIGN_BASE_URL=https://campaigns.kyberswap.com
REACT_APP_TYPE_AND_SWAP_URL=https://tns.kyberengineering.io/api

REACT_APP_TRANSAK_URL=https://global.transak.com
REACT_APP_TRANSAK_API_KEY=48949c0b-2d20-4e3a-a311-51ca91ae8c0d
Expand Down
1 change: 1 addition & 0 deletions .env.stg
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ REACT_APP_FIREBASE_VAPID_KEY=BGO4YGVpmvxoMlqILCfVUVfyA0M5ohAKp_0-p1jqfGm15evDld0
REACT_APP_NOTIFICATION_API=https://notification.kyberswap.com/api

REACT_APP_CAMPAIGN_BASE_URL=https://campaigns.stg.kyberengineering.io
REACT_APP_TYPE_AND_SWAP_URL=https://type-swap.stg.kyberengineering.io/api

REACT_APP_TRANSAK_URL=https://staging-global.transak.com
REACT_APP_TRANSAK_API_KEY=327b8b63-626b-4376-baf2-70a304c48488
Expand Down
17 changes: 7 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,15 @@
"@types/react-virtualized-auto-sizer": "^1.0.0",
"@types/react-window": "^1.8.2",
"@types/rebass": "^4.0.5",
"@types/rebass__forms": "^4.0.4",
"@types/styled-components": "^5.1.0",
"@types/wcag-contrast": "^3.0.0",
"@types/big.js": "^6.0.0",
"@types/d3": "^7.1.0",
"@types/mixpanel-browser": "^2.38.0",
"@types/ms.macro": "^2.0.0",
"@types/react-copy-to-clipboard": "^5.0.2",
"@types/react-gtm-module": "^2.0.1",
"@types/recharts": "^1.8.23",
"@typescript-eslint/eslint-plugin": "^2.31.0",
"@typescript-eslint/parser": "^2.31.0",
"@uniswap/token-lists": "^1.0.0-beta.21",
Expand Down Expand Up @@ -133,16 +139,8 @@
"@kyberswap/ks-sdk-elastic": "^0.0.43",
"@lingui/detect-locale": "^3.10.4",
"@lingui/react": "^3.10.2",
"@rebass/forms": "^4.0.6",
"@sentry/react": "^6.16.1",
"@typeform/embed-react": "^1.2.4",
"@types/big.js": "^6.0.0",
"@types/d3": "^7.1.0",
"@types/mixpanel-browser": "^2.38.0",
"@types/ms.macro": "^2.0.0",
"@types/react-copy-to-clipboard": "^5.0.2",
"@types/react-gtm-module": "^2.0.1",
"@types/recharts": "^1.8.23",
"@uniswap/default-token-list": "^2.0.0",
"aos": "^2.3.4",
"d3": "^7.3.0",
Expand All @@ -162,7 +160,6 @@
"react-gtm-module": "^2.0.11",
"react-helmet": "^6.1.0",
"react-indiana-drag-scroll": "^2.0.1",
"react-player": "^2.9.0",
"react-use": "^15.3.4",
"recharts": "^2.1.6",
"swiper": "^8.0.7",
Expand Down
3 changes: 3 additions & 0 deletions src/assets/svg/notification_icon_warning.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions src/components/LiveChart/AnimatingNumber.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react'
import { useEffect, useRef, useState } from 'react'
import React, { useEffect, useRef, useState } from 'react'
import styled from 'styled-components'
import { Text, Flex } from 'rebass'
import useTheme from 'hooks/useTheme'
Expand Down
29 changes: 16 additions & 13 deletions src/components/Menu/FaucetModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,24 @@ import { Trans, t } from '@lingui/macro'
import React, { useContext, useEffect, useMemo, useState } from 'react'
import { Flex, Text } from 'rebass'
import { ApplicationModal } from 'state/application/actions'
import { useAddPopup, useModalOpen, useToggleModal, useWalletModalToggle } from 'state/application/hooks'
import { ThemeContext } from 'styled-components'
import {
NotificationType,
useModalOpen,
useNotify,
useToggleModal,
useWalletModalToggle,
} from 'state/application/hooks'
import styled, { ThemeContext } from 'styled-components'
import { ButtonPrimary } from 'components/Button'
import { getTokenLogoURL, isAddress, shortenAddress } from 'utils'
import styled from 'styled-components'
import { CloseIcon } from 'theme'
import { RowBetween } from 'components/Row'
import { useActiveWeb3React } from 'hooks'
import Modal from 'components/Modal'
import { Fraction, ChainId } from '@kyberswap/ks-sdk-core'
import { BigNumber } from 'ethers'
import { useAllTokens } from 'hooks/Tokens'
import { filterTokens } from 'components/SearchModal/filtering'
import { filterTokens } from 'utils/filtering'
import Logo from 'components/Logo'
import useMixpanel, { MIXPANEL_TYPE } from 'hooks/useMixpanel'
import JSBI from 'jsbi'
Expand Down Expand Up @@ -50,7 +55,7 @@ function FaucetModal() {
const toggle = useToggleModal(ApplicationModal.FAUCET_POPUP)
const theme = useContext(ThemeContext)
const [rewardData, setRewardData] = useState<{ amount: BigNumber; tokenAddress: string; program: number }>()
const addPopup = useAddPopup()
const notify = useNotify()
const toggleWalletModal = useWalletModalToggle()
const { mixpanelHandler } = useMixpanel()
const allTokens = useAllTokens()
Expand Down Expand Up @@ -84,14 +89,12 @@ function FaucetModal() {
})
const content = await rawResponse.json()
if (content) {
addPopup({
simple: {
title: t`Request to Faucet - Submitted`,
success: true,
summary: t`You will receive ${
rewardData?.amount ? getFullDisplayBalance(rewardData?.amount, token?.decimals) : 0
} ${tokenSymbol} soon!`,
},
notify({
title: t`Request to Faucet - Submitted`,
type: NotificationType.SUCCESS,
summary: t`You will receive ${
rewardData?.amount ? getFullDisplayBalance(rewardData?.amount, token?.decimals) : 0
} ${tokenSymbol} soon!`,
})
setRewardData(rw => {
if (rw) {
Expand Down
6 changes: 3 additions & 3 deletions src/components/Modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export interface ModalProps {
maxWidth?: number | string
width?: string
zindex?: number | string
initialFocusRef?: React.RefObject<any>
enableInitialFocusInput?: boolean
className?: string
children?: React.ReactNode
transition?: boolean
Expand All @@ -93,7 +93,7 @@ export default function Modal({
maxHeight = 90,
maxWidth = 420,
width,
initialFocusRef,
enableInitialFocusInput = false,
className,
children,
transition = true,
Expand Down Expand Up @@ -140,7 +140,7 @@ export default function Modal({
className={className}
>
{/* prevents the automatic focusing of inputs on mobile by the reach dialog */}
{!initialFocusRef && isMobile ? <div tabIndex={1} /> : null}
{!enableInitialFocusInput && isMobile ? <div tabIndex={1} /> : null}
{children}
</StyledDialogContent>
</StyledDialogOverlay>
Expand Down
6 changes: 3 additions & 3 deletions src/components/NetworkModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import styled from 'styled-components'
import { Trans } from '@lingui/macro'

import { NETWORKS_INFO, MAINNET_NETWORKS } from '../../constants/networks'
import { NETWORKS_INFO, MAINNET_NETWORKS, SUPPORTED_NETWORKS } from '../../constants/networks'
import { useModalOpen, useNetworkModalToggle } from 'state/application/hooks'

import { ApplicationModal } from 'state/application/actions'
Expand Down Expand Up @@ -76,7 +76,7 @@ export const SelectNetworkButton = styled(ButtonEmpty)`
cursor: not-allowed;
}
`

const SHOW_NETWORKS = process.env.NODE_ENV === 'production' ? MAINNET_NETWORKS : SUPPORTED_NETWORKS
export default function NetworkModal(): JSX.Element | null {
const { chainId } = useActiveWeb3React()
const networkModalOpen = useModalOpen(ApplicationModal.NETWORK)
Expand All @@ -98,7 +98,7 @@ export default function NetworkModal(): JSX.Element | null {
</Flex>
</Flex>
<NetworkList>
{MAINNET_NETWORKS.map((key: ChainId, i: number) => {
{SHOW_NETWORKS.map((key: ChainId, i: number) => {
if (chainId === key) {
return (
<SelectNetworkButton key={i} padding="0">
Expand Down
119 changes: 62 additions & 57 deletions src/components/Popups/PopupItem.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
import React, { useCallback, useContext, useEffect } from 'react'
import { X } from 'react-feather'
import { useSpring } from 'react-spring/web'
import styled, { keyframes, ThemeContext } from 'styled-components'
import styled, { DefaultTheme, keyframes, ThemeContext } from 'styled-components'
import { animated } from 'react-spring'
import { PopupContent } from 'state/application/actions'
import { useRemovePopup } from 'state/application/hooks'
import { PopupContentListUpdate, PopupContentSimple, PopupContentTxn, PopupType } from 'state/application/actions'
import { NotificationType, useRemovePopup } from 'state/application/hooks'
import ListUpdatePopup from './ListUpdatePopup'
import TransactionPopup from './TransactionPopup'
import SimplePopup from './SimplePopup'
import { Flex } from 'rebass'

export const StyledClose = styled(X)`
position: absolute;
right: 10px;
top: 10px;

margin-left: 10px;
:hover {
cursor: pointer;
}
`
const delta = window.innerWidth + 'px'

const rtl = keyframes`
from {
opacity: 0;
transform: translateX(1000px);
transform: translateX(${delta});
}

to {
opacity: 1;
transform: translateX(0);
Expand All @@ -36,25 +34,28 @@ const ltr = keyframes`
opacity: 1;
transform: translateX(0);
}

to {
opacity: 0;
transform: translateX(1000px);
transform: translateX(${delta});
}
`

export const Popup = styled.div<{ success?: boolean }>`
const getBackgroundColor = (theme: DefaultTheme, type: NotificationType = NotificationType.ERROR) => {
const mapColor = {
[NotificationType.SUCCESS]: theme.bg21,
[NotificationType.ERROR]: theme.bg22,
[NotificationType.WARNING]: theme.bg23,
}
return mapColor[type]
}

export const Popup = styled.div<{ type?: NotificationType }>`
display: inline-block;
width: 100%;
background: ${({ theme, success }) => (success ? theme.bg21 : theme.bg22)};
background: ${({ theme, type }) => getBackgroundColor(theme, type)};
position: relative;
padding: 20px;
padding-right: 36px;

${({ theme }) => theme.mediaWidth.upToSmall`
padding: 12px;
padding-right: 24px;
`}
padding-right: 12px;
`

const Fader = styled.div`
Expand All @@ -68,19 +69,19 @@ const Fader = styled.div`

const AnimatedFader = animated(Fader)

const PopupWrapper = styled.div`
const PopupWrapper = styled.div<{ removeAfterMs?: number | null }>`
position: relative;
isolation: isolate;
border-radius: 10px;
overflow: hidden;
animation: ${rtl} 1.5s ease-in-out, ${ltr} 1.5s ease-in-out 14.15s;

${({ theme }) => theme.mediaWidth.upToSmall`
width: min(calc(100vw - 32px), 425px);

&:not(:first-of-type) {
margin-top: 10px;
}
width: min(calc(100vw - 32px), 425px);
animation: ${rtl} 0.7s ease-in-out,
${ltr} 0.5s ease-in-out ${({ removeAfterMs }) => (removeAfterMs || 15000) / 1000 - 0.2}s; // animation out auto play after removeAfterMs - 0.2 seconds
&:not(:first-of-type) {
margin-top: 15px;
}
${({ theme }) => theme.mediaWidth.upToMedium`
margin: auto;
`}
`

Expand All @@ -97,16 +98,17 @@ export default function PopupItem({
removeAfterMs,
content,
popKey,
popupType,
}: {
removeAfterMs: number | null
content: PopupContent
content: PopupContentTxn | PopupContentListUpdate | PopupContentSimple
popKey: string
popupType: PopupType
}) {
const removePopup = useRemovePopup()
const removeThisPopup = useCallback(() => removePopup(popKey), [popKey, removePopup])
useEffect(() => {
if (removeAfterMs === null) return undefined

if (removeAfterMs === null) return
const timeout = setTimeout(() => {
removeThisPopup()
}, removeAfterMs)
Expand All @@ -118,42 +120,45 @@ export default function PopupItem({

const theme = useContext(ThemeContext)

let notiType: NotificationType
let popupContent
if ('txn' in content) {
const {
txn: { hash, success, type, summary },
} = content
popupContent = <TransactionPopup hash={hash} success={success} type={type} summary={summary} />
} else if ('listUpdate' in content) {
const {
listUpdate: { listUrl, oldList, newList, auto },
} = content
popupContent = <ListUpdatePopup popKey={popKey} listUrl={listUrl} oldList={oldList} newList={newList} auto={auto} />
} else if ('simple' in content) {
const {
simple: { title, success, summary },
} = content
popupContent = <SimplePopup title={title} success={success} summary={summary} />
} else if ('truesightNoti' in content) {
const {
truesightNoti: { title },
} = content
popupContent = <SimplePopup title={title} />
switch (popupType) {
case PopupType.SIMPLE: {
const { title, summary, type = NotificationType.ERROR } = content as PopupContentSimple
notiType = type
popupContent = <SimplePopup title={title} type={type} summary={summary} />
break
}
case PopupType.TRANSACTION: {
const { hash, type, summary, notiType: _notiType = NotificationType.ERROR } = content as PopupContentTxn
notiType = _notiType
popupContent = <TransactionPopup hash={hash} notiType={notiType} type={type} summary={summary} />
break
}
case PopupType.LIST_UPDATE: {
const { listUrl, oldList, newList, auto } = content as PopupContentListUpdate
notiType = NotificationType.SUCCESS
popupContent = (
<ListUpdatePopup popKey={popKey} listUrl={listUrl} oldList={oldList} newList={newList} auto={auto} />
)
break
}
}

const faderStyle = useSpring({
from: { width: '100%' },
to: { width: '0%' },
config: { duration: removeAfterMs ?? undefined },
})

return (
<PopupWrapper>
<PopupWrapper removeAfterMs={removeAfterMs}>
<SolidBackgroundLayer />
<Popup success={'txn' in content ? content.txn.success : true}>
<StyledClose color={theme.text2} onClick={removeThisPopup} />
{popupContent}
{removeAfterMs !== null ? <AnimatedFader style={faderStyle} /> : null}
<Popup type={notiType}>
<Flex justifyContent={'space-between'}>
{popupContent}
<StyledClose color={theme.text2} onClick={removeThisPopup} />
</Flex>
{removeAfterMs && <AnimatedFader style={faderStyle} />}
</Popup>
</PopupWrapper>
)
Expand Down
Loading