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
0a1459ee
Unverified
Commit
0a1459ee
authored
Aug 26, 2020
by
Moody Salem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove any bias from the list selection
parent
8896a042
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
61 deletions
+17
-61
CurrencySearchModal.tsx
src/components/SearchModal/CurrencySearchModal.tsx
+7
-4
ListIntroduction.tsx
src/components/SearchModal/ListIntroduction.tsx
+10
-57
No files found.
src/components/SearchModal/CurrencySearchModal.tsx
View file @
0a1459ee
...
@@ -56,16 +56,19 @@ export default function CurrencySearchModal({
...
@@ -56,16 +56,19 @@ export default function CurrencySearchModal({
})
})
setListView
(
false
)
setListView
(
false
)
},
[])
},
[])
const
handleSelectListIntroduction
=
useCallback
(()
=>
{
setListView
(
true
)
},
[])
const
selectedListUrl
=
useSelectedListUrl
()
const
selectedListUrl
=
useSelectedListUrl
()
const
noListSelected
=
!
selectedListUrl
const
noListSelected
=
!
selectedListUrl
return
(
return
(
<
Modal
isOpen=
{
isOpen
}
onDismiss=
{
onDismiss
}
maxHeight=
{
70
}
minHeight=
{
noListSelected
||
listView
?
40
:
70
}
>
<
Modal
isOpen=
{
isOpen
}
onDismiss=
{
onDismiss
}
maxHeight=
{
90
}
minHeight=
{
listView
?
40
:
noListSelected
?
0
:
80
}
>
{
noListSelected
?
(
{
listView
?
(
<
ListIntroduction
/>
)
:
listView
?
(
<
ListSelect
onDismiss=
{
onDismiss
}
onBack=
{
handleClickBack
}
/>
<
ListSelect
onDismiss=
{
onDismiss
}
onBack=
{
handleClickBack
}
/>
)
:
noListSelected
?
(
<
ListIntroduction
onSelectList=
{
handleSelectListIntroduction
}
/>
)
:
(
)
:
(
<
CurrencySearch
<
CurrencySearch
isOpen=
{
isOpen
}
isOpen=
{
isOpen
}
...
...
src/components/SearchModal/ListIntroduction.tsx
View file @
0a1459ee
import
React
,
{
memo
,
useCallback
,
useEffect
}
from
'
react
'
import
React
from
'
react
'
import
{
useDispatch
,
useSelector
}
from
'
react-redux
'
import
{
Text
}
from
'
rebass
'
import
{
Text
}
from
'
rebass
'
import
{
AppDispatch
,
AppState
}
from
'
../../state
'
import
{
addList
,
selectList
}
from
'
../../state/lists/actions
'
import
{
ExternalLink
}
from
'
../../theme
'
import
{
ExternalLink
}
from
'
../../theme
'
import
{
ButtonPrimary
}
from
'
../Button
'
import
{
ButtonPrimary
}
from
'
../Button
'
import
{
OutlineCard
,
GreyCard
}
from
'
../Card
'
import
{
OutlineCard
}
from
'
../Card
'
import
Column
,
{
AutoColumn
}
from
'
../Column
'
import
Column
,
{
AutoColumn
}
from
'
../Column
'
import
ListLogo
from
'
../ListLogo
'
import
Row
from
'
../Row
'
import
{
PaddedColumn
}
from
'
./styleds
'
import
{
PaddedColumn
}
from
'
./styleds
'
const
ListCard
=
memo
(
function
ListCard
({
id
,
listUrl
}:
{
id
:
string
;
listUrl
:
string
})
{
export
default
function
ListIntroduction
({
onSelectList
}:
{
onSelectList
:
()
=>
void
})
{
const
dispatch
=
useDispatch
<
AppDispatch
>
()
const
listsByUrl
=
useSelector
<
AppState
,
AppState
[
'
lists
'
][
'
byUrl
'
]
>
(
state
=>
state
.
lists
.
byUrl
)
const
list
=
listsByUrl
[
listUrl
]?.
current
useEffect
(()
=>
{
if
(
!
listsByUrl
[
listUrl
])
dispatch
(
addList
(
listUrl
))
},
[
dispatch
,
listUrl
,
listsByUrl
])
const
handleSelect
=
useCallback
(()
=>
{
dispatch
(
selectList
(
listUrl
))
},
[
dispatch
,
listUrl
])
if
(
!
list
)
return
null
return
(
<
OutlineCard
style=
{
{
padding
:
'
0.5rem .75rem
'
}
}
id=
{
id
}
>
<
Row
align=
"center"
>
{
list
.
logoURI
?
(
<
ListLogo
style=
{
{
marginRight
:
'
0.5rem
'
}
}
logoURI=
{
list
.
logoURI
}
alt=
{
`${list.name} list logo`
}
/>
)
:
null
}
<
Text
fontWeight=
{
500
}
style=
{
{
flex
:
'
1
'
}
}
>
{
list
.
name
}
</
Text
>
<
ButtonPrimary
className=
"select-button"
style=
{
{
width
:
'
6rem
'
,
padding
:
'
0.5rem .35rem
'
,
borderRadius
:
'
12px
'
}
}
onClick=
{
handleSelect
}
>
Select
</
ButtonPrimary
>
</
Row
>
</
OutlineCard
>
)
})
export
default
function
ListIntroduction
()
{
return
(
return
(
<
Column
style=
{
{
width
:
'
100%
'
,
flex
:
'
1 1
'
}
}
>
<
Column
style=
{
{
width
:
'
100%
'
,
flex
:
'
1 1
'
}
}
>
<
PaddedColumn
>
<
PaddedColumn
>
<
AutoColumn
gap=
"14px"
>
<
AutoColumn
gap=
"14px"
>
<
Text
fontWeight=
{
600
}
fontSize=
{
20
}
>
<
Text
fontWeight=
{
600
}
fontSize=
{
20
}
>
Select a list
Token Lists
</
Text
>
</
Text
>
<
Text
style=
{
{
marginBottom
:
'
8px
'
}
}
>
<
Text
style=
{
{
marginBottom
:
'
8px
'
}
}
>
Get started by selecting a token list below. You can switch between token lists and add your own custom
You can switch between lists of tokens, as well as add your own custom lists via IPFS, HTTPS and ENS.
{
'
'
}
lists via IPFS, HTTPS and ENS.
<
i
>
Start by choosing a list.
</
i
>
</
Text
>
</
Text
>
<
ListCard
id=
"select-kleros-list"
listUrl=
{
'
t2crtokens.eth
'
}
/>
<
ButtonPrimary
onClick=
{
onSelectList
}
>
Choose a list
</
ButtonPrimary
>
<
ListCard
<
OutlineCard
style=
{
{
marginBottom
:
'
8px
'
,
padding
:
'
1rem
'
}
}
>
id=
"select-1inch-list"
listUrl=
{
'
https://www.coingecko.com/tokens_list/uniswap/defi_100/v_0_0_0.json
'
}
/>
<
ListCard
id=
"select-default-uniswap-list"
listUrl=
{
'
tokens.uniswap.eth
'
}
/>
<
GreyCard
style=
{
{
marginBottom
:
'
8px
'
,
padding
:
'
1rem
'
}
}
>
<
Text
fontWeight=
{
400
}
fontSize=
{
14
}
style=
{
{
textAlign
:
'
center
'
}
}
>
<
Text
fontWeight=
{
400
}
fontSize=
{
14
}
style=
{
{
textAlign
:
'
center
'
}
}
>
Token lists are an
{
'
'
}
Token lists are an
{
'
'
}
<
ExternalLink
href=
"https://github.com/uniswap/token-lists"
>
open specification
</
ExternalLink
>
. Check out
{
'
'
}
<
ExternalLink
href=
"https://github.com/uniswap/token-lists"
>
open specification
</
ExternalLink
>
. Check out
{
'
'
}
<
ExternalLink
href=
"https://tokenlists.org"
>
tokenlists.org
</
ExternalLink
>
to
find more lists
.
<
ExternalLink
href=
"https://tokenlists.org"
>
tokenlists.org
</
ExternalLink
>
to
learn more
.
</
Text
>
</
Text
>
</
Grey
Card
>
</
Outline
Card
>
</
AutoColumn
>
</
AutoColumn
>
</
PaddedColumn
>
</
PaddedColumn
>
</
Column
>
</
Column
>
...
...
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