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
ed7aa0ec
Commit
ed7aa0ec
authored
Mar 20, 2023
by
isstuev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring and total fixes
parent
87d4e7a7
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
176 additions
and
106 deletions
+176
-106
resources.ts
lib/api/resources.ts
+15
-0
outputRoots.ts
mocks/outputRoots/outputRoots.ts
+0
-1
txnBatches.ts
mocks/txnBatches/txnBatches.ts
+0
-1
withdrawals.ts
mocks/withdrawals/withdrawals.ts
+0
-1
OutputRootsListItem.tsx
ui/outputRoots/OutputRootsListItem.tsx
+1
-0
OutputRootsTableItem.tsx
ui/outputRoots/OutputRootsTableItem.tsx
+5
-1
OutputRoots.pw.tsx
ui/pages/OutputRoots.pw.tsx
+6
-0
OutputRoots.tsx
ui/pages/OutputRoots.tsx
+42
-34
TxnBatches.pw.tsx
ui/pages/TxnBatches.pw.tsx
+6
-0
TxnBatches.tsx
ui/pages/TxnBatches.tsx
+43
-35
Withdrawals.pw.tsx
ui/pages/Withdrawals.pw.tsx
+6
-0
Withdrawals.tsx
ui/pages/Withdrawals.tsx
+40
-32
Withdrawals.pw.tsx_default_base-view-mobile-1.png
...shots__/Withdrawals.pw.tsx_default_base-view-mobile-1.png
+0
-0
Withdrawals.pw.tsx_mobile_base-view-mobile-1.png
...nshots__/Withdrawals.pw.tsx_mobile_base-view-mobile-1.png
+0
-0
DataListDisplay.tsx
ui/shared/DataListDisplay.tsx
+2
-0
TxnBatchesListItem.tsx
ui/txnBatches/TxnBatchesListItem.tsx
+2
-0
TxnBatchesTableItem.tsx
ui/txnBatches/TxnBatchesTableItem.tsx
+7
-1
WithdrawalsListItem.tsx
ui/withdrawals/WithdrawalsListItem.tsx
+1
-0
No files found.
lib/api/resources.ts
View file @
ed7aa0ec
...
@@ -372,18 +372,30 @@ export const RESOURCES = {
...
@@ -372,18 +372,30 @@ export const RESOURCES = {
filterFields
:
[],
filterFields
:
[],
},
},
withdrawals_count
:
{
path
:
'
/api/v2/optimism/withdrawals-count
'
,
},
output_roots
:
{
output_roots
:
{
path
:
'
/api/v2/optimism/output-roots
'
,
path
:
'
/api/v2/optimism/output-roots
'
,
paginationFields
:
[
'
index
'
as
const
,
'
items_count
'
as
const
],
paginationFields
:
[
'
index
'
as
const
,
'
items_count
'
as
const
],
filterFields
:
[],
filterFields
:
[],
},
},
output_roots_count
:
{
path
:
'
/api/v2/optimism/output-roots-count
'
,
},
txn_batches
:
{
txn_batches
:
{
path
:
'
/api/v2/optimism/txn-batches
'
,
path
:
'
/api/v2/optimism/txn-batches
'
,
paginationFields
:
[
'
block_number
'
as
const
,
'
items_count
'
as
const
],
paginationFields
:
[
'
block_number
'
as
const
,
'
items_count
'
as
const
],
filterFields
:
[],
filterFields
:
[],
},
},
txn_batches_count
:
{
path
:
'
/api/v2/optimism/txn-batches-count
'
,
},
// DEPRECATED
// DEPRECATED
old_api
:
{
old_api
:
{
path
:
'
/api
'
,
path
:
'
/api
'
,
...
@@ -508,6 +520,9 @@ Q extends 'contract_verification_config' ? SmartContractVerificationConfig :
...
@@ -508,6 +520,9 @@ Q extends 'contract_verification_config' ? SmartContractVerificationConfig :
Q
extends
'
output_roots
'
?
OutputRootsResponse
:
Q
extends
'
output_roots
'
?
OutputRootsResponse
:
Q
extends
'
withdrawals
'
?
WithdrawalsResponse
:
Q
extends
'
withdrawals
'
?
WithdrawalsResponse
:
Q
extends
'
txn_batches
'
?
TxnBatchesResponse
:
Q
extends
'
txn_batches
'
?
TxnBatchesResponse
:
Q
extends
'
output_roots_count
'
?
number
:
Q
extends
'
withdrawals_count
'
?
number
:
Q
extends
'
txn_batches_count
'
?
number
:
never
;
never
;
/* eslint-enable @typescript-eslint/indent */
/* eslint-enable @typescript-eslint/indent */
...
...
mocks/outputRoots/outputRoots.ts
View file @
ed7aa0ec
...
@@ -29,5 +29,4 @@ export const outputRootsData = {
...
@@ -29,5 +29,4 @@ export const outputRootsData = {
index
:
9877
,
index
:
9877
,
items_count
:
50
,
items_count
:
50
,
},
},
total
:
9927
,
};
};
mocks/txnBatches/txnBatches.ts
View file @
ed7aa0ec
...
@@ -33,5 +33,4 @@ export const txnBatchesData = {
...
@@ -33,5 +33,4 @@ export const txnBatchesData = {
block_number
:
5902834
,
block_number
:
5902834
,
items_count
:
50
,
items_count
:
50
,
},
},
total
:
1235016
,
};
};
mocks/withdrawals/withdrawals.ts
View file @
ed7aa0ec
...
@@ -47,5 +47,4 @@ export const data = {
...
@@ -47,5 +47,4 @@ export const data = {
items_count
:
50
,
items_count
:
50
,
nonce
:
'
1766847064778384329583297500742918515827483896875618958121606201292620123
'
,
nonce
:
'
1766847064778384329583297500742918515827483896875618958121606201292620123
'
,
},
},
total
:
397
,
};
};
ui/outputRoots/OutputRootsListItem.tsx
View file @
ed7aa0ec
...
@@ -45,6 +45,7 @@ const OutputRootsListItem = ({ item }: Props) => {
...
@@ -45,6 +45,7 @@ const OutputRootsListItem = ({ item }: Props) => {
value
:
(
value
:
(
<
LinkExternal
<
LinkExternal
w=
"100%"
w=
"100%"
display=
"inline-flex"
overflow=
"hidden"
overflow=
"hidden"
href=
{
appConfig
.
L2
.
L1BaseUrl
+
route
({
pathname
:
'
/tx/[hash]
'
,
query
:
{
hash
:
item
.
l1_tx_hash
}
})
}
href=
{
appConfig
.
L2
.
L1BaseUrl
+
route
({
pathname
:
'
/tx/[hash]
'
,
query
:
{
hash
:
item
.
l1_tx_hash
}
})
}
>
>
...
...
ui/outputRoots/OutputRootsTableItem.tsx
View file @
ed7aa0ec
...
@@ -40,7 +40,11 @@ const OutputRootsTableItem = ({ item }: Props) => {
...
@@ -40,7 +40,11 @@ const OutputRootsTableItem = ({ item }: Props) => {
</
Td
>
</
Td
>
<
Td
verticalAlign=
"middle"
pr=
{
12
}
>
<
Td
verticalAlign=
"middle"
pr=
{
12
}
>
<
Flex
>
<
Flex
>
<
LinkExternal
w=
"100%"
href=
{
appConfig
.
L2
.
L1BaseUrl
+
route
({
pathname
:
'
/tx/[hash]
'
,
query
:
{
hash
:
item
.
l1_tx_hash
}
})
}
>
<
LinkExternal
w=
"100%"
display=
"inline-flex"
href=
{
appConfig
.
L2
.
L1BaseUrl
+
route
({
pathname
:
'
/tx/[hash]
'
,
query
:
{
hash
:
item
.
l1_tx_hash
}
})
}
>
<
Icon
as=
{
txIcon
}
boxSize=
{
6
}
mr=
{
1
}
/>
<
Icon
as=
{
txIcon
}
boxSize=
{
6
}
mr=
{
1
}
/>
<
Box
w=
"calc(100% - 36px)"
overflow=
"hidden"
whiteSpace=
"nowrap"
><
HashStringShortenDynamic
hash=
{
item
.
l1_tx_hash
}
/></
Box
>
<
Box
w=
"calc(100% - 36px)"
overflow=
"hidden"
whiteSpace=
"nowrap"
><
HashStringShortenDynamic
hash=
{
item
.
l1_tx_hash
}
/></
Box
>
</
LinkExternal
>
</
LinkExternal
>
...
...
ui/pages/OutputRoots.pw.tsx
View file @
ed7aa0ec
...
@@ -8,6 +8,7 @@ import buildApiUrl from 'playwright/utils/buildApiUrl';
...
@@ -8,6 +8,7 @@ import buildApiUrl from 'playwright/utils/buildApiUrl';
import
OutputRoots
from
'
./OutputRoots
'
;
import
OutputRoots
from
'
./OutputRoots
'
;
const
OUTPUT_ROOTS_API_URL
=
buildApiUrl
(
'
output_roots
'
);
const
OUTPUT_ROOTS_API_URL
=
buildApiUrl
(
'
output_roots
'
);
const
OUTPUT_ROOTS_COUNT_API_URL
=
buildApiUrl
(
'
output_roots_count
'
);
test
(
'
base view +@mobile
'
,
async
({
mount
,
page
})
=>
{
test
(
'
base view +@mobile
'
,
async
({
mount
,
page
})
=>
{
await
page
.
route
(
'
https://request-global.czilladx.com/serve/native.php?z=19260bf627546ab7242
'
,
(
route
)
=>
route
.
fulfill
({
await
page
.
route
(
'
https://request-global.czilladx.com/serve/native.php?z=19260bf627546ab7242
'
,
(
route
)
=>
route
.
fulfill
({
...
@@ -20,6 +21,11 @@ test('base view +@mobile', async({ mount, page }) => {
...
@@ -20,6 +21,11 @@ test('base view +@mobile', async({ mount, page }) => {
body
:
JSON
.
stringify
(
outputRootsData
),
body
:
JSON
.
stringify
(
outputRootsData
),
}));
}));
await
page
.
route
(
OUTPUT_ROOTS_COUNT_API_URL
,
(
route
)
=>
route
.
fulfill
({
status
:
200
,
body
:
'
9927
'
,
}));
const
component
=
await
mount
(
const
component
=
await
mount
(
<
TestApp
>
<
TestApp
>
<
OutputRoots
/>
<
OutputRoots
/>
...
...
ui/pages/OutputRoots.tsx
View file @
ed7aa0ec
import
{
Flex
,
Hide
,
Show
,
Skeleton
,
Text
}
from
'
@chakra-ui/react
'
;
import
{
Flex
,
Hide
,
Show
,
Skeleton
,
Text
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
useApiQuery
from
'
lib/api/useApiQuery
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
useQueryWithPages
from
'
lib/hooks/useQueryWithPages
'
;
import
useQueryWithPages
from
'
lib/hooks/useQueryWithPages
'
;
import
OutputRootsListItem
from
'
ui/outputRoots/OutputRootsListItem
'
;
import
OutputRootsListItem
from
'
ui/outputRoots/OutputRootsListItem
'
;
import
OutputRootsTable
from
'
ui/outputRoots/OutputRootsTable
'
;
import
OutputRootsTable
from
'
ui/outputRoots/OutputRootsTable
'
;
import
ActionBar
from
'
ui/shared/ActionBar
'
;
import
ActionBar
from
'
ui/shared/ActionBar
'
;
import
Data
FetchAlert
from
'
ui/shared/DataFetchAlert
'
;
import
Data
ListDisplay
from
'
ui/shared/DataListDisplay
'
;
import
Page
from
'
ui/shared/Page/Page
'
;
import
Page
from
'
ui/shared/Page/Page
'
;
import
PageTitle
from
'
ui/shared/Page/PageTitle
'
;
import
PageTitle
from
'
ui/shared/Page/PageTitle
'
;
import
Pagination
from
'
ui/shared/Pagination
'
;
import
Pagination
from
'
ui/shared/Pagination
'
;
import
SkeletonList
from
'
ui/shared/skeletons/SkeletonList
'
;
import
SkeletonTable
from
'
ui/shared/skeletons/SkeletonTable
'
;
const
OutputRoots
=
()
=>
{
const
OutputRoots
=
()
=>
{
const
isMobile
=
useIsMobile
();
const
isMobile
=
useIsMobile
();
...
@@ -20,51 +19,60 @@ const OutputRoots = () => {
...
@@ -20,51 +19,60 @@ const OutputRoots = () => {
resourceName
:
'
output_roots
'
,
resourceName
:
'
output_roots
'
,
});
});
const
content
=
(()
=>
{
const
countersQuery
=
useApiQuery
(
'
output_roots_count
'
);
if
(
isError
)
{
return
<
DataFetchAlert
/>;
const
content
=
data
?.
items
?
(
<>
<
Show
below=
"lg"
ssr=
{
false
}
>
{
data
.
items
.
map
((
item
=>
<
OutputRootsListItem
key=
{
item
.
l2_output_index
}
item=
{
item
}
/>))
}
</
Show
>
<
Hide
below=
"lg"
ssr=
{
false
}
><
OutputRootsTable
items=
{
data
.
items
}
top=
{
isPaginationVisible
?
80
:
0
}
/></
Hide
>
</>
)
:
null
;
const
text
=
(()
=>
{
if
(
countersQuery
.
isLoading
||
isLoading
)
{
return
<
Skeleton
w=
{
{
base
:
'
100%
'
,
lg
:
'
400px
'
}
}
h=
{
{
base
:
'
48px
'
,
lg
:
'
26px
'
}
}
mb=
{
{
base
:
6
,
lg
:
7
}
}
mt=
{
{
base
:
0
,
lg
:
7
}
}
/>;
}
}
if
(
isLoading
)
{
if
(
countersQuery
.
isError
||
isError
||
data
?.
items
.
length
===
0
)
{
return
(
return
null
;
<>
<
Skeleton
w=
{
{
base
:
'
100%
'
,
lg
:
'
400px
'
}
}
h=
{
{
base
:
'
48px
'
,
lg
:
'
26px
'
}
}
mb=
{
{
base
:
6
,
lg
:
7
}
}
mt=
{
{
base
:
0
,
lg
:
7
}
}
/>
<
SkeletonList
display=
{
{
base
:
'
block
'
,
lg
:
'
none
'
}
}
/>
<
SkeletonTable
minW=
"900px"
display=
{
{
base
:
'
none
'
,
lg
:
'
block
'
}
}
columns=
{
[
'
140px
'
,
'
20%
'
,
'
20%
'
,
'
30%
'
,
'
30%
'
]
}
/>
</>
);
}
}
const
text
=
(
return
(
<
Flex
mb=
{
{
base
:
6
,
lg
:
0
}
}
flexWrap=
"wrap"
>
<
Flex
mb=
{
{
base
:
6
,
lg
:
0
}
}
flexWrap=
"wrap"
>
L2 output index
L2 output index
<
Text
fontWeight=
{
600
}
whiteSpace=
"pre"
>
#
{
data
.
items
[
0
].
l2_output_index
}
</
Text
>
to
<
Text
fontWeight=
{
600
}
whiteSpace=
"pre"
>
#
{
data
.
items
[
0
].
l2_output_index
}
</
Text
>
to
<
Text
fontWeight=
{
600
}
whiteSpace=
"pre"
>
#
{
data
.
items
[
data
.
items
.
length
-
1
].
l2_output_index
}
</
Text
>
<
Text
fontWeight=
{
600
}
whiteSpace=
"pre"
>
#
{
data
.
items
[
data
.
items
.
length
-
1
].
l2_output_index
}
</
Text
>
(total of
{
data
.
total
.
toLocaleString
(
'
en
'
)
}
roots)
(total of
{
countersQuery
.
data
.
toLocaleString
(
'
en
'
)
}
roots)
</
Flex
>
</
Flex
>
);
);
return
(
<>
{
(
isMobile
||
!
isPaginationVisible
)
&&
text
}
{
isPaginationVisible
&&
(
<
ActionBar
mt=
{
-
6
}
>
<
Flex
alignItems=
"center"
justifyContent=
"space-between"
w=
"100%"
>
{
!
isMobile
&&
text
}
<
Pagination
ml=
"auto"
{
...
pagination
}
/>
</
Flex
>
</
ActionBar
>
)
}
<
Show
below=
"lg"
ssr=
{
false
}
>
{
data
.
items
.
map
((
item
=>
<
OutputRootsListItem
key=
{
item
.
l2_output_index
}
item=
{
item
}
/>))
}
</
Show
>
<
Hide
below=
"lg"
ssr=
{
false
}
><
OutputRootsTable
items=
{
data
.
items
}
top=
{
isPaginationVisible
?
80
:
0
}
/></
Hide
>
</>
);
})();
})();
const
actionBar
=
(
<>
{
(
isMobile
||
!
isPaginationVisible
)
&&
text
}
{
isPaginationVisible
&&
(
<
ActionBar
mt=
{
-
6
}
>
<
Flex
alignItems=
"center"
justifyContent=
"space-between"
w=
"100%"
>
{
!
isMobile
&&
text
}
<
Pagination
ml=
"auto"
{
...
pagination
}
/>
</
Flex
>
</
ActionBar
>
)
}
</>
);
return
(
return
(
<
Page
>
<
Page
>
<
PageTitle
text=
"Output roots"
withTextAd
/>
<
PageTitle
text=
"Output roots"
withTextAd
/>
{
content
}
<
DataListDisplay
isError=
{
isError
}
isLoading=
{
isLoading
}
items=
{
data
?.
items
}
skeletonProps=
{
{
skeletonDesktopColumns
:
[
'
140px
'
,
'
20%
'
,
'
20%
'
,
'
30%
'
,
'
30%
'
]
}
}
emptyText=
"There are no output roots."
content=
{
content
}
actionBar=
{
actionBar
}
/>
</
Page
>
</
Page
>
);
);
};
};
...
...
ui/pages/TxnBatches.pw.tsx
View file @
ed7aa0ec
...
@@ -8,6 +8,7 @@ import buildApiUrl from 'playwright/utils/buildApiUrl';
...
@@ -8,6 +8,7 @@ import buildApiUrl from 'playwright/utils/buildApiUrl';
import
TxnBatches
from
'
./TxnBatches
'
;
import
TxnBatches
from
'
./TxnBatches
'
;
const
TXN_BATCHES_API_URL
=
buildApiUrl
(
'
txn_batches
'
);
const
TXN_BATCHES_API_URL
=
buildApiUrl
(
'
txn_batches
'
);
const
TXN_BATCHES_COUNT_API_URL
=
buildApiUrl
(
'
txn_batches_count
'
);
test
(
'
base view +@mobile
'
,
async
({
mount
,
page
})
=>
{
test
(
'
base view +@mobile
'
,
async
({
mount
,
page
})
=>
{
await
page
.
route
(
'
https://request-global.czilladx.com/serve/native.php?z=19260bf627546ab7242
'
,
(
route
)
=>
route
.
fulfill
({
await
page
.
route
(
'
https://request-global.czilladx.com/serve/native.php?z=19260bf627546ab7242
'
,
(
route
)
=>
route
.
fulfill
({
...
@@ -20,6 +21,11 @@ test('base view +@mobile', async({ mount, page }) => {
...
@@ -20,6 +21,11 @@ test('base view +@mobile', async({ mount, page }) => {
body
:
JSON
.
stringify
(
txnBatchesData
),
body
:
JSON
.
stringify
(
txnBatchesData
),
}));
}));
await
page
.
route
(
TXN_BATCHES_COUNT_API_URL
,
(
route
)
=>
route
.
fulfill
({
status
:
200
,
body
:
'
1235016
'
,
}));
const
component
=
await
mount
(
const
component
=
await
mount
(
<
TestApp
>
<
TestApp
>
<
TxnBatches
/>
<
TxnBatches
/>
...
...
ui/pages/TxnBatches.tsx
View file @
ed7aa0ec
import
{
Flex
,
Hide
,
Show
,
Skeleton
,
Text
}
from
'
@chakra-ui/react
'
;
import
{
Flex
,
Hide
,
Show
,
Skeleton
,
Text
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
useApiQuery
from
'
lib/api/useApiQuery
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
useQueryWithPages
from
'
lib/hooks/useQueryWithPages
'
;
import
useQueryWithPages
from
'
lib/hooks/useQueryWithPages
'
;
import
{
nbsp
}
from
'
lib/html-entities
'
;
import
{
nbsp
}
from
'
lib/html-entities
'
;
import
ActionBar
from
'
ui/shared/ActionBar
'
;
import
ActionBar
from
'
ui/shared/ActionBar
'
;
import
Data
FetchAlert
from
'
ui/shared/DataFetchAlert
'
;
import
Data
ListDisplay
from
'
ui/shared/DataListDisplay
'
;
import
Page
from
'
ui/shared/Page/Page
'
;
import
Page
from
'
ui/shared/Page/Page
'
;
import
PageTitle
from
'
ui/shared/Page/PageTitle
'
;
import
PageTitle
from
'
ui/shared/Page/PageTitle
'
;
import
Pagination
from
'
ui/shared/Pagination
'
;
import
Pagination
from
'
ui/shared/Pagination
'
;
import
SkeletonList
from
'
ui/shared/skeletons/SkeletonList
'
;
import
SkeletonTable
from
'
ui/shared/skeletons/SkeletonTable
'
;
import
TxnBatchesListItem
from
'
ui/txnBatches/TxnBatchesListItem
'
;
import
TxnBatchesListItem
from
'
ui/txnBatches/TxnBatchesListItem
'
;
import
TxnBatchesTable
from
'
ui/txnBatches/TxnBatchesTable
'
;
import
TxnBatchesTable
from
'
ui/txnBatches/TxnBatchesTable
'
;
...
@@ -21,51 +20,60 @@ const TxnBatches = () => {
...
@@ -21,51 +20,60 @@ const TxnBatches = () => {
resourceName
:
'
txn_batches
'
,
resourceName
:
'
txn_batches
'
,
});
});
const
content
=
(()
=>
{
const
countersQuery
=
useApiQuery
(
'
txn_batches_count
'
);
if
(
isError
)
{
return
<
DataFetchAlert
/>;
const
content
=
data
?.
items
?
(
<>
<
Show
below=
"lg"
ssr=
{
false
}
>
{
data
.
items
.
map
((
item
=>
<
TxnBatchesListItem
key=
{
item
.
l2_block_number
}
item=
{
item
}
/>))
}
</
Show
>
<
Hide
below=
"lg"
ssr=
{
false
}
><
TxnBatchesTable
items=
{
data
.
items
}
top=
{
isPaginationVisible
?
80
:
0
}
/></
Hide
>
</>
)
:
null
;
const
text
=
(()
=>
{
if
(
countersQuery
.
isLoading
||
isLoading
)
{
return
<
Skeleton
w=
{
{
base
:
'
100%
'
,
lg
:
'
400px
'
}
}
h=
{
{
base
:
'
48px
'
,
lg
:
'
26px
'
}
}
mb=
{
{
base
:
6
,
lg
:
7
}
}
mt=
{
{
base
:
0
,
lg
:
7
}
}
/>;
}
}
if
(
isLoading
)
{
if
(
countersQuery
.
isError
||
isError
||
data
.
items
.
length
===
0
)
{
return
(
return
null
;
<>
<
Skeleton
w=
{
{
base
:
'
100%
'
,
lg
:
'
400px
'
}
}
h=
{
{
base
:
'
48px
'
,
lg
:
'
26px
'
}
}
mb=
{
{
base
:
6
,
lg
:
7
}
}
mt=
{
{
base
:
0
,
lg
:
7
}
}
/>
<
SkeletonList
display=
{
{
base
:
'
block
'
,
lg
:
'
none
'
}
}
/>
<
SkeletonTable
display=
{
{
base
:
'
none
'
,
lg
:
'
block
'
}
}
columns=
{
[
'
170px
'
,
'
170px
'
,
'
160px
'
,
'
100%
'
,
'
150px
'
]
}
/>
</>
);
}
}
const
text
=
(
return
(
<
Flex
mb=
{
{
base
:
6
,
lg
:
0
}
}
flexWrap=
"wrap"
>
<
Flex
mb=
{
{
base
:
6
,
lg
:
isPaginationVisible
?
0
:
6
}
}
flexWrap=
"wrap"
>
Tx batch (L2 block)
Tx batch (L2 block)
<
Text
fontWeight=
{
600
}
whiteSpace=
"pre"
>
#
{
data
.
items
[
0
].
l2_block_number
}
</
Text
>
to
<
Text
fontWeight=
{
600
}
whiteSpace=
"pre"
>
#
{
data
.
items
[
0
].
l2_block_number
}
</
Text
>
to
<
Text
fontWeight=
{
600
}
whiteSpace=
"pre"
>
#
{
data
.
items
[
data
.
items
.
length
-
1
].
l2_block_number
}
</
Text
>
<
Text
fontWeight=
{
600
}
whiteSpace=
"pre"
>
#
{
data
.
items
[
data
.
items
.
length
-
1
].
l2_block_number
}
</
Text
>
(total of
{
data
.
total
.
toLocaleString
(
'
en
'
)
}
batches)
(total of
{
countersQuery
.
data
.
toLocaleString
(
'
en
'
)
}
batches)
</
Flex
>
</
Flex
>
);
);
return
(
<>
{
(
isMobile
||
!
isPaginationVisible
)
&&
text
}
{
isPaginationVisible
&&
(
<
ActionBar
mt=
{
-
6
}
>
<
Flex
alignItems=
"center"
justifyContent=
"space-between"
w=
"100%"
>
{
!
isMobile
&&
text
}
<
Pagination
ml=
"auto"
{
...
pagination
}
/>
</
Flex
>
</
ActionBar
>
)
}
<
Show
below=
"lg"
ssr=
{
false
}
>
{
data
.
items
.
map
((
item
=>
<
TxnBatchesListItem
key=
{
item
.
l2_block_number
}
item=
{
item
}
/>))
}
</
Show
>
<
Hide
below=
"lg"
ssr=
{
false
}
><
TxnBatchesTable
items=
{
data
.
items
}
top=
{
isPaginationVisible
?
80
:
0
}
/></
Hide
>
</>
);
})();
})();
const
actionBar
=
(
<>
{
(
isMobile
||
!
isPaginationVisible
)
&&
text
}
{
isPaginationVisible
&&
(
<
ActionBar
mt=
{
-
6
}
>
<
Flex
alignItems=
"center"
justifyContent=
"space-between"
w=
"100%"
>
{
!
isMobile
&&
text
}
<
Pagination
ml=
"auto"
{
...
pagination
}
/>
</
Flex
>
</
ActionBar
>
)
}
</>
);
return
(
return
(
<
Page
>
<
Page
>
<
PageTitle
text=
{
`Tx batches (L2${ nbsp }blocks)`
}
withTextAd
/>
<
PageTitle
text=
{
`Tx batches (L2${ nbsp }blocks)`
}
withTextAd
/>
{
content
}
<
DataListDisplay
isError=
{
isError
}
isLoading=
{
isLoading
}
items=
{
data
?.
items
}
skeletonProps=
{
{
skeletonDesktopColumns
:
[
'
170px
'
,
'
170px
'
,
'
160px
'
,
'
100%
'
,
'
150px
'
]
}
}
emptyText=
"There are no tx batches."
content=
{
content
}
actionBar=
{
actionBar
}
/>
</
Page
>
</
Page
>
);
);
};
};
...
...
ui/pages/Withdrawals.pw.tsx
View file @
ed7aa0ec
...
@@ -8,6 +8,7 @@ import buildApiUrl from 'playwright/utils/buildApiUrl';
...
@@ -8,6 +8,7 @@ import buildApiUrl from 'playwright/utils/buildApiUrl';
import
Withdrawals
from
'
./Withdrawals
'
;
import
Withdrawals
from
'
./Withdrawals
'
;
const
WITHDRAWALS_API_URL
=
buildApiUrl
(
'
withdrawals
'
);
const
WITHDRAWALS_API_URL
=
buildApiUrl
(
'
withdrawals
'
);
const
WITHDRAWALS_COUNT_API_URL
=
buildApiUrl
(
'
withdrawals_count
'
);
test
(
'
base view +@mobile
'
,
async
({
mount
,
page
})
=>
{
test
(
'
base view +@mobile
'
,
async
({
mount
,
page
})
=>
{
await
page
.
route
(
'
https://request-global.czilladx.com/serve/native.php?z=19260bf627546ab7242
'
,
(
route
)
=>
route
.
fulfill
({
await
page
.
route
(
'
https://request-global.czilladx.com/serve/native.php?z=19260bf627546ab7242
'
,
(
route
)
=>
route
.
fulfill
({
...
@@ -20,6 +21,11 @@ test('base view +@mobile', async({ mount, page }) => {
...
@@ -20,6 +21,11 @@ test('base view +@mobile', async({ mount, page }) => {
body
:
JSON
.
stringify
(
withdrawalsData
),
body
:
JSON
.
stringify
(
withdrawalsData
),
}));
}));
await
page
.
route
(
WITHDRAWALS_COUNT_API_URL
,
(
route
)
=>
route
.
fulfill
({
status
:
200
,
body
:
'
397
'
,
}));
const
component
=
await
mount
(
const
component
=
await
mount
(
<
TestApp
>
<
TestApp
>
<
Withdrawals
/>
<
Withdrawals
/>
...
...
ui/pages/Withdrawals.tsx
View file @
ed7aa0ec
import
{
Flex
,
Hide
,
Show
,
Skeleton
,
Text
}
from
'
@chakra-ui/react
'
;
import
{
Flex
,
Hide
,
Show
,
Skeleton
,
Text
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
useApiQuery
from
'
lib/api/useApiQuery
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
useQueryWithPages
from
'
lib/hooks/useQueryWithPages
'
;
import
useQueryWithPages
from
'
lib/hooks/useQueryWithPages
'
;
import
{
rightLineArrow
,
nbsp
}
from
'
lib/html-entities
'
;
import
{
rightLineArrow
,
nbsp
}
from
'
lib/html-entities
'
;
import
ActionBar
from
'
ui/shared/ActionBar
'
;
import
ActionBar
from
'
ui/shared/ActionBar
'
;
import
Data
FetchAlert
from
'
ui/shared/DataFetchAlert
'
;
import
Data
ListDisplay
from
'
ui/shared/DataListDisplay
'
;
import
Page
from
'
ui/shared/Page/Page
'
;
import
Page
from
'
ui/shared/Page/Page
'
;
import
PageTitle
from
'
ui/shared/Page/PageTitle
'
;
import
PageTitle
from
'
ui/shared/Page/PageTitle
'
;
import
Pagination
from
'
ui/shared/Pagination
'
;
import
Pagination
from
'
ui/shared/Pagination
'
;
import
SkeletonList
from
'
ui/shared/skeletons/SkeletonList
'
;
import
SkeletonTable
from
'
ui/shared/skeletons/SkeletonTable
'
;
import
WithdrawalsListItem
from
'
ui/withdrawals/WithdrawalsListItem
'
;
import
WithdrawalsListItem
from
'
ui/withdrawals/WithdrawalsListItem
'
;
import
WithdrawalsTable
from
'
ui/withdrawals/WithdrawalsTable
'
;
import
WithdrawalsTable
from
'
ui/withdrawals/WithdrawalsTable
'
;
...
@@ -21,44 +20,53 @@ const Withdrawals = () => {
...
@@ -21,44 +20,53 @@ const Withdrawals = () => {
resourceName
:
'
withdrawals
'
,
resourceName
:
'
withdrawals
'
,
});
});
const
content
=
(()
=>
{
const
countersQuery
=
useApiQuery
(
'
withdrawals_count
'
);
if
(
isError
)
{
return
<
DataFetchAlert
/>;
const
content
=
data
?.
items
?
(
}
<>
<
Show
below=
"lg"
ssr=
{
false
}
>
{
data
.
items
.
map
((
item
=>
<
WithdrawalsListItem
key=
{
item
.
l2_tx_hash
}
item=
{
item
}
/>))
}
</
Show
>
<
Hide
below=
"lg"
ssr=
{
false
}
><
WithdrawalsTable
items=
{
data
.
items
}
top=
{
isPaginationVisible
?
80
:
0
}
/></
Hide
>
</>
)
:
null
;
if
(
isLoading
)
{
const
text
=
(()
=>
{
return
(
if
(
countersQuery
.
isLoading
)
{
<>
return
<
Skeleton
w=
{
{
base
:
'
100%
'
,
lg
:
'
320px
'
}
}
h=
"26px"
mb=
{
{
base
:
6
,
lg
:
7
}
}
mt=
{
{
base
:
0
,
lg
:
7
}
}
/>;
<
Skeleton
w=
{
{
base
:
'
100%
'
,
lg
:
'
320px
'
}
}
h=
"26px"
mb=
{
{
base
:
6
,
lg
:
7
}
}
mt=
{
{
base
:
0
,
lg
:
7
}
}
/>
<
SkeletonList
display=
{
{
base
:
'
block
'
,
lg
:
'
none
'
}
}
/>
<
SkeletonTable
minW=
"950px"
display=
{
{
base
:
'
none
'
,
lg
:
'
block
'
}
}
columns=
{
Array
(
7
).
fill
(
`${ 100 / 7 }%`
)
}
/>
</>
);
}
}
const
text
=
<
Text
mb=
{
{
base
:
6
,
lg
:
0
}
}
>
A total of
{
data
.
total
.
toLocaleString
(
'
en
'
)
}
withdrawals found
</
Text
>;
if
(
countersQuery
.
isError
)
{
return
null
;
}
return
(
return
<
Text
mb=
{
{
base
:
6
,
lg
:
0
}
}
>
A total of
{
countersQuery
.
data
.
toLocaleString
(
'
en
'
)
}
withdrawals found
</
Text
>;
<>
{
(
isMobile
||
!
isPaginationVisible
)
&&
text
}
{
isPaginationVisible
&&
(
<
ActionBar
mt=
{
-
6
}
>
<
Flex
alignItems=
"center"
justifyContent=
"space-between"
w=
"100%"
>
{
!
isMobile
&&
text
}
<
Pagination
ml=
"auto"
{
...
pagination
}
/>
</
Flex
>
</
ActionBar
>
)
}
<
Show
below=
"lg"
ssr=
{
false
}
>
{
data
.
items
.
map
((
item
=>
<
WithdrawalsListItem
key=
{
item
.
l2_tx_hash
}
item=
{
item
}
/>))
}
</
Show
>
<
Hide
below=
"lg"
ssr=
{
false
}
><
WithdrawalsTable
items=
{
data
.
items
}
top=
{
isPaginationVisible
?
80
:
0
}
/></
Hide
>
</>
);
})();
})();
const
actionBar
=
(
<>
{
(
isMobile
||
!
isPaginationVisible
)
&&
text
}
{
isPaginationVisible
&&
(
<
ActionBar
mt=
{
-
6
}
>
<
Flex
alignItems=
"center"
justifyContent=
"space-between"
w=
"100%"
>
{
!
isMobile
&&
text
}
<
Pagination
ml=
"auto"
{
...
pagination
}
/>
</
Flex
>
</
ActionBar
>
)
}
</>
);
return
(
return
(
<
Page
>
<
Page
>
<
PageTitle
text=
{
`Withdrawals (L2${ nbsp }${ rightLineArrow }${ nbsp }L1)`
}
withTextAd
/>
<
PageTitle
text=
{
`Withdrawals (L2${ nbsp }${ rightLineArrow }${ nbsp }L1)`
}
withTextAd
/>
{
content
}
<
DataListDisplay
isError=
{
isError
}
isLoading=
{
isLoading
}
items=
{
data
?.
items
}
skeletonProps=
{
{
skeletonDesktopColumns
:
Array
(
7
).
fill
(
`${ 100 / 7 }%`
),
skeletonDesktopMinW
:
'
950px
'
}
}
emptyText=
"There are no withdrawals."
content=
{
content
}
actionBar=
{
actionBar
}
/>
</
Page
>
</
Page
>
);
);
};
};
...
...
ui/pages/__screenshots__/Withdrawals.pw.tsx_default_base-view-mobile-1.png
View replaced file @
87d4e7a7
View file @
ed7aa0ec
37.8 KB
|
W:
|
H:
38.1 KB
|
W:
|
H:
2-up
Swipe
Onion skin
ui/pages/__screenshots__/Withdrawals.pw.tsx_mobile_base-view-mobile-1.png
View replaced file @
87d4e7a7
View file @
ed7aa0ec
55.2 KB
|
W:
|
H:
55.1 KB
|
W:
|
H:
2-up
Swipe
Onion skin
ui/shared/DataListDisplay.tsx
View file @
ed7aa0ec
...
@@ -12,6 +12,7 @@ type SkeletonProps =
...
@@ -12,6 +12,7 @@ type SkeletonProps =
{
{
skeletonDesktopColumns
:
Array
<
string
>
;
skeletonDesktopColumns
:
Array
<
string
>
;
isLongSkeleton
?:
boolean
;
isLongSkeleton
?:
boolean
;
skeletonDesktopMinW
?:
string
;
}
}
type
FilterProps
=
{
type
FilterProps
=
{
...
@@ -50,6 +51,7 @@ const DataListDisplay = (props: Props) => {
...
@@ -50,6 +51,7 @@ const DataListDisplay = (props: Props) => {
display=
{
{
base
:
'
none
'
,
lg
:
'
block
'
}
}
display=
{
{
base
:
'
none
'
,
lg
:
'
block
'
}
}
columns=
{
props
.
skeletonProps
.
skeletonDesktopColumns
||
[]
}
columns=
{
props
.
skeletonProps
.
skeletonDesktopColumns
||
[]
}
isLong=
{
props
.
skeletonProps
.
isLongSkeleton
}
isLong=
{
props
.
skeletonProps
.
isLongSkeleton
}
minW=
{
props
.
skeletonProps
.
skeletonDesktopMinW
}
/>
/>
</>
</>
)
}
)
}
...
...
ui/txnBatches/TxnBatchesListItem.tsx
View file @
ed7aa0ec
...
@@ -47,6 +47,7 @@ const TxnBatchesListItem = ({ item }: Props) => {
...
@@ -47,6 +47,7 @@ const TxnBatchesListItem = ({ item }: Props) => {
value
:
(
value
:
(
<
LinkExternal
<
LinkExternal
fontWeight=
{
600
}
fontWeight=
{
600
}
display=
"inline-flex"
href=
{
appConfig
.
L2
.
L1BaseUrl
+
route
({
pathname
:
'
/block/[height]
'
,
query
:
{
height
:
item
.
epoch_number
.
toString
()
}
})
}
href=
{
appConfig
.
L2
.
L1BaseUrl
+
route
({
pathname
:
'
/block/[height]
'
,
query
:
{
height
:
item
.
epoch_number
.
toString
()
}
})
}
>
>
{
item
.
epoch_number
}
{
item
.
epoch_number
}
...
@@ -60,6 +61,7 @@ const TxnBatchesListItem = ({ item }: Props) => {
...
@@ -60,6 +61,7 @@ const TxnBatchesListItem = ({ item }: Props) => {
{
item
.
l1_tx_hashes
.
map
(
hash
=>
(
{
item
.
l1_tx_hashes
.
map
(
hash
=>
(
<
LinkExternal
<
LinkExternal
w=
"100%"
w=
"100%"
display=
"inline-flex"
href=
{
appConfig
.
L2
.
L1BaseUrl
+
route
({
pathname
:
'
/tx/[hash]
'
,
query
:
{
hash
:
hash
}
})
}
href=
{
appConfig
.
L2
.
L1BaseUrl
+
route
({
pathname
:
'
/tx/[hash]
'
,
query
:
{
hash
:
hash
}
})
}
key=
{
hash
}
key=
{
hash
}
>
>
...
...
ui/txnBatches/TxnBatchesTableItem.tsx
View file @
ed7aa0ec
...
@@ -44,6 +44,7 @@ const TxnBatchesTableItem = ({ item }: Props) => {
...
@@ -44,6 +44,7 @@ const TxnBatchesTableItem = ({ item }: Props) => {
href=
{
appConfig
.
L2
.
L1BaseUrl
+
route
({
pathname
:
'
/block/[height]
'
,
query
:
{
height
:
item
.
epoch_number
.
toString
()
}
})
}
href=
{
appConfig
.
L2
.
L1BaseUrl
+
route
({
pathname
:
'
/block/[height]
'
,
query
:
{
height
:
item
.
epoch_number
.
toString
()
}
})
}
fontWeight=
{
600
}
fontWeight=
{
600
}
lineHeight=
"24px"
lineHeight=
"24px"
display=
"inline-flex"
>
>
{
item
.
epoch_number
}
{
item
.
epoch_number
}
</
LinkExternal
>
</
LinkExternal
>
...
@@ -51,7 +52,12 @@ const TxnBatchesTableItem = ({ item }: Props) => {
...
@@ -51,7 +52,12 @@ const TxnBatchesTableItem = ({ item }: Props) => {
<
Td
pr=
{
12
}
>
<
Td
pr=
{
12
}
>
<
VStack
spacing=
{
3
}
>
<
VStack
spacing=
{
3
}
>
{
item
.
l1_tx_hashes
.
map
(
hash
=>
(
{
item
.
l1_tx_hashes
.
map
(
hash
=>
(
<
LinkExternal
w=
"100%"
key=
{
hash
}
href=
{
appConfig
.
L2
.
L1BaseUrl
+
route
({
pathname
:
'
/tx/[hash]
'
,
query
:
{
hash
:
hash
}
})
}
>
<
LinkExternal
w=
"100%"
display=
"inline-flex"
key=
{
hash
}
href=
{
appConfig
.
L2
.
L1BaseUrl
+
route
({
pathname
:
'
/tx/[hash]
'
,
query
:
{
hash
:
hash
}
})
}
>
<
Icon
as=
{
txIcon
}
boxSize=
{
6
}
mr=
{
1
}
/>
<
Icon
as=
{
txIcon
}
boxSize=
{
6
}
mr=
{
1
}
/>
<
Box
w=
"calc(100% - 36px)"
overflow=
"hidden"
whiteSpace=
"nowrap"
><
HashStringShortenDynamic
hash=
{
hash
}
/></
Box
>
<
Box
w=
"calc(100% - 36px)"
overflow=
"hidden"
whiteSpace=
"nowrap"
><
HashStringShortenDynamic
hash=
{
hash
}
/></
Box
>
</
LinkExternal
>
</
LinkExternal
>
...
...
ui/withdrawals/WithdrawalsListItem.tsx
View file @
ed7aa0ec
...
@@ -67,6 +67,7 @@ const WithdrawalsListItem = ({ item }: Props) => {
...
@@ -67,6 +67,7 @@ const WithdrawalsListItem = ({ item }: Props) => {
<
LinkExternal
<
LinkExternal
href=
{
appConfig
.
L2
.
L1BaseUrl
+
route
({
pathname
:
'
/tx/[hash]
'
,
query
:
{
hash
:
item
.
l1_tx_hash
}
})
}
href=
{
appConfig
.
L2
.
L1BaseUrl
+
route
({
pathname
:
'
/tx/[hash]
'
,
query
:
{
hash
:
item
.
l1_tx_hash
}
})
}
w=
"100%"
w=
"100%"
display=
"inline-flex"
overflow=
"hidden"
overflow=
"hidden"
>
>
<
Box
w=
"calc(100% - 16px)"
overflow=
"hidden"
whiteSpace=
"nowrap"
><
HashStringShortenDynamic
hash=
{
item
.
l1_tx_hash
}
/></
Box
>
<
Box
w=
"calc(100% - 16px)"
overflow=
"hidden"
whiteSpace=
"nowrap"
><
HashStringShortenDynamic
hash=
{
item
.
l1_tx_hash
}
/></
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