Skip to content

Commit

Permalink
Improvements(lists): update defaults, style updates (Uniswap#1270)
Browse files Browse the repository at this point in the history
* update defaults, style updates

* update icon color
  • Loading branch information
ianlapham authored Jan 18, 2021
1 parent a1000c6 commit 8bed390
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 50 deletions.
29 changes: 13 additions & 16 deletions src/components/Settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
useUserSingleHopOnly
} from '../../state/user/hooks'
import { TYPE } from '../../theme'
import { ButtonError, ButtonGray } from '../Button'
import { ButtonError } from '../Button'
import { AutoColumn } from '../Column'
import Modal from '../Modal'
import QuestionHelper from '../QuestionHelper'
Expand All @@ -27,6 +27,10 @@ const StyledMenuIcon = styled(Settings)`
> * {
stroke: ${({ theme }) => theme.text2};
}
:hover {
opacity: 0.7;
}
`

const StyledCloseIcon = styled(X)`
Expand Down Expand Up @@ -115,11 +119,6 @@ const ModalContentWrapper = styled.div`
border-radius: 20px;
`

const ButtonWrapper = styled(ButtonGray)`
padding: 6px;
border-radius: 8px;
`

export default function SettingsTab() {
const node = useRef<HTMLDivElement>()
const open = useModalOpen(ApplicationModal.SETTINGS)
Expand Down Expand Up @@ -180,16 +179,14 @@ export default function SettingsTab() {
</ModalContentWrapper>
</Modal>
<StyledMenuButton onClick={toggle} id="open-settings-dialog-button">
<ButtonWrapper width="fit-content">
<StyledMenuIcon />
{expertMode ? (
<EmojiWrapper>
<span role="img" aria-label="wizard-icon">
🧙
</span>
</EmojiWrapper>
) : null}
</ButtonWrapper>
<StyledMenuIcon />
{expertMode ? (
<EmojiWrapper>
<span role="img" aria-label="wizard-icon">
🧙
</span>
</EmojiWrapper>
) : null}
</StyledMenuButton>
{open && (
<MenuFlyout>
Expand Down
5 changes: 1 addition & 4 deletions src/constants/lists.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// 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
/**
* @TODO add list from blockchain association
Expand Down Expand Up @@ -38,4 +35,4 @@ export const DEFAULT_LIST_OF_LISTS: string[] = [
]

// 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[] = []
20 changes: 18 additions & 2 deletions src/constants/tokenLists/uniswap-default.tokenlist.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "Uniswap Default List",
"timestamp": "2021-01-11T23:59:53.688Z",
"timestamp": "2021-01-18T18:52:43.076Z",
"version": {
"major": 1,
"minor": 6,
"minor": 7,
"patch": 0
},
"tags": {},
Expand Down Expand Up @@ -266,6 +266,22 @@
"chainId": 1,
"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",
"address": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",
Expand Down
35 changes: 7 additions & 28 deletions src/state/lists/reducer.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DEFAULT_ACTIVE_LIST_URLS } from './../../constants/lists'
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 { fetchTokenList, acceptListUpdate, addList, removeList, enableList } from './actions'
import reducer, { ListsState } from './reducer'
Expand Down Expand Up @@ -446,21 +446,12 @@ describe('list reducer', () => {
it('all lists are empty', () => {
const s = store.getState()
Object.keys(s.byUrl).forEach(url => {
if (url === DEFAULT_TOKEN_LIST_URL) {
expect(s.byUrl[url]).toEqual({
error: null,
current: null,
loadingRequestId: null,
pendingUpdate: null
})
} else {
expect(s.byUrl[url]).toEqual({
error: null,
current: null,
loadingRequestId: null,
pendingUpdate: null
})
}
expect(s.byUrl[url]).toEqual({
error: null,
current: null,
loadingRequestId: null,
pendingUpdate: null
})
})
})
it('sets initialized lists', () => {
Expand Down Expand Up @@ -507,10 +498,6 @@ describe('list reducer', () => {
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', () => {
const byUrl = store.getState().byUrl
// note we don't expect the uniswap default list to be prepopulated
Expand All @@ -533,14 +520,6 @@ describe('list reducer', () => {
it('sets default list to selected list', () => {
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
})
})
})
})
})

0 comments on commit 8bed390

Please sign in to comment.