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

[Spam tokens] manually hide tokens #1377

Merged
merged 30 commits into from
Jan 9, 2023
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
06ace67
feat: manually hide spam tokens
schmanu Dec 9, 2022
ebdc93d
feat: hidden balances are default for useBalances hook
schmanu Dec 15, 2022
eaa7e4d
change: review design isues
schmanu Dec 19, 2022
996ff34
add: jest tests for AssetsTable and TokenListSelect
schmanu Dec 20, 2022
5a0f9f8
add: more test cases
schmanu Dec 20, 2022
7b9be8c
refactor: extract TokenMenu component
schmanu Dec 20, 2022
b42df29
test: refactored TokenMenu component
schmanu Dec 21, 2022
64584e8
add: design tweaks
schmanu Dec 21, 2022
cf4fadf
refactor: move hiddenAssetsSlice into settingsSlice
schmanu Dec 22, 2022
6ddc2b7
refactor: remove context provider and move logic into components
schmanu Dec 22, 2022
23a3d16
Merge remote-tracking branch 'origin/dev' into spam-tokens-manually-hide
schmanu Dec 27, 2022
e4c2dae
change: small ui tweaks
schmanu Dec 27, 2022
c544d41
change: design / ux adjustments
schmanu Jan 3, 2023
a5e0c0b
refactor & tests: collapse property for table rows
schmanu Jan 4, 2023
9028ce5
add: tracking to checkbox
schmanu Jan 4, 2023
8ae035d
fix: styles of sticky menu
schmanu Jan 4, 2023
954b6eb
refactor: move logic into hook
schmanu Jan 4, 2023
672fc9d
add: allow to hide native tokens, fix tracking
schmanu Jan 4, 2023
1603188
change: revert useBalances and add useVisibleBalances
schmanu Jan 4, 2023
0705c38
rename analytic events, remove padding
schmanu Jan 4, 2023
e47135c
fix: memoize visible balance
schmanu Jan 5, 2023
90deddf
fix: do not mutate state directly
schmanu Jan 5, 2023
0071cb4
fix: uncomment line
schmanu Jan 5, 2023
8e45886
fix: small css tweaks for mobile
schmanu Jan 5, 2023
79fb8cf
refactor: use filter instead of slice
schmanu Jan 5, 2023
2a69096
refactor: use concat instead of destructuring
schmanu Jan 5, 2023
4eac84c
change: adjust total balance and dashboard overview
schmanu Jan 6, 2023
3ee704c
fix: rerender problems after sorting assets (#1491)
schmanu Jan 9, 2023
45f6630
refactor: reduce AssetsHeader nesting
usame-algan Jan 9, 2023
70aeff3
refactor: split balance adjustment functions
schmanu Jan 9, 2023
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
88 changes: 45 additions & 43 deletions src/components/address-book/AddressBookTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,50 +82,52 @@ const AddressBookTable = () => {
}, [addressBookEntries, searchQuery])

const rows = filteredEntries.map(([address, name]) => ({
name: {
rawValue: name,
content: name,
},
address: {
rawValue: address,
content: <EthHashInfo address={address} showName={false} shortAddress={false} hasExplorer showCopyButton />,
},
actions: {
rawValue: '',
sticky: true,
content: (
<div className={tableCss.actions}>
<Track {...ADDRESS_BOOK_EVENTS.EDIT_ENTRY}>
<Tooltip title="Edit entry" placement="top">
<IconButton onClick={() => handleOpenModalWithValues(ModalType.ENTRY, address, name)} size="small">
<SvgIcon component={EditIcon} inheritViewBox color="border" fontSize="small" />
</IconButton>
</Tooltip>
</Track>

<Track {...ADDRESS_BOOK_EVENTS.DELETE_ENTRY}>
<Tooltip title="Delete entry" placement="top">
<IconButton onClick={() => handleOpenModalWithValues(ModalType.REMOVE, address, name)} size="small">
<SvgIcon component={DeleteIcon} inheritViewBox color="error" fontSize="small" />
</IconButton>
</Tooltip>
</Track>

{isGranted && (
<Track {...ADDRESS_BOOK_EVENTS.SEND}>
<Button
variant="contained"
color="primary"
size="small"
onClick={() => setSelectedAddress(address)}
className={css.sendButton}
>
Send
</Button>
cells: {
name: {
rawValue: name,
content: name,
},
address: {
rawValue: address,
content: <EthHashInfo address={address} showName={false} shortAddress={false} hasExplorer showCopyButton />,
},
actions: {
rawValue: '',
sticky: true,
content: (
<div className={tableCss.actions}>
<Track {...ADDRESS_BOOK_EVENTS.EDIT_ENTRY}>
<Tooltip title="Edit entry" placement="top">
<IconButton onClick={() => handleOpenModalWithValues(ModalType.ENTRY, address, name)} size="small">
<SvgIcon component={EditIcon} inheritViewBox color="border" fontSize="small" />
</IconButton>
</Tooltip>
</Track>
)}
</div>
),

<Track {...ADDRESS_BOOK_EVENTS.DELETE_ENTRY}>
<Tooltip title="Delete entry" placement="top">
<IconButton onClick={() => handleOpenModalWithValues(ModalType.REMOVE, address, name)} size="small">
<SvgIcon component={DeleteIcon} inheritViewBox color="error" fontSize="small" />
</IconButton>
</Tooltip>
</Track>

{isGranted && (
<Track {...ADDRESS_BOOK_EVENTS.SEND}>
<Button
variant="contained"
color="primary"
size="small"
onClick={() => setSelectedAddress(address)}
className={css.sendButton}
>
Send
</Button>
</Track>
)}
</div>
),
},
},
}))

Expand Down
34 changes: 28 additions & 6 deletions src/components/balances/AssetsHeader/index.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,42 @@
import { Box } from '@mui/material'
import type { ReactElement } from 'react'
import { type ReactElement } from 'react'

import NavTabs from '@/components/common/NavTabs'
import PageHeader from '@/components/common/PageHeader'
import CurrencySelect from '@/components/balances/CurrencySelect'
import { balancesNavItems } from '@/components/sidebar/SidebarNavigation/config'

const AssetsHeader = ({ currencySelect = false }: { currencySelect?: boolean }): ReactElement => {
import HiddenTokenButton from '../HiddenTokenButton'

const AssetsHeader = ({
usame-algan marked this conversation as resolved.
Show resolved Hide resolved
hiddenAssets = false,
currencySelect = false,
toggleShowHiddenAssets,
showHiddenAssets = false,
}: {
hiddenAssets?: boolean
currencySelect?: boolean
toggleShowHiddenAssets?: () => void
showHiddenAssets?: boolean
}): ReactElement => {
return (
<PageHeader
title="Assets"
action={
<Box display="flex" justifyContent="space-between" alignItems="center">
<NavTabs tabs={balancesNavItems} />
{currencySelect && <CurrencySelect />}
</Box>
<>
<Box display="flex" justifyContent="space-between" alignItems="center">
<NavTabs tabs={balancesNavItems} />
<Box display="flex" flexDirection="row" alignItems="center" gap={1}>
{hiddenAssets && (
<HiddenTokenButton
showHiddenAssets={showHiddenAssets}
toggleShowHiddenAssets={toggleShowHiddenAssets}
/>
)}
{currencySelect && <CurrencySelect />}
</Box>
</Box>
</>
}
/>
)
Expand Down
Loading