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
cc5fbdbb
Commit
cc5fbdbb
authored
Nov 09, 2022
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hide pagination if there is only one page
parent
7faddf76
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
13 deletions
+28
-13
BlocksContent.tsx
ui/blocks/BlocksContent.tsx
+12
-5
BlocksTable.tsx
ui/blocks/BlocksTable.tsx
+3
-2
TxsContent.tsx
ui/txs/TxsContent.tsx
+3
-2
TxsHeader.tsx
ui/txs/TxsHeader.tsx
+7
-2
TxsTable.tsx
ui/txs/TxsTable.tsx
+3
-2
No files found.
ui/blocks/BlocksContent.tsx
View file @
cc5fbdbb
...
...
@@ -30,6 +30,7 @@ const BlocksContent = ({ type }: Props) => {
queryName
:
QueryKeys
.
blocks
,
filters
:
{
type
},
});
const
isPaginatorHidden
=
!
isLoading
&&
!
isError
&&
pagination
.
page
===
1
&&
!
pagination
.
hasNextPage
;
const
handleNewBlockMessage
:
SocketMessage
.
NewBlock
[
'
handler
'
]
=
React
.
useCallback
((
payload
)
=>
{
queryClient
.
setQueryData
([
QueryKeys
.
blocks
,
{
page
:
pagination
.
page
,
filters
:
{
type
}
}
],
(
prevData
:
BlocksResponse
|
undefined
)
=>
{
...
...
@@ -91,21 +92,27 @@ const BlocksContent = ({ type }: Props) => {
<>
{
socketAlert
&&
<
Alert
status=
"warning"
mb=
{
6
}
as=
"a"
href=
{
window
.
document
.
location
.
href
}
>
{
socketAlert
}
</
Alert
>
}
<
Show
below=
"lg"
key=
"content-mobile"
><
BlocksList
data=
{
data
.
items
}
/></
Show
>
<
Hide
below=
"lg"
key=
"content-desktop"
><
BlocksTable
data=
{
data
.
items
}
/></
Hide
>
<
Hide
below=
"lg"
key=
"content-desktop"
><
BlocksTable
data=
{
data
.
items
}
top=
{
isPaginatorHidden
?
0
:
80
}
/></
Hide
>
</>
);
})();
const
totalText
=
data
?.
items
.
length
?
<
Text
mb=
{
{
base
:
0
,
lg
:
6
}
}
>
Total of
{
data
.
items
[
0
].
height
.
toLocaleString
()
}
blocks
</
Text
>
:
null
;
return
(
<>
{
data
?
<
Text
mb=
{
{
base
:
0
,
lg
:
6
}
}
>
Total of
{
data
.
items
[
0
].
height
.
toLocaleString
()
}
blocks
</
Text
>
:
totalText
:
<
Skeleton
h=
"24px"
w=
"200px"
mb=
{
{
base
:
0
,
lg
:
6
}
}
/>
}
{
!
isPaginatorHidden
&&
(
<
ActionBar
>
<
Pagination
ml=
"auto"
{
...
pagination
}
/>
</
ActionBar
>
)
}
{
content
}
</>
);
...
...
ui/blocks/BlocksTable.tsx
View file @
cc5fbdbb
...
...
@@ -12,13 +12,14 @@ import { default as Thead } from 'ui/shared/TheadSticky';
interface
Props
{
data
:
Array
<
Block
>
;
top
:
number
;
}
const
BlocksTable
=
({
data
}:
Props
)
=>
{
const
BlocksTable
=
({
data
,
top
}:
Props
)
=>
{
return
(
<
Table
variant=
"simple"
minWidth=
"1040px"
size=
"md"
fontWeight=
{
500
}
>
<
Thead
top=
{
80
}
>
<
Thead
top=
{
top
}
>
<
Tr
>
<
Th
width=
"125px"
>
Block
</
Th
>
<
Th
width=
"120px"
>
Size
</
Th
>
...
...
ui/txs/TxsContent.tsx
View file @
cc5fbdbb
...
...
@@ -37,6 +37,7 @@ const TxsContent = ({
});
// } = useQueryWithPages({ ...filters, filter: stateFilter, apiPath });
const
{
data
,
isLoading
,
isError
,
setSortByField
,
setSortByValue
,
sorting
}
=
useTxsSort
(
queryResult
);
const
isPaginatorHidden
=
!
isLoading
&&
!
isError
&&
pagination
.
page
===
1
&&
!
pagination
.
hasNextPage
;
const
content
=
(()
=>
{
if
(
isError
)
{
...
...
@@ -61,7 +62,7 @@ const TxsContent = ({
return
(
<>
<
Show
below=
"lg"
ssr=
{
false
}
><
Box
>
{
txs
.
map
(
tx
=>
<
TxsListItem
tx=
{
tx
}
key=
{
tx
.
hash
}
/>)
}
</
Box
></
Show
>
<
Hide
below=
"lg"
ssr=
{
false
}
><
TxsTable
txs=
{
txs
}
sort=
{
setSortByField
}
sorting=
{
sorting
}
/></
Hide
>
<
Hide
below=
"lg"
ssr=
{
false
}
><
TxsTable
txs=
{
txs
}
sort=
{
setSortByField
}
sorting=
{
sorting
}
top=
{
isPaginatorHidden
?
0
:
80
}
/></
Hide
>
</>
);
})();
...
...
@@ -69,7 +70,7 @@ const TxsContent = ({
return
(
<>
{
showDescription
&&
<
Box
mb=
{
{
base
:
6
,
lg
:
12
}
}
>
Only the first 10,000 elements are displayed
</
Box
>
}
<
TxsHeader
mt=
{
-
6
}
sorting=
{
sorting
}
setSorting=
{
setSortByValue
}
paginationProps=
{
pagination
}
/>
<
TxsHeader
mt=
{
-
6
}
sorting=
{
sorting
}
setSorting=
{
setSortByValue
}
paginationProps=
{
pagination
}
showPagination=
{
!
isPaginatorHidden
}
/>
{
content
}
</>
);
...
...
ui/txs/TxsHeader.tsx
View file @
cc5fbdbb
...
...
@@ -17,11 +17,16 @@ type Props = {
setSorting
:
(
val
:
Sort
)
=>
void
;
paginationProps
:
PaginationProps
;
className
?:
string
;
showPagination
?:
boolean
;
}
const
TxsHeader
=
({
sorting
,
setSorting
,
paginationProps
,
className
}:
Props
)
=>
{
const
TxsHeader
=
({
sorting
,
setSorting
,
paginationProps
,
className
,
showPagination
=
true
}:
Props
)
=>
{
const
isMobile
=
useIsMobile
(
false
);
if
(
!
showPagination
&&
!
isMobile
)
{
return
null
;
}
return
(
<
ActionBar
className=
{
className
}
>
<
HStack
>
...
...
@@ -47,7 +52,7 @@ const TxsHeader = ({ sorting, setSorting, paginationProps, className }: Props) =
placeholder="Search by addresses, hash, method..."
/> */
}
</
HStack
>
<
Pagination
{
...
paginationProps
}
/>
{
showPagination
&&
<
Pagination
{
...
paginationProps
}
/>
}
</
ActionBar
>
);
};
...
...
ui/txs/TxsTable.tsx
View file @
cc5fbdbb
...
...
@@ -14,12 +14,13 @@ type Props = {
txs
:
Array
<
Transaction
>
;
sort
:
(
field
:
'
val
'
|
'
fee
'
)
=>
()
=>
void
;
sorting
?:
Sort
;
top
:
number
;
}
const
TxsTable
=
({
txs
,
sort
,
sorting
}:
Props
)
=>
{
const
TxsTable
=
({
txs
,
sort
,
sorting
,
top
}:
Props
)
=>
{
return
(
<
Table
variant=
"simple"
minWidth=
"810px"
size=
"xs"
>
<
TheadSticky
top=
{
80
}
>
<
TheadSticky
top=
{
top
}
>
<
Tr
>
<
Th
width=
"54px"
></
Th
>
<
Th
width=
"20%"
>
Type
</
Th
>
...
...
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