Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LuckySwap
interface
Commits
d85dccd0
Unverified
Commit
d85dccd0
authored
May 28, 2021
by
Moody Salem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: remove list update popup code
parent
37799caa
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
139 deletions
+7
-139
ListUpdatePopup.tsx
src/components/Popups/ListUpdatePopup.tsx
+0
-116
PopupItem.tsx
src/components/Popups/PopupItem.tsx
+0
-6
actions.ts
src/state/application/actions.ts
+7
-17
No files found.
src/components/Popups/ListUpdatePopup.tsx
deleted
100644 → 0
View file @
37799caa
import
{
diffTokenLists
,
TokenList
}
from
'
@uniswap/token-lists
'
import
React
,
{
useCallback
,
useMemo
}
from
'
react
'
import
ReactGA
from
'
react-ga
'
import
{
useDispatch
}
from
'
react-redux
'
import
{
Text
}
from
'
rebass
'
import
styled
from
'
styled-components/macro
'
import
{
AppDispatch
}
from
'
../../state
'
import
{
useRemovePopup
}
from
'
../../state/application/hooks
'
import
{
acceptListUpdate
}
from
'
../../state/lists/actions
'
import
{
TYPE
}
from
'
../../theme
'
import
listVersionLabel
from
'
../../utils/listVersionLabel
'
import
{
ButtonSecondary
}
from
'
../Button
'
import
{
AutoColumn
}
from
'
../Column
'
import
{
AutoRow
}
from
'
../Row
'
export
const
ChangesList
=
styled
.
ul
`
max-height: 400px;
overflow: auto;
`
export
default
function
ListUpdatePopup
({
popKey
,
listUrl
,
oldList
,
newList
,
auto
,
}:
{
popKey
:
string
listUrl
:
string
oldList
:
TokenList
newList
:
TokenList
auto
:
boolean
})
{
const
removePopup
=
useRemovePopup
()
const
removeThisPopup
=
useCallback
(()
=>
removePopup
(
popKey
),
[
popKey
,
removePopup
])
const
dispatch
=
useDispatch
<
AppDispatch
>
()
const
handleAcceptUpdate
=
useCallback
(()
=>
{
if
(
auto
)
return
ReactGA
.
event
({
category
:
'
Lists
'
,
action
:
'
Update List from Popup
'
,
label
:
listUrl
,
})
dispatch
(
acceptListUpdate
(
listUrl
))
removeThisPopup
()
},
[
auto
,
dispatch
,
listUrl
,
removeThisPopup
])
const
{
added
:
tokensAdded
,
changed
:
tokensChanged
,
removed
:
tokensRemoved
,
}
=
useMemo
(()
=>
{
return
diffTokenLists
(
oldList
.
tokens
,
newList
.
tokens
)
},
[
newList
.
tokens
,
oldList
.
tokens
])
const
numTokensChanged
=
useMemo
(
()
=>
Object
.
keys
(
tokensChanged
).
reduce
((
memo
,
chainId
:
any
)
=>
memo
+
Object
.
keys
(
tokensChanged
[
chainId
]).
length
,
0
),
[
tokensChanged
]
)
return
(
<
AutoRow
>
<
AutoColumn
style=
{
{
flex
:
'
1
'
}
}
gap=
"8px"
>
{
auto
?
(
<
TYPE
.
body
fontWeight=
{
500
}
>
The token list
"
{
oldList
.
name
}
"
has been updated to
{
'
'
}
<
strong
>
{
listVersionLabel
(
newList
.
version
)
}
</
strong
>
.
</
TYPE
.
body
>
)
:
(
<>
<
div
>
<
Text
>
An update is available for the token list
"
{
oldList
.
name
}
"
(
{
listVersionLabel
(
oldList
.
version
)
}
to
{
listVersionLabel
(
newList
.
version
)
}
).
</
Text
>
<
ChangesList
>
{
tokensAdded
.
length
>
0
?
(
<
li
>
{
tokensAdded
.
map
((
token
,
i
)
=>
(
<
React
.
Fragment
key=
{
`${token.chainId}-${token.address}`
}
>
<
strong
title=
{
token
.
address
}
>
{
token
.
symbol
}
</
strong
>
{
i
===
tokensAdded
.
length
-
1
?
null
:
'
,
'
}
</
React
.
Fragment
>
))
}{
'
'
}
added
</
li
>
)
:
null
}
{
tokensRemoved
.
length
>
0
?
(
<
li
>
{
tokensRemoved
.
map
((
token
,
i
)
=>
(
<
React
.
Fragment
key=
{
`${token.chainId}-${token.address}`
}
>
<
strong
title=
{
token
.
address
}
>
{
token
.
symbol
}
</
strong
>
{
i
===
tokensRemoved
.
length
-
1
?
null
:
'
,
'
}
</
React
.
Fragment
>
))
}{
'
'
}
removed
</
li
>
)
:
null
}
{
numTokensChanged
>
0
?
<
li
>
{
numTokensChanged
}
tokens updated
</
li
>
:
null
}
</
ChangesList
>
</
div
>
<
AutoRow
>
<
div
style=
{
{
flexGrow
:
1
,
marginRight
:
12
}
}
>
<
ButtonSecondary
onClick=
{
handleAcceptUpdate
}
>
Accept update
</
ButtonSecondary
>
</
div
>
<
div
style=
{
{
flexGrow
:
1
}
}
>
<
ButtonSecondary
onClick=
{
removeThisPopup
}
>
Dismiss
</
ButtonSecondary
>
</
div
>
</
AutoRow
>
</>
)
}
</
AutoColumn
>
</
AutoRow
>
)
}
src/components/Popups/PopupItem.tsx
View file @
d85dccd0
...
@@ -5,7 +5,6 @@ import styled, { ThemeContext } from 'styled-components'
...
@@ -5,7 +5,6 @@ import styled, { ThemeContext } from 'styled-components'
import
{
animated
}
from
'
react-spring
'
import
{
animated
}
from
'
react-spring
'
import
{
PopupContent
}
from
'
../../state/application/actions
'
import
{
PopupContent
}
from
'
../../state/application/actions
'
import
{
useRemovePopup
}
from
'
../../state/application/hooks
'
import
{
useRemovePopup
}
from
'
../../state/application/hooks
'
import
ListUpdatePopup
from
'
./ListUpdatePopup
'
import
TransactionPopup
from
'
./TransactionPopup
'
import
TransactionPopup
from
'
./TransactionPopup
'
export
const
StyledClose
=
styled
(
X
)
`
export
const
StyledClose
=
styled
(
X
)
`
...
@@ -77,11 +76,6 @@ export default function PopupItem({
...
@@ -77,11 +76,6 @@ export default function PopupItem({
txn
:
{
hash
,
success
,
summary
},
txn
:
{
hash
,
success
,
summary
},
}
=
content
}
=
content
popupContent
=
<
TransactionPopup
hash=
{
hash
}
success=
{
success
}
summary=
{
summary
}
/>
popupContent
=
<
TransactionPopup
hash=
{
hash
}
success=
{
success
}
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
}
/>
}
}
const
faderStyle
=
useSpring
({
const
faderStyle
=
useSpring
({
...
...
src/state/application/actions.ts
View file @
d85dccd0
import
{
createAction
}
from
'
@reduxjs/toolkit
'
import
{
createAction
}
from
'
@reduxjs/toolkit
'
import
{
TokenList
}
from
'
@uniswap/token-lists
'
export
type
PopupContent
=
export
type
PopupContent
=
{
|
{
txn
:
{
txn
:
{
hash
:
string
hash
:
string
success
:
boolean
success
:
boolean
summary
?:
string
summary
?:
string
}
}
}
}
|
{
listUpdate
:
{
listUrl
:
string
oldList
:
TokenList
newList
:
TokenList
auto
:
boolean
}
}
export
enum
ApplicationModal
{
export
enum
ApplicationModal
{
WALLET
,
WALLET
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment