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
aee48c7c
Commit
aee48c7c
authored
Jan 05, 2023
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add scroll to tabs
parent
0c8f6120
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
8 deletions
+17
-8
AddressDetails.tsx
ui/address/AddressDetails.tsx
+13
-5
AddressCounterItem.tsx
ui/address/details/AddressCounterItem.tsx
+3
-2
Address.tsx
ui/pages/Address.tsx
+1
-1
No files found.
ui/address/AddressDetails.tsx
View file @
aee48c7c
...
@@ -29,9 +29,10 @@ import TokenSelect from './tokenSelect/TokenSelect';
...
@@ -29,9 +29,10 @@ import TokenSelect from './tokenSelect/TokenSelect';
interface
Props
{
interface
Props
{
addressQuery
:
UseQueryResult
<
TAddress
>
;
addressQuery
:
UseQueryResult
<
TAddress
>
;
scrollRef
?:
React
.
RefObject
<
HTMLDivElement
>
;
}
}
const
AddressDetails
=
({
addressQuery
}:
Props
)
=>
{
const
AddressDetails
=
({
addressQuery
,
scrollRef
}:
Props
)
=>
{
const
router
=
useRouter
();
const
router
=
useRouter
();
const
isMobile
=
useIsMobile
();
const
isMobile
=
useIsMobile
();
...
@@ -42,6 +43,13 @@ const AddressDetails = ({ addressQuery }: Props) => {
...
@@ -42,6 +43,13 @@ const AddressDetails = ({ addressQuery }: Props) => {
},
},
});
});
const
handleCounterItemClick
=
React
.
useCallback
(()
=>
{
window
.
setTimeout
(()
=>
{
// cannot do scroll instantly, have to wait a little
scrollRef
?.
current
?.
scrollIntoView
({
behavior
:
'
smooth
'
});
},
500
);
},
[
scrollRef
]);
if
(
addressQuery
.
isError
)
{
if
(
addressQuery
.
isError
)
{
throw
Error
(
'
Address fetch error
'
,
{
cause
:
addressQuery
.
error
as
unknown
as
Error
});
throw
Error
(
'
Address fetch error
'
,
{
cause
:
addressQuery
.
error
as
unknown
as
Error
});
}
}
...
@@ -111,28 +119,28 @@ const AddressDetails = ({ addressQuery }: Props) => {
...
@@ -111,28 +119,28 @@ const AddressDetails = ({ addressQuery }: Props) => {
title=
"Transactions"
title=
"Transactions"
hint=
"Number of transactions related to this address."
hint=
"Number of transactions related to this address."
>
>
<
AddressCounterItem
prop=
"transactions_count"
query=
{
countersQuery
}
address=
{
addressQuery
.
data
.
hash
}
/>
<
AddressCounterItem
prop=
"transactions_count"
query=
{
countersQuery
}
address=
{
addressQuery
.
data
.
hash
}
onClick=
{
handleCounterItemClick
}
/>
</
DetailsInfoItem
>
</
DetailsInfoItem
>
{
addressQuery
.
data
.
has_token_transfers
&&
(
{
addressQuery
.
data
.
has_token_transfers
&&
(
<
DetailsInfoItem
<
DetailsInfoItem
title=
"Transfers"
title=
"Transfers"
hint=
"Number of transfers to/from this address."
hint=
"Number of transfers to/from this address."
>
>
<
AddressCounterItem
prop=
"token_transfers_count"
query=
{
countersQuery
}
address=
{
addressQuery
.
data
.
hash
}
/>
<
AddressCounterItem
prop=
"token_transfers_count"
query=
{
countersQuery
}
address=
{
addressQuery
.
data
.
hash
}
onClick=
{
handleCounterItemClick
}
/>
</
DetailsInfoItem
>
</
DetailsInfoItem
>
)
}
)
}
<
DetailsInfoItem
<
DetailsInfoItem
title=
"Gas used"
title=
"Gas used"
hint=
"Gas used by the address."
hint=
"Gas used by the address."
>
>
<
AddressCounterItem
prop=
"gas_usage_count"
query=
{
countersQuery
}
address=
{
addressQuery
.
data
.
hash
}
/>
<
AddressCounterItem
prop=
"gas_usage_count"
query=
{
countersQuery
}
address=
{
addressQuery
.
data
.
hash
}
onClick=
{
handleCounterItemClick
}
/>
</
DetailsInfoItem
>
</
DetailsInfoItem
>
{
addressQuery
.
data
.
has_validated_blocks
&&
(
{
addressQuery
.
data
.
has_validated_blocks
&&
(
<
DetailsInfoItem
<
DetailsInfoItem
title=
"Blocks validated"
title=
"Blocks validated"
hint=
"Number of blocks validated by this validator."
hint=
"Number of blocks validated by this validator."
>
>
<
AddressCounterItem
prop=
"validations_count"
query=
{
countersQuery
}
address=
{
addressQuery
.
data
.
hash
}
/>
<
AddressCounterItem
prop=
"validations_count"
query=
{
countersQuery
}
address=
{
addressQuery
.
data
.
hash
}
onClick=
{
handleCounterItemClick
}
/>
</
DetailsInfoItem
>
</
DetailsInfoItem
>
)
}
)
}
{
addressQuery
.
data
.
block_number_balance_updated_at
&&
(
{
addressQuery
.
data
.
block_number_balance_updated_at
&&
(
...
...
ui/address/details/AddressCounterItem.tsx
View file @
aee48c7c
...
@@ -12,6 +12,7 @@ interface Props {
...
@@ -12,6 +12,7 @@ interface Props {
prop
:
keyof
AddressCounters
;
prop
:
keyof
AddressCounters
;
query
:
UseQueryResult
<
AddressCounters
>
;
query
:
UseQueryResult
<
AddressCounters
>
;
address
:
string
;
address
:
string
;
onClick
:
()
=>
void
;
}
}
const
PROP_TO_TAB
=
{
const
PROP_TO_TAB
=
{
...
@@ -20,7 +21,7 @@ const PROP_TO_TAB = {
...
@@ -20,7 +21,7 @@ const PROP_TO_TAB = {
validations_count
:
'
blocks_validated
'
,
validations_count
:
'
blocks_validated
'
,
};
};
const
AddressCounterItem
=
({
prop
,
query
,
address
}:
Props
)
=>
{
const
AddressCounterItem
=
({
prop
,
query
,
address
,
onClick
}:
Props
)
=>
{
if
(
query
.
isLoading
)
{
if
(
query
.
isLoading
)
{
return
<
Skeleton
h=
{
5
}
w=
"80px"
borderRadius=
"full"
/>;
return
<
Skeleton
h=
{
5
}
w=
"80px"
borderRadius=
"full"
/>;
}
}
...
@@ -42,7 +43,7 @@ const AddressCounterItem = ({ prop, query, address }: Props) => {
...
@@ -42,7 +43,7 @@ const AddressCounterItem = ({ prop, query, address }: Props) => {
}
}
return
(
return
(
<
NextLink
href=
{
link
(
'
address_index
'
,
{
id
:
address
},
{
tab
:
PROP_TO_TAB
[
prop
]
})
}
passHref
>
<
NextLink
href=
{
link
(
'
address_index
'
,
{
id
:
address
},
{
tab
:
PROP_TO_TAB
[
prop
]
})
}
passHref
>
<
Link
>
<
Link
onClick=
{
onClick
}
>
{
Number
(
data
).
toLocaleString
()
}
{
Number
(
data
).
toLocaleString
()
}
</
Link
>
</
Link
>
</
NextLink
>
</
NextLink
>
...
...
ui/pages/Address.tsx
View file @
aee48c7c
...
@@ -99,7 +99,7 @@ const AddressPageContent = () => {
...
@@ -99,7 +99,7 @@ const AddressPageContent = () => {
additionals=
{
tagsNode
}
additionals=
{
tagsNode
}
/>
/>
)
}
)
}
<
AddressDetails
addressQuery=
{
addressQuery
}
/>
<
AddressDetails
addressQuery=
{
addressQuery
}
scrollRef=
{
tabsScrollRef
}
/>
{
/* should stay before tabs to scroll up whith pagination */
}
{
/* should stay before tabs to scroll up whith pagination */
}
<
Box
ref=
{
tabsScrollRef
}
></
Box
>
<
Box
ref=
{
tabsScrollRef
}
></
Box
>
{
addressQuery
.
isLoading
?
<
SkeletonTabs
/>
:
<
RoutedTabs
tabs=
{
tabs
}
tabListProps=
{
{
mt
:
8
}
}
/>
}
{
addressQuery
.
isLoading
?
<
SkeletonTabs
/>
:
<
RoutedTabs
tabs=
{
tabs
}
tabListProps=
{
{
mt
:
8
}
}
/>
}
...
...
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