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
8bed3900
Unverified
Commit
8bed3900
authored
Jan 18, 2021
by
Ian Lapham
Committed by
GitHub
Jan 18, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improvements(lists): update defaults, style updates (#1270)
* update defaults, style updates * update icon color
parent
a1000c65
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
50 deletions
+39
-50
index.tsx
src/components/Settings/index.tsx
+13
-16
lists.ts
src/constants/lists.ts
+1
-4
uniswap-default.tokenlist.json
src/constants/tokenLists/uniswap-default.tokenlist.json
+18
-2
reducer.test.ts
src/state/lists/reducer.test.ts
+7
-28
No files found.
src/components/Settings/index.tsx
View file @
8bed3900
...
@@ -12,7 +12,7 @@ import {
...
@@ -12,7 +12,7 @@ import {
useUserSingleHopOnly
useUserSingleHopOnly
}
from
'
../../state/user/hooks
'
}
from
'
../../state/user/hooks
'
import
{
TYPE
}
from
'
../../theme
'
import
{
TYPE
}
from
'
../../theme
'
import
{
ButtonError
,
ButtonGray
}
from
'
../Button
'
import
{
ButtonError
}
from
'
../Button
'
import
{
AutoColumn
}
from
'
../Column
'
import
{
AutoColumn
}
from
'
../Column
'
import
Modal
from
'
../Modal
'
import
Modal
from
'
../Modal
'
import
QuestionHelper
from
'
../QuestionHelper
'
import
QuestionHelper
from
'
../QuestionHelper
'
...
@@ -27,6 +27,10 @@ const StyledMenuIcon = styled(Settings)`
...
@@ -27,6 +27,10 @@ const StyledMenuIcon = styled(Settings)`
> * {
> * {
stroke:
${({
theme
})
=>
theme
.
text2
}
;
stroke:
${({
theme
})
=>
theme
.
text2
}
;
}
}
:hover {
opacity: 0.7;
}
`
`
const
StyledCloseIcon
=
styled
(
X
)
`
const
StyledCloseIcon
=
styled
(
X
)
`
...
@@ -115,11 +119,6 @@ const ModalContentWrapper = styled.div`
...
@@ -115,11 +119,6 @@ const ModalContentWrapper = styled.div`
border-radius: 20px;
border-radius: 20px;
`
`
const
ButtonWrapper
=
styled
(
ButtonGray
)
`
padding: 6px;
border-radius: 8px;
`
export
default
function
SettingsTab
()
{
export
default
function
SettingsTab
()
{
const
node
=
useRef
<
HTMLDivElement
>
()
const
node
=
useRef
<
HTMLDivElement
>
()
const
open
=
useModalOpen
(
ApplicationModal
.
SETTINGS
)
const
open
=
useModalOpen
(
ApplicationModal
.
SETTINGS
)
...
@@ -180,16 +179,14 @@ export default function SettingsTab() {
...
@@ -180,16 +179,14 @@ export default function SettingsTab() {
</
ModalContentWrapper
>
</
ModalContentWrapper
>
</
Modal
>
</
Modal
>
<
StyledMenuButton
onClick=
{
toggle
}
id=
"open-settings-dialog-button"
>
<
StyledMenuButton
onClick=
{
toggle
}
id=
"open-settings-dialog-button"
>
<
ButtonWrapper
width=
"fit-content"
>
<
StyledMenuIcon
/>
<
StyledMenuIcon
/>
{
expertMode
?
(
{
expertMode
?
(
<
EmojiWrapper
>
<
EmojiWrapper
>
<
span
role=
"img"
aria
-
label=
"wizard-icon"
>
<
span
role=
"img"
aria
-
label=
"wizard-icon"
>
🧙
🧙
</
span
>
</
span
>
</
EmojiWrapper
>
</
EmojiWrapper
>
)
:
null
}
)
:
null
}
</
ButtonWrapper
>
</
StyledMenuButton
>
</
StyledMenuButton
>
{
open
&&
(
{
open
&&
(
<
MenuFlyout
>
<
MenuFlyout
>
...
...
src/constants/lists.ts
View file @
8bed3900
// the Uniswap Default token list lives here
export
const
DEFAULT_TOKEN_LIST_URL
=
'
tokens.uniswap.eth
'
// used to mark unsupported tokens, these are hosted lists of unsupported tokens
// used to mark unsupported tokens, these are hosted lists of unsupported tokens
/**
/**
* @TODO add list from blockchain association
* @TODO add list from blockchain association
...
@@ -38,4 +35,4 @@ export const DEFAULT_LIST_OF_LISTS: string[] = [
...
@@ -38,4 +35,4 @@ export const DEFAULT_LIST_OF_LISTS: string[] = [
]
]
// default lists to be 'active' aka searched across
// default lists to be 'active' aka searched across
export
const
DEFAULT_ACTIVE_LIST_URLS
:
string
[]
=
[
DEFAULT_TOKEN_LIST_URL
]
export
const
DEFAULT_ACTIVE_LIST_URLS
:
string
[]
=
[]
src/constants/tokenLists/uniswap-default.tokenlist.json
View file @
8bed3900
{
{
"name"
:
"Uniswap Default List"
,
"name"
:
"Uniswap Default List"
,
"timestamp"
:
"2021-01-1
1T23:59:53.688
Z"
,
"timestamp"
:
"2021-01-1
8T18:52:43.076
Z"
,
"version"
:
{
"version"
:
{
"major"
:
1
,
"major"
:
1
,
"minor"
:
6
,
"minor"
:
7
,
"patch"
:
0
"patch"
:
0
},
},
"tags"
:
{},
"tags"
:
{},
...
@@ -266,6 +266,22 @@
...
@@ -266,6 +266,22 @@
"chainId"
:
1
,
"chainId"
:
1
,
"logoURI"
:
"ipfs://QmXttGpZrECX5qCyXbBQiqgQNytVGeZW5Anewvh2jc4psg"
"logoURI"
:
"ipfs://QmXttGpZrECX5qCyXbBQiqgQNytVGeZW5Anewvh2jc4psg"
},
},
{
"name"
:
"USDCoin"
,
"address"
:
"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
,
"symbol"
:
"USDC"
,
"decimals"
:
6
,
"chainId"
:
1
,
"logoURI"
:
"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png"
},
{
"name"
:
"Tether USD"
,
"address"
:
"0xdAC17F958D2ee523a2206206994597C13D831ec7"
,
"symbol"
:
"USDT"
,
"decimals"
:
6
,
"chainId"
:
1
,
"logoURI"
:
"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png"
},
{
{
"name"
:
"Wrapped BTC"
,
"name"
:
"Wrapped BTC"
,
"address"
:
"0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599"
,
"address"
:
"0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599"
,
...
...
src/state/lists/reducer.test.ts
View file @
8bed3900
import
{
DEFAULT_ACTIVE_LIST_URLS
}
from
'
./../../constants/lists
'
import
{
DEFAULT_ACTIVE_LIST_URLS
}
from
'
./../../constants/lists
'
import
{
createStore
,
Store
}
from
'
redux
'
import
{
createStore
,
Store
}
from
'
redux
'
import
{
DEFAULT_LIST_OF_LISTS
,
DEFAULT_TOKEN_LIST_URL
}
from
'
../../constants/lists
'
import
{
DEFAULT_LIST_OF_LISTS
}
from
'
../../constants/lists
'
import
{
updateVersion
}
from
'
../global/actions
'
import
{
updateVersion
}
from
'
../global/actions
'
import
{
fetchTokenList
,
acceptListUpdate
,
addList
,
removeList
,
enableList
}
from
'
./actions
'
import
{
fetchTokenList
,
acceptListUpdate
,
addList
,
removeList
,
enableList
}
from
'
./actions
'
import
reducer
,
{
ListsState
}
from
'
./reducer
'
import
reducer
,
{
ListsState
}
from
'
./reducer
'
...
@@ -446,21 +446,12 @@ describe('list reducer', () => {
...
@@ -446,21 +446,12 @@ describe('list reducer', () => {
it
(
'
all lists are empty
'
,
()
=>
{
it
(
'
all lists are empty
'
,
()
=>
{
const
s
=
store
.
getState
()
const
s
=
store
.
getState
()
Object
.
keys
(
s
.
byUrl
).
forEach
(
url
=>
{
Object
.
keys
(
s
.
byUrl
).
forEach
(
url
=>
{
if
(
url
===
DEFAULT_TOKEN_LIST_URL
)
{
expect
(
s
.
byUrl
[
url
]).
toEqual
({
expect
(
s
.
byUrl
[
url
]).
toEqual
({
error
:
null
,
error
:
null
,
current
:
null
,
current
:
null
,
loadingRequestId
:
null
,
loadingRequestId
:
null
,
pendingUpdate
:
null
pendingUpdate
:
null
})
})
}
else
{
expect
(
s
.
byUrl
[
url
]).
toEqual
({
error
:
null
,
current
:
null
,
loadingRequestId
:
null
,
pendingUpdate
:
null
})
}
})
})
})
})
it
(
'
sets initialized lists
'
,
()
=>
{
it
(
'
sets initialized lists
'
,
()
=>
{
...
@@ -507,10 +498,6 @@ describe('list reducer', () => {
...
@@ -507,10 +498,6 @@ describe('list reducer', () => {
expect
(
store
.
getState
().
byUrl
[
'
https://unpkg.com/@uniswap/default-token-list@latest
'
]).
toBeUndefined
()
expect
(
store
.
getState
().
byUrl
[
'
https://unpkg.com/@uniswap/default-token-list@latest
'
]).
toBeUndefined
()
})
})
it
(
'
adds all the lists in the default list of lists
'
,
()
=>
{
expect
(
Object
.
keys
(
store
.
getState
().
byUrl
)).
toContain
(
DEFAULT_TOKEN_LIST_URL
)
})
it
(
'
each of those initialized lists is empty
'
,
()
=>
{
it
(
'
each of those initialized lists is empty
'
,
()
=>
{
const
byUrl
=
store
.
getState
().
byUrl
const
byUrl
=
store
.
getState
().
byUrl
// note we don't expect the uniswap default list to be prepopulated
// note we don't expect the uniswap default list to be prepopulated
...
@@ -533,14 +520,6 @@ describe('list reducer', () => {
...
@@ -533,14 +520,6 @@ describe('list reducer', () => {
it
(
'
sets default list to selected list
'
,
()
=>
{
it
(
'
sets default list to selected list
'
,
()
=>
{
expect
(
store
.
getState
().
activeListUrls
).
toEqual
(
DEFAULT_ACTIVE_LIST_URLS
)
expect
(
store
.
getState
().
activeListUrls
).
toEqual
(
DEFAULT_ACTIVE_LIST_URLS
)
})
})
it
(
'
default list is initialized
'
,
()
=>
{
expect
(
store
.
getState
().
byUrl
[
DEFAULT_TOKEN_LIST_URL
]).
toEqual
({
error
:
null
,
current
:
null
,
loadingRequestId
:
null
,
pendingUpdate
:
null
})
})
})
})
})
})
})
})
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