-
Notifications
You must be signed in to change notification settings - Fork 476
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2280 from blockscout/fe-2257
Token transfers list page
- Loading branch information
Showing
40 changed files
with
420 additions
and
5 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import type { NextPage } from 'next'; | ||
import dynamic from 'next/dynamic'; | ||
import React from 'react'; | ||
|
||
import PageNextJs from 'nextjs/PageNextJs'; | ||
|
||
const TokenTransfers = dynamic(() => import('ui/pages/TokenTransfers'), { ssr: false }); | ||
|
||
const Page: NextPage = () => { | ||
return ( | ||
<PageNextJs pathname="/token-transfers"> | ||
<TokenTransfers/> | ||
</PageNextJs> | ||
); | ||
}; | ||
|
||
export default Page; | ||
|
||
export { base as getServerSideProps } from 'nextjs/getServerSideProps'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Box } from '@chakra-ui/react'; | ||
import React from 'react'; | ||
|
||
import { mixTokens } from 'mocks/tokens/tokenTransfer'; | ||
import { test, expect } from 'playwright/lib'; | ||
|
||
import TokenTransfers from './TokenTransfers'; | ||
|
||
test('base view +@mobile', async({ render, mockTextAd, mockApiResponse }) => { | ||
await mockTextAd(); | ||
await mockApiResponse('token_transfers_all', mixTokens, { queryParams: { type: [] } }); | ||
const component = await render(<Box pt={{ base: '106px', lg: 0 }}> <TokenTransfers/> </Box>); | ||
await expect(component).toHaveScreenshot(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import { Show, Hide } from '@chakra-ui/react'; | ||
import { useRouter } from 'next/router'; | ||
import React from 'react'; | ||
|
||
import type { TokenType } from 'types/api/token'; | ||
|
||
import { getTokenTransfersStub } from 'stubs/token'; | ||
import ActionBar, { ACTION_BAR_HEIGHT_DESKTOP } from 'ui/shared/ActionBar'; | ||
import DataListDisplay from 'ui/shared/DataListDisplay'; | ||
import PopoverFilter from 'ui/shared/filters/PopoverFilter'; | ||
import TokenTypeFilter from 'ui/shared/filters/TokenTypeFilter'; | ||
import PageTitle from 'ui/shared/Page/PageTitle'; | ||
import Pagination from 'ui/shared/pagination/Pagination'; | ||
import useQueryWithPages from 'ui/shared/pagination/useQueryWithPages'; | ||
import { getTokenFilterValue } from 'ui/tokens/utils'; | ||
import TokenTransfersListItem from 'ui/tokenTransfers/TokenTransfersListItem'; | ||
import TokenTransfersTable from 'ui/tokenTransfers/TokenTransfersTable'; | ||
const TokenTransfers = () => { | ||
const router = useRouter(); | ||
const [ typeFilter, setTypeFilter ] = React.useState<Array<TokenType>>(getTokenFilterValue(router.query.type) || []); | ||
|
||
const tokenTransfersQuery = useQueryWithPages({ | ||
resourceName: 'token_transfers_all', | ||
filters: { type: typeFilter }, | ||
options: { | ||
placeholderData: getTokenTransfersStub(), | ||
}, | ||
}); | ||
|
||
const handleTokenTypesChange = React.useCallback((value: Array<TokenType>) => { | ||
tokenTransfersQuery.onFilterChange({ type: value }); | ||
setTypeFilter(value); | ||
}, [ tokenTransfersQuery ]); | ||
|
||
const content = ( | ||
<> | ||
<Show below="lg" ssr={ false }> | ||
{ tokenTransfersQuery.data?.items.map((item, index) => ( | ||
<TokenTransfersListItem | ||
key={ item.block_number + item.log_index + (tokenTransfersQuery.isPlaceholderData ? index : '') } | ||
isLoading={ tokenTransfersQuery.isPlaceholderData } | ||
item={ item } | ||
/> | ||
)) } | ||
</Show> | ||
<Hide below="lg" ssr={ false }> | ||
<TokenTransfersTable | ||
items={ tokenTransfersQuery.data?.items } | ||
top={ tokenTransfersQuery.pagination.isVisible ? ACTION_BAR_HEIGHT_DESKTOP : 0 } | ||
isLoading={ tokenTransfersQuery.isPlaceholderData } | ||
/> | ||
</Hide> | ||
</> | ||
); | ||
|
||
const filter = ( | ||
<PopoverFilter contentProps={{ w: '200px' }} appliedFiltersNum={ typeFilter.length }> | ||
<TokenTypeFilter<TokenType> onChange={ handleTokenTypesChange } defaultValue={ typeFilter } nftOnly={ false }/> | ||
</PopoverFilter> | ||
); | ||
|
||
const actionBar = ( | ||
<ActionBar mt={ -6 }> | ||
{ filter } | ||
<Pagination { ...tokenTransfersQuery.pagination }/> | ||
</ActionBar> | ||
); | ||
|
||
return ( | ||
<> | ||
<PageTitle | ||
title="Token Transfers" | ||
withTextAd | ||
/> | ||
<DataListDisplay | ||
isError={ tokenTransfersQuery.isError } | ||
items={ tokenTransfersQuery.data?.items } | ||
emptyText="There are no token transfers." | ||
content={ content } | ||
actionBar={ actionBar } | ||
/> | ||
</> | ||
); | ||
}; | ||
|
||
export default TokenTransfers; |
Binary file added
BIN
+110 KB
ui/pages/__screenshots__/TokenTransfers.pw.tsx_default_base-view-mobile-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+138 KB
ui/pages/__screenshots__/TokenTransfers.pw.tsx_mobile_base-view-mobile-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-6.29 KB
(88%)
...ut/__screenshots__/Layout.pw.tsx_default_xxl-screen-horizontal-navigation-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-7.44 KB
(88%)
...yout/__screenshots__/Layout.pw.tsx_default_xxl-screen-vertical-navigation-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-2.31 KB
(92%)
ui/snippets/header/__screenshots__/Burger.pw.tsx_default_auth-base-view-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-963 Bytes
(95%)
ui/snippets/header/__screenshots__/Burger.pw.tsx_default_base-view-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-1.09 KB
(94%)
ui/snippets/header/__screenshots__/Burger.pw.tsx_default_dark-mode-base-view-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-3.05 KB
(91%)
...creenshots__/NavigationDesktop.pw.tsx_dark-color-mode_base-view-dark-mode-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-3.34 KB
(90%)
...ntal/__screenshots__/NavigationDesktop.pw.tsx_default_base-view-dark-mode-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-3.21 KB
(92%)
...zontal/__screenshots__/NavigationDesktop.pw.tsx_default_with-groped-items-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
-3.97 KB
(89%)
...shots__/NavigationDesktop.pw.tsx_dark-color-mode_auth-xl-screen-dark-mode-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-2.78 KB
(89%)
...hots__/NavigationDesktop.pw.tsx_dark-color-mode_hover-xl-screen-dark-mode-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-2.75 KB
(89%)
...ts__/NavigationDesktop.pw.tsx_dark-color-mode_no-auth-xl-screen-dark-mode-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-2.79 KB
(89%)
...esktop.pw.tsx_dark-color-mode_with-highlighted-routes-xl-screen-dark-mode-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-3.97 KB
(89%)
...__screenshots__/NavigationDesktop.pw.tsx_default_auth-xl-screen-dark-mode-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-2.79 KB
(89%)
..._screenshots__/NavigationDesktop.pw.tsx_default_hover-xl-screen-dark-mode-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-2.74 KB
(89%)
...creenshots__/NavigationDesktop.pw.tsx_default_no-auth-xl-screen-dark-mode-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-2.73 KB
(89%)
...igationDesktop.pw.tsx_default_with-highlighted-routes-xl-screen-dark-mode-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-4.35 KB
(90%)
...l/__screenshots__/NavigationDesktop.pw.tsx_default_with-submenu-xl-screen-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-2.46 KB
(86%)
...n/vertical/__screenshots__/NavigationDesktop.pw.tsx_default_with-tooltips-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.