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
b20e8173
Commit
b20e8173
authored
Nov 08, 2022
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comment out filters for internal txs
parent
e13f04e4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
19 deletions
+20
-19
TxInternals.tsx
ui/tx/TxInternals.tsx
+20
-19
No files found.
ui/tx/TxInternals.tsx
View file @
b20e8173
import
{
Box
,
Flex
,
Text
,
Show
,
Hide
}
from
'
@chakra-ui/react
'
;
import
{
Box
,
Text
,
Show
,
Hide
}
from
'
@chakra-ui/react
'
;
import
{
useQuery
}
from
'
@tanstack/react-query
'
;
import
{
useQuery
}
from
'
@tanstack/react-query
'
;
import
{
useRouter
}
from
'
next/router
'
;
import
{
useRouter
}
from
'
next/router
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
InternalTransactionsResponse
,
TxInternalsType
,
InternalTransaction
}
from
'
types/api/internalTransaction
'
;
import
type
{
InternalTransactionsResponse
,
InternalTransaction
}
from
'
types/api/internalTransaction
'
;
import
{
QueryKeys
}
from
'
types/client/queries
'
;
import
{
QueryKeys
}
from
'
types/client/queries
'
;
import
{
SECOND
}
from
'
lib/consts
'
;
import
{
SECOND
}
from
'
lib/consts
'
;
...
@@ -12,8 +12,8 @@ import useIsMobile from 'lib/hooks/useIsMobile';
...
@@ -12,8 +12,8 @@ import useIsMobile from 'lib/hooks/useIsMobile';
import
{
apos
}
from
'
lib/html-entities
'
;
import
{
apos
}
from
'
lib/html-entities
'
;
import
EmptySearchResult
from
'
ui/apps/EmptySearchResult
'
;
import
EmptySearchResult
from
'
ui/apps/EmptySearchResult
'
;
import
DataFetchAlert
from
'
ui/shared/DataFetchAlert
'
;
import
DataFetchAlert
from
'
ui/shared/DataFetchAlert
'
;
import
FilterInput
from
'
ui/shared/FilterInput
'
;
//
import FilterInput from 'ui/shared/FilterInput';
import
TxInternalsFilter
from
'
ui/tx/internals/TxInternalsFilter
'
;
//
import TxInternalsFilter from 'ui/tx/internals/TxInternalsFilter';
import
TxInternalsList
from
'
ui/tx/internals/TxInternalsList
'
;
import
TxInternalsList
from
'
ui/tx/internals/TxInternalsList
'
;
import
TxInternalsSkeletonDesktop
from
'
ui/tx/internals/TxInternalsSkeletonDesktop
'
;
import
TxInternalsSkeletonDesktop
from
'
ui/tx/internals/TxInternalsSkeletonDesktop
'
;
import
TxInternalsSkeletonMobile
from
'
ui/tx/internals/TxInternalsSkeletonMobile
'
;
import
TxInternalsSkeletonMobile
from
'
ui/tx/internals/TxInternalsSkeletonMobile
'
;
...
@@ -62,19 +62,20 @@ const sortFn = (sort: Sort | undefined) => (a: InternalTransaction, b: InternalT
...
@@ -62,19 +62,20 @@ const sortFn = (sort: Sort | undefined) => (a: InternalTransaction, b: InternalT
}
}
};
};
const
searchFn
=
(
searchTerm
:
string
)
=>
(
item
:
InternalTransaction
):
boolean
=>
{
//
const searchFn = (searchTerm: string) => (item: InternalTransaction): boolean => {
const
formattedSearchTerm
=
searchTerm
.
toLowerCase
();
//
const formattedSearchTerm = searchTerm.toLowerCase();
return
item
.
type
.
toLowerCase
().
includes
(
formattedSearchTerm
)
||
//
return item.type.toLowerCase().includes(formattedSearchTerm) ||
item
.
from
.
hash
.
toLowerCase
().
includes
(
formattedSearchTerm
)
||
//
item.from.hash.toLowerCase().includes(formattedSearchTerm) ||
item
.
to
.
hash
.
toLowerCase
().
includes
(
formattedSearchTerm
);
//
item.to.hash.toLowerCase().includes(formattedSearchTerm);
};
//
};
const
TxInternals
=
()
=>
{
const
TxInternals
=
()
=>
{
const
router
=
useRouter
();
const
router
=
useRouter
();
const
fetch
=
useFetch
();
const
fetch
=
useFetch
();
const
[
filters
,
setFilters
]
=
React
.
useState
<
Array
<
TxInternalsType
>>
([]);
// filters are not implemented yet in api
const
[
searchTerm
,
setSearchTerm
]
=
React
.
useState
<
string
>
(
''
);
// const [ filters, setFilters ] = React.useState<Array<TxInternalsType>>([]);
// const [ searchTerm, setSearchTerm ] = React.useState<string>('');
const
[
sort
,
setSort
]
=
React
.
useState
<
Sort
>
();
const
[
sort
,
setSort
]
=
React
.
useState
<
Sort
>
();
const
txInfo
=
useFetchTxInfo
({
updateDelay
:
5
*
SECOND
});
const
txInfo
=
useFetchTxInfo
({
updateDelay
:
5
*
SECOND
});
const
{
data
,
isLoading
,
isError
}
=
useQuery
<
unknown
,
unknown
,
InternalTransactionsResponse
>
(
const
{
data
,
isLoading
,
isError
}
=
useQuery
<
unknown
,
unknown
,
InternalTransactionsResponse
>
(
...
@@ -87,9 +88,9 @@ const TxInternals = () => {
...
@@ -87,9 +88,9 @@ const TxInternals = () => {
const
isMobile
=
useIsMobile
();
const
isMobile
=
useIsMobile
();
const
handleFilterChange
=
React
.
useCallback
((
nextValue
:
Array
<
TxInternalsType
>
)
=>
{
//
const handleFilterChange = React.useCallback((nextValue: Array<TxInternalsType>) => {
setFilters
(
nextValue
);
//
setFilters(nextValue);
},
[]);
//
}, []);
const
handleSortToggle
=
React
.
useCallback
((
field
:
SortField
)
=>
{
const
handleSortToggle
=
React
.
useCallback
((
field
:
SortField
)
=>
{
return
()
=>
{
return
()
=>
{
...
@@ -120,8 +121,8 @@ const TxInternals = () => {
...
@@ -120,8 +121,8 @@ const TxInternals = () => {
const
content
=
(()
=>
{
const
content
=
(()
=>
{
const
filteredData
=
data
.
items
const
filteredData
=
data
.
items
.
filter
(({
type
})
=>
filters
.
length
>
0
?
filters
.
includes
(
type
)
:
true
)
//
.filter(({ type }) => filters.length > 0 ? filters.includes(type) : true)
.
filter
(
searchFn
(
searchTerm
))
//
.filter(searchFn(searchTerm))
.
sort
(
sortFn
(
sort
));
.
sort
(
sortFn
(
sort
));
if
(
filteredData
.
length
===
0
)
{
if
(
filteredData
.
length
===
0
)
{
...
@@ -135,10 +136,10 @@ const TxInternals = () => {
...
@@ -135,10 +136,10 @@ const TxInternals = () => {
return
(
return
(
<
Box
>
<
Box
>
<
Flex
mb=
{
6
}
>
{
/*
<Flex mb={ 6 }>
<TxInternalsFilter onFilterChange={ handleFilterChange } defaultFilters={ filters } appliedFiltersNum={ filters.length }/>
<TxInternalsFilter onFilterChange={ handleFilterChange } defaultFilters={ filters } appliedFiltersNum={ filters.length }/>
<FilterInput onChange={ setSearchTerm } maxW="360px" ml={ 3 } size="xs" placeholder="Search by addresses, hash, method..."/>
<FilterInput onChange={ setSearchTerm } maxW="360px" ml={ 3 } size="xs" placeholder="Search by addresses, hash, method..."/>
</
Flex
>
</Flex>
*/
}
{
content
}
{
content
}
</
Box
>
</
Box
>
);
);
...
...
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