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
0678c5aa
Commit
0678c5aa
authored
May 10, 2023
by
isstuev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
withdrawals counters
parent
3af8cc19
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
62 additions
and
13 deletions
+62
-13
resources.ts
lib/api/resources.ts
+5
-1
withdrawals.ts
mocks/withdrawals/withdrawals.ts
+3
-3
withdrawals.ts
types/api/withdrawals.ts
+5
-0
Withdrawals.pw.tsx
ui/pages/Withdrawals.pw.tsx
+6
-0
Withdrawals.tsx
ui/pages/Withdrawals.tsx
+43
-9
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
No files found.
lib/api/resources.ts
View file @
0678c5aa
...
...
@@ -43,7 +43,7 @@ import type { TransactionsResponseValidated, TransactionsResponsePending, Transa
import
type
{
TTxsFilters
}
from
'
types/api/txsFilters
'
;
import
type
{
TxStateChanges
}
from
'
types/api/txStateChanges
'
;
import
type
{
VisualizedContract
}
from
'
types/api/visualization
'
;
import
type
{
WithdrawalsResponse
}
from
'
types/api/withdrawals
'
;
import
type
{
WithdrawalsResponse
,
WithdrawalsCounters
}
from
'
types/api/withdrawals
'
;
import
type
{
ArrayElement
}
from
'
types/utils
'
;
import
appConfig
from
'
configs/app/config
'
;
...
...
@@ -180,6 +180,9 @@ export const RESOURCES = {
paginationFields
:
[
'
index
'
as
const
,
'
items_count
'
as
const
],
filterFields
:
[],
},
withdrawals_counters
:
{
path
:
'
/api/v2/withdrawals/counters
'
,
},
// ADDRESSES
addresses
:
{
...
...
@@ -569,6 +572,7 @@ Q extends 'verified_contracts_counters' ? VerifiedContractsCounters :
Q
extends
'
visualize_sol2uml
'
?
VisualizedContract
:
Q
extends
'
contract_verification_config
'
?
SmartContractVerificationConfig
:
Q
extends
'
withdrawals
'
?
WithdrawalsResponse
:
Q
extends
'
withdrawals_counters
'
?
WithdrawalsCounters
:
Q
extends
'
l2_output_roots
'
?
L2OutputRootsResponse
:
Q
extends
'
l2_withdrawals
'
?
L2WithdrawalsResponse
:
Q
extends
'
l2_deposits
'
?
L2DepositsResponse
:
...
...
mocks/withdrawals/withdrawals.ts
View file @
0678c5aa
export
const
data
=
{
items
:
[
{
amount
:
'
192175
'
,
amount
:
'
192175
000000000
'
,
block_number
:
43242
,
index
:
11688
,
receiver
:
{
...
...
@@ -15,7 +15,7 @@ export const data = {
validator_index
:
49622
,
},
{
amount
:
'
192175
'
,
amount
:
'
192175
000000000
'
,
block_number
:
43242
,
index
:
11687
,
receiver
:
{
...
...
@@ -29,7 +29,7 @@ export const data = {
validator_index
:
49621
,
},
{
amount
:
'
182773
'
,
amount
:
'
182773
000000000
'
,
block_number
:
43242
,
index
:
11686
,
receiver
:
{
...
...
types/api/withdrawals.ts
View file @
0678c5aa
...
...
@@ -16,3 +16,8 @@ export type WithdrawalsItem = {
timestamp
:
string
;
validator_index
:
number
;
}
export
type
WithdrawalsCounters
=
{
withdrawal_count
:
string
;
withdrawal_sum
:
string
;
}
ui/pages/Withdrawals.pw.tsx
View file @
0678c5aa
...
...
@@ -8,6 +8,7 @@ import buildApiUrl from 'playwright/utils/buildApiUrl';
import
Withdrawals
from
'
./Withdrawals
'
;
const
WITHDRAWALS_API_URL
=
buildApiUrl
(
'
withdrawals
'
);
const
WITHDRAWALS_COUNTERS_API_URL
=
buildApiUrl
(
'
withdrawals_counters
'
);
test
(
'
base view +@mobile
'
,
async
({
mount
,
page
})
=>
{
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 }) => {
body
:
JSON
.
stringify
(
withdrawalsData
),
}));
await
page
.
route
(
WITHDRAWALS_COUNTERS_API_URL
,
(
route
)
=>
route
.
fulfill
({
status
:
200
,
body
:
JSON
.
stringify
({
withdrawal_count
:
'
111111
'
,
withdrawal_sum
:
'
1010101010110101001101010
'
}),
}));
const
component
=
await
mount
(
<
TestApp
>
<
Withdrawals
/>
...
...
ui/pages/Withdrawals.tsx
View file @
0678c5aa
import
{
Flex
,
Hide
,
Show
}
from
'
@chakra-ui/react
'
;
import
{
Flex
,
Hide
,
Show
,
Skeleton
,
Text
}
from
'
@chakra-ui/react
'
;
import
BigNumber
from
'
bignumber.js
'
;
import
React
from
'
react
'
;
import
useApiQuery
from
'
lib/api/useApiQuery
'
;
import
getCurrencyValue
from
'
lib/getCurrencyValue
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
useQueryWithPages
from
'
lib/hooks/useQueryWithPages
'
;
import
ActionBar
from
'
ui/shared/ActionBar
'
;
...
...
@@ -18,6 +21,8 @@ const Withdrawals = () => {
resourceName
:
'
withdrawals
'
,
});
const
countersQuery
=
useApiQuery
(
'
withdrawals_counters
'
);
const
content
=
data
?.
items
?
(
<>
<
Show
below=
"lg"
ssr=
{
false
}
>
{
data
.
items
.
map
((
item
=>
<
WithdrawalsListItem
key=
{
item
.
index
}
item=
{
item
}
view=
"list"
/>))
}
</
Show
>
...
...
@@ -25,14 +30,43 @@ const Withdrawals = () => {
</>
)
:
null
;
const
actionBar
=
isPaginationVisible
?
(
const
text
=
(()
=>
{
if
(
countersQuery
.
isLoading
)
{
return
(
<
Skeleton
w=
{
{
base
:
'
100%
'
,
lg
:
'
320px
'
}
}
h=
"24px"
mb=
{
{
base
:
6
,
lg
:
isPaginationVisible
?
0
:
7
}
}
mt=
{
{
base
:
0
,
lg
:
isPaginationVisible
?
0
:
7
}
}
/>
);
}
if
(
countersQuery
.
isError
)
{
return
null
;
}
const
{
valueStr
}
=
getCurrencyValue
({
value
:
countersQuery
.
data
.
withdrawal_sum
});
return
(
<
Text
mb=
{
{
base
:
6
,
lg
:
isPaginationVisible
?
0
:
6
}
}
lineHeight=
{
{
base
:
'
24px
'
,
lg
:
'
32px
'
}
}
>
{
BigNumber
(
countersQuery
.
data
.
withdrawal_count
).
toFormat
()
}
withdrawals processed and
{
valueStr
}
ETH withdrawn
</
Text
>
);
})();
const
actionBar
=
(
<>
{
(
isMobile
||
!
isPaginationVisible
)
&&
text
}
{
isPaginationVisible
&&
(
<
ActionBar
mt=
{
-
6
}
>
<
Flex
alignItems=
"center"
justifyContent=
"space-between"
w=
"100%"
>
{
!
isMobile
}
{
!
isMobile
&&
text
}
<
Pagination
ml=
"auto"
{
...
pagination
}
/>
</
Flex
>
</
ActionBar
>
)
:
null
;
)
}
</>
);
return
(
<
Page
>
...
...
ui/pages/__screenshots__/Withdrawals.pw.tsx_default_base-view-mobile-1.png
View replaced file @
3af8cc19
View file @
0678c5aa
32.9 KB
|
W:
|
H:
35.7 KB
|
W:
|
H:
2-up
Swipe
Onion skin
ui/pages/__screenshots__/Withdrawals.pw.tsx_mobile_base-view-mobile-1.png
View replaced file @
3af8cc19
View file @
0678c5aa
55.6 KB
|
W:
|
H:
59.6 KB
|
W:
|
H:
2-up
Swipe
Onion skin
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