Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
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
vicotor
frontend
Commits
6f3aa313
Commit
6f3aa313
authored
Jan 18, 2023
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
csv export link for address data
parent
65fd3abf
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
58 additions
and
12 deletions
+58
-12
paths.json
lib/link/paths.json
+2
-1
routes.ts
lib/link/routes.ts
+4
-0
AddressCsvExportLink.tsx
ui/address/AddressCsvExportLink.tsx
+32
-0
AddressInternalTxs.tsx
ui/address/AddressInternalTxs.tsx
+4
-2
AddressTokenTransfers.tsx
ui/address/AddressTokenTransfers.tsx
+4
-1
AddressTxs.tsx
ui/address/AddressTxs.tsx
+7
-7
TxsContent.tsx
ui/txs/TxsContent.tsx
+2
-0
TxsHeaderMobile.tsx
ui/txs/TxsHeaderMobile.tsx
+3
-1
No files found.
lib/link/paths.json
View file @
6f3aa313
...
@@ -20,5 +20,6 @@
...
@@ -20,5 +20,6 @@
"search_results"
:
"/search-results"
,
"search_results"
:
"/search-results"
,
"auth"
:
"/auth/auth0"
,
"auth"
:
"/auth/auth0"
,
"stats"
:
"/stats"
,
"stats"
:
"/stats"
,
"visualize_sol2uml"
:
"/visualize/sol2uml"
"visualize_sol2uml"
:
"/visualize/sol2uml"
,
"csv_export"
:
"/csv-export"
}
}
lib/link/routes.ts
View file @
6f3aa313
...
@@ -99,6 +99,10 @@ export const ROUTES = {
...
@@ -99,6 +99,10 @@ export const ROUTES = {
pattern
:
PATHS
.
visualize_sol2uml
,
pattern
:
PATHS
.
visualize_sol2uml
,
},
},
csv_export
:
{
pattern
:
PATHS
.
csv_export
,
},
// AUTH
// AUTH
auth
:
{
auth
:
{
pattern
:
PATHS
.
auth
,
pattern
:
PATHS
.
auth
,
...
...
ui/address/AddressCsvExportLink.tsx
0 → 100644
View file @
6f3aa313
import
{
chakra
,
Icon
,
Link
,
Tooltip
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
svgFileIcon
from
'
icons/svg_file.svg
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
link
from
'
lib/link/link
'
;
interface
Props
{
address
:
string
;
type
:
'
transactions
'
|
'
internal-transactions
'
|
'
token-transfers
'
;
className
?:
string
;
}
const
AddressCsvExportLink
=
({
className
,
address
,
type
}:
Props
)
=>
{
const
isMobile
=
useIsMobile
();
return
(
<
Tooltip
isDisabled=
{
!
isMobile
}
label=
"Download CSV"
>
<
Link
className=
{
className
}
display=
"inline-flex"
alignItems=
"center"
href=
{
link
(
'
csv_export
'
,
undefined
,
{
type
,
address
})
}
>
<
Icon
as=
{
svgFileIcon
}
boxSize=
{
6
}
/>
{
!
isMobile
&&
<
chakra
.
span
ml=
{
1
}
>
Download CSV
</
chakra
.
span
>
}
</
Link
>
</
Tooltip
>
);
};
export
default
React
.
memo
(
chakra
(
AddressCsvExportLink
));
ui/address/AddressInternalTxs.tsx
View file @
6f3aa313
...
@@ -17,6 +17,7 @@ import ActionBar from 'ui/shared/ActionBar';
...
@@ -17,6 +17,7 @@ import ActionBar from 'ui/shared/ActionBar';
import
DataFetchAlert
from
'
ui/shared/DataFetchAlert
'
;
import
DataFetchAlert
from
'
ui/shared/DataFetchAlert
'
;
import
Pagination
from
'
ui/shared/Pagination
'
;
import
Pagination
from
'
ui/shared/Pagination
'
;
import
AddressCsvExportLink
from
'
./AddressCsvExportLink
'
;
import
AddressTxsFilter
from
'
./AddressTxsFilter
'
;
import
AddressTxsFilter
from
'
./AddressTxsFilter
'
;
import
AddressIntTxsList
from
'
./internals/AddressIntTxsList
'
;
import
AddressIntTxsList
from
'
./internals/AddressIntTxsList
'
;
...
@@ -80,13 +81,14 @@ const AddressInternalTxs = ({ scrollRef }: {scrollRef?: React.RefObject<HTMLDivE
...
@@ -80,13 +81,14 @@ const AddressInternalTxs = ({ scrollRef }: {scrollRef?: React.RefObject<HTMLDivE
return
(
return
(
<>
<>
<
ActionBar
mt=
{
-
6
}
>
<
ActionBar
mt=
{
-
6
}
justifyContent=
"left"
>
<
AddressTxsFilter
<
AddressTxsFilter
defaultFilter=
{
filterValue
}
defaultFilter=
{
filterValue
}
onFilterChange=
{
handleFilterChange
}
onFilterChange=
{
handleFilterChange
}
isActive=
{
Boolean
(
filterValue
)
}
isActive=
{
Boolean
(
filterValue
)
}
/>
/>
{
isPaginationVisible
&&
<
Pagination
ml=
"auto"
{
...
pagination
}
/>
}
<
AddressCsvExportLink
address=
{
queryIdStr
}
type=
"internal-transactions"
ml=
{
{
base
:
2
,
lg
:
'
auto
'
}
}
/>
{
isPaginationVisible
&&
<
Pagination
ml=
{
{
base
:
'
auto
'
,
lg
:
8
}
}
{
...
pagination
}
/>
}
</
ActionBar
>
</
ActionBar
>
{
content
}
{
content
}
</>
</>
...
...
ui/address/AddressTokenTransfers.tsx
View file @
6f3aa313
...
@@ -28,6 +28,8 @@ import TokenTransferFilter from 'ui/shared/TokenTransfer/TokenTransferFilter';
...
@@ -28,6 +28,8 @@ import TokenTransferFilter from 'ui/shared/TokenTransfer/TokenTransferFilter';
import
TokenTransferList
from
'
ui/shared/TokenTransfer/TokenTransferList
'
;
import
TokenTransferList
from
'
ui/shared/TokenTransfer/TokenTransferList
'
;
import
TokenTransferTable
from
'
ui/shared/TokenTransfer/TokenTransferTable
'
;
import
TokenTransferTable
from
'
ui/shared/TokenTransfer/TokenTransferTable
'
;
import
AddressCsvExportLink
from
'
./AddressCsvExportLink
'
;
type
Filters
=
{
type
Filters
=
{
type
:
Array
<
TokenType
>
;
type
:
Array
<
TokenType
>
;
filter
:
AddressFromToFilter
|
undefined
;
filter
:
AddressFromToFilter
|
undefined
;
...
@@ -217,7 +219,8 @@ const AddressTokenTransfers = ({ scrollRef }: {scrollRef?: React.RefObject<HTMLD
...
@@ -217,7 +219,8 @@ const AddressTokenTransfers = ({ scrollRef }: {scrollRef?: React.RefObject<HTMLD
onAddressFilterChange=
{
handleAddressFilterChange
}
onAddressFilterChange=
{
handleAddressFilterChange
}
defaultAddressFilter=
{
filters
.
filter
}
defaultAddressFilter=
{
filters
.
filter
}
/>
/>
{
isPaginationVisible
&&
<
Pagination
ml=
"auto"
{
...
pagination
}
/>
}
{
currentAddress
&&
<
AddressCsvExportLink
address=
{
currentAddress
}
type=
"token-transfers"
ml=
{
{
base
:
2
,
lg
:
'
auto
'
}
}
/>
}
{
isPaginationVisible
&&
<
Pagination
ml=
{
{
base
:
'
auto
'
,
lg
:
8
}
}
{
...
pagination
}
/>
}
</
ActionBar
>
</
ActionBar
>
)
}
)
}
{
content
}
{
content
}
...
...
ui/address/AddressTxs.tsx
View file @
6f3aa313
import
{
useQueryClient
}
from
'
@tanstack/react-query
'
;
import
{
useQueryClient
}
from
'
@tanstack/react-query
'
;
import
castArray
from
'
lodash/castArray
'
;
import
{
useRouter
}
from
'
next/router
'
;
import
{
useRouter
}
from
'
next/router
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
...
@@ -17,6 +16,7 @@ import ActionBar from 'ui/shared/ActionBar';
...
@@ -17,6 +16,7 @@ import ActionBar from 'ui/shared/ActionBar';
import
Pagination
from
'
ui/shared/Pagination
'
;
import
Pagination
from
'
ui/shared/Pagination
'
;
import
TxsContent
from
'
ui/txs/TxsContent
'
;
import
TxsContent
from
'
ui/txs/TxsContent
'
;
import
AddressCsvExportLink
from
'
./AddressCsvExportLink
'
;
import
AddressTxsFilter
from
'
./AddressTxsFilter
'
;
import
AddressTxsFilter
from
'
./AddressTxsFilter
'
;
const
OVERLOAD_COUNT
=
75
;
const
OVERLOAD_COUNT
=
75
;
...
@@ -31,12 +31,13 @@ const AddressTxs = ({ scrollRef }: {scrollRef?: React.RefObject<HTMLDivElement>}
...
@@ -31,12 +31,13 @@ const AddressTxs = ({ scrollRef }: {scrollRef?: React.RefObject<HTMLDivElement>}
const
[
newItemsCount
,
setNewItemsCount
]
=
React
.
useState
(
0
);
const
[
newItemsCount
,
setNewItemsCount
]
=
React
.
useState
(
0
);
const
isMobile
=
useIsMobile
();
const
isMobile
=
useIsMobile
();
const
currentAddress
=
router
.
query
.
id
?.
toString
();
const
[
filterValue
,
setFilterValue
]
=
React
.
useState
<
AddressFromToFilter
>
(
getFilterValue
(
router
.
query
.
filter
));
const
[
filterValue
,
setFilterValue
]
=
React
.
useState
<
AddressFromToFilter
>
(
getFilterValue
(
router
.
query
.
filter
));
const
addressTxsQuery
=
useQueryWithPages
({
const
addressTxsQuery
=
useQueryWithPages
({
resourceName
:
'
address_txs
'
,
resourceName
:
'
address_txs
'
,
pathParams
:
{
id
:
c
astArray
(
router
.
query
.
id
)[
0
]
},
pathParams
:
{
id
:
c
urrentAddress
},
filters
:
{
filter
:
filterValue
},
filters
:
{
filter
:
filterValue
},
scrollRef
,
scrollRef
,
});
});
...
@@ -51,8 +52,6 @@ const AddressTxs = ({ scrollRef }: {scrollRef?: React.RefObject<HTMLDivElement>}
...
@@ -51,8 +52,6 @@ const AddressTxs = ({ scrollRef }: {scrollRef?: React.RefObject<HTMLDivElement>}
const
handleNewSocketMessage
:
SocketMessage
.
AddressTxs
[
'
handler
'
]
=
(
payload
)
=>
{
const
handleNewSocketMessage
:
SocketMessage
.
AddressTxs
[
'
handler
'
]
=
(
payload
)
=>
{
setSocketAlert
(
''
);
setSocketAlert
(
''
);
const
currentAddress
=
router
.
query
.
id
?.
toString
();
if
(
addressTxsQuery
.
data
?.
items
&&
addressTxsQuery
.
data
.
items
.
length
>=
OVERLOAD_COUNT
)
{
if
(
addressTxsQuery
.
data
?.
items
&&
addressTxsQuery
.
data
.
items
.
length
>=
OVERLOAD_COUNT
)
{
if
(
if
(
!
filterValue
||
!
filterValue
||
...
@@ -109,7 +108,7 @@ const AddressTxs = ({ scrollRef }: {scrollRef?: React.RefObject<HTMLDivElement>}
...
@@ -109,7 +108,7 @@ const AddressTxs = ({ scrollRef }: {scrollRef?: React.RefObject<HTMLDivElement>}
},
[]);
},
[]);
const
channel
=
useSocketChannel
({
const
channel
=
useSocketChannel
({
topic
:
`addresses:
${
(
router
.
query
.
id
as
string
)
.
toLowerCase
()
}
`
,
topic
:
`addresses:
${
currentAddress
?
.
toLowerCase
()
}
`,
onSocketClose: handleSocketClose,
onSocketClose: handleSocketClose,
onSocketError: handleSocketError,
onSocketError: handleSocketError,
isDisabled: addressTxsQuery.pagination.page !== 1,
isDisabled: addressTxsQuery.pagination.page !== 1,
...
@@ -140,13 +139,14 @@ const AddressTxs = ({ scrollRef }: {scrollRef?: React.RefObject<HTMLDivElement>}
...
@@ -140,13 +139,14 @@ const AddressTxs = ({ scrollRef }: {scrollRef?: React.RefObject<HTMLDivElement>}
{ !isMobile && (
{ !isMobile && (
<ActionBar mt={ -6 }>
<ActionBar mt={ -6 }>
{ filter }
{ filter }
{
addressTxsQuery
.
isPaginationVisible
&&
<
Pagination
{
...
addressTxsQuery
.
pagination
}
/>
}
{ currentAddress && <AddressCsvExportLink address={ currentAddress } type="transactions" ml="auto"/> }
{ addressTxsQuery.isPaginationVisible && <Pagination { ...addressTxsQuery.pagination } ml={ 8 }/> }
</ActionBar>
</ActionBar>
) }
) }
<TxsContent
<TxsContent
filter={ filter }
filter={ filter }
query={ addressTxsQuery }
query={ addressTxsQuery }
currentAddress=
{
typeof
router
.
query
.
id
===
'
string
'
?
router
.
query
.
id
:
undefined
}
currentAddress={ typeof
currentAddress === 'string' ? currentAddress
: undefined }
enableTimeIncrement
enableTimeIncrement
showSocketInfo={ addressTxsQuery.pagination.page === 1 }
showSocketInfo={ addressTxsQuery.pagination.page === 1 }
socketInfoAlert={ socketAlert }
socketInfoAlert={ socketAlert }
...
...
ui/txs/TxsContent.tsx
View file @
6f3aa313
...
@@ -5,6 +5,7 @@ import React from 'react';
...
@@ -5,6 +5,7 @@ import React from 'react';
import
type
{
TxsResponse
}
from
'
types/api/transaction
'
;
import
type
{
TxsResponse
}
from
'
types/api/transaction
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
AddressCsvExportLink
from
'
ui/address/AddressCsvExportLink
'
;
import
DataFetchAlert
from
'
ui/shared/DataFetchAlert
'
;
import
DataFetchAlert
from
'
ui/shared/DataFetchAlert
'
;
import
type
{
Props
as
PaginationProps
}
from
'
ui/shared/Pagination
'
;
import
type
{
Props
as
PaginationProps
}
from
'
ui/shared/Pagination
'
;
import
SkeletonList
from
'
ui/shared/skeletons/SkeletonList
'
;
import
SkeletonList
from
'
ui/shared/skeletons/SkeletonList
'
;
...
@@ -123,6 +124,7 @@ const TxsContent = ({
...
@@ -123,6 +124,7 @@ const TxsContent = ({
paginationProps=
{
query
.
pagination
}
paginationProps=
{
query
.
pagination
}
showPagination=
{
query
.
isPaginationVisible
}
showPagination=
{
query
.
isPaginationVisible
}
filterComponent=
{
filter
}
filterComponent=
{
filter
}
linkSlot=
{
currentAddress
?
<
AddressCsvExportLink
address=
{
currentAddress
}
type=
"transactions"
ml=
{
2
}
/>
:
null
}
/>
/>
)
}
)
}
{
content
}
{
content
}
...
...
ui/txs/TxsHeaderMobile.tsx
View file @
6f3aa313
...
@@ -18,9 +18,10 @@ type Props = {
...
@@ -18,9 +18,10 @@ type Props = {
className
?:
string
;
className
?:
string
;
showPagination
?:
boolean
;
showPagination
?:
boolean
;
filterComponent
?:
React
.
ReactNode
;
filterComponent
?:
React
.
ReactNode
;
linkSlot
?:
React
.
ReactNode
;
}
}
const
TxsHeaderMobile
=
({
filterComponent
,
sorting
,
setSorting
,
paginationProps
,
className
,
showPagination
=
true
}:
Props
)
=>
{
const
TxsHeaderMobile
=
({
filterComponent
,
sorting
,
setSorting
,
paginationProps
,
className
,
showPagination
=
true
,
linkSlot
}:
Props
)
=>
{
return
(
return
(
<
ActionBar
className=
{
className
}
>
<
ActionBar
className=
{
className
}
>
<
HStack
>
<
HStack
>
...
@@ -38,6 +39,7 @@ const TxsHeaderMobile = ({ filterComponent, sorting, setSorting, paginationProps
...
@@ -38,6 +39,7 @@ const TxsHeaderMobile = ({ filterComponent, sorting, setSorting, paginationProps
size="xs"
size="xs"
placeholder="Search by addresses, hash, method..."
placeholder="Search by addresses, hash, method..."
/> */
}
/> */
}
{
linkSlot
}
</
HStack
>
</
HStack
>
{
showPagination
&&
<
Pagination
{
...
paginationProps
}
/>
}
{
showPagination
&&
<
Pagination
{
...
paginationProps
}
/>
}
</
ActionBar
>
</
ActionBar
>
...
...
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