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
ab52f075
Commit
ab52f075
authored
Oct 24, 2022
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix merge
parent
7d7bf1fe
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
6 deletions
+10
-6
transaction.ts
types/api/transaction.ts
+1
-1
TxsContent.tsx
ui/txs/TxsContent.tsx
+3
-2
TxsTab.tsx
ui/txs/TxsTab.tsx
+3
-0
useQueryWithPages.ts
ui/txs/useQueryWithPages.ts
+3
-3
No files found.
types/api/transaction.ts
View file @
ab52f075
...
...
@@ -46,5 +46,5 @@ export interface TransactionsResponse {
block_number
:
number
;
index
:
number
;
items_count
:
number
;
};
}
|
null
;
}
ui/txs/TxsContent.tsx
View file @
ab52f075
...
...
@@ -25,6 +25,7 @@ type Props = {
}
const
TxsContent
=
({
queryName
,
showDescription
,
stateFilter
,
apiPath
,
...
...
@@ -66,7 +67,7 @@ const TxsContent = ({
onNextPageClick
,
hasPagination
,
resetPage
,
}
=
useQueryWithPages
(
{
filter
:
stateFilter
},
apiPath
);
}
=
useQueryWithPages
(
apiPath
,
queryName
,
stateFilter
&&
{
filter
:
stateFilter
}
);
// } = useQueryWithPages({ ...filters, filter: stateFilter, apiPath });
const
isMobile
=
useIsMobile
(
false
);
...
...
@@ -124,7 +125,7 @@ const TxsContent = ({
{
hasPagination
?
(
<
Pagination
currentPage=
{
page
}
hasNextPage=
{
data
?.
next_page_params
!==
undefined
&&
Object
.
keys
(
data
?.
next_page_params
).
length
>
0
}
hasNextPage=
{
data
?.
next_page_params
!==
undefined
&&
Object
.
keys
(
data
?.
next_page_params
||
{}
).
length
>
0
}
onNextPageClick=
{
onNextPageClick
}
onPrevPageClick=
{
onPrevPageClick
}
/>
...
...
ui/txs/TxsTab.tsx
View file @
ab52f075
import
React
from
'
react
'
;
import
{
QueryKeys
}
from
'
types/client/queries
'
;
import
TxsContent
from
'
./TxsContent
'
;
type
Props
=
{
...
...
@@ -9,6 +11,7 @@ type Props = {
const
TxsTab
=
({
tab
}:
Props
)
=>
{
return
(
<
TxsContent
queryName=
{
QueryKeys
.
transactions
}
showDescription=
{
tab
===
'
validated
'
}
stateFilter=
{
tab
}
apiPath=
"/api/transactions"
...
...
ui/txs/useQueryWithPages.ts
View file @
ab52f075
...
...
@@ -6,13 +6,13 @@ import { animateScroll } from 'react-scroll';
import
type
{
TransactionsResponse
}
from
'
types/api/transaction
'
;
import
type
{
TTxsFilters
}
from
'
types/api/txsFilters
'
;
import
{
QueryKeys
}
from
'
types/client/queries
'
;
import
type
{
QueryKeys
}
from
'
types/client/queries
'
;
import
useFetch
from
'
lib/hooks/useFetch
'
;
const
PAGINATION_FIELDS
=
[
'
block_number
'
,
'
index
'
,
'
items_count
'
];
export
default
function
useQueryWithPages
(
filters
:
TTxsFilters
,
apiPath
:
string
)
{
export
default
function
useQueryWithPages
(
apiPath
:
string
,
queryName
:
QueryKeys
,
filters
?:
TTxsFilters
)
{
const
queryClient
=
useQueryClient
();
const
router
=
useRouter
();
const
[
page
,
setPage
]
=
React
.
useState
(
1
);
...
...
@@ -21,7 +21,7 @@ export default function useQueryWithPages(filters: TTxsFilters, apiPath: string)
const
fetch
=
useFetch
();
const
{
data
,
isLoading
,
isError
}
=
useQuery
<
unknown
,
unknown
,
TransactionsResponse
>
(
[
QueryKeys
.
transactions
,
{
page
,
filters
}
],
[
queryName
,
{
page
,
filters
}
],
async
()
=>
{
const
params
:
Array
<
string
>
=
[];
...
...
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