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
4f84209a
Commit
4f84209a
authored
May 09, 2023
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
explorers on address page
parent
b9935be6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
15 deletions
+5
-15
AddressDetails.tsx
ui/address/AddressDetails.tsx
+3
-13
NetworkExplorers.tsx
ui/shared/NetworkExplorers.tsx
+2
-2
No files found.
ui/address/AddressDetails.tsx
View file @
4f84209a
import
{
Box
,
Flex
,
Text
,
Icon
,
Grid
}
from
'
@chakra-ui/react
'
;
import
{
Box
,
Text
,
Icon
,
Grid
}
from
'
@chakra-ui/react
'
;
import
type
{
UseQueryResult
}
from
'
@tanstack/react-query
'
;
import
type
{
UseQueryResult
}
from
'
@tanstack/react-query
'
;
import
{
useRouter
}
from
'
next/router
'
;
import
{
useRouter
}
from
'
next/router
'
;
import
{
route
}
from
'
nextjs-routes
'
;
import
{
route
}
from
'
nextjs-routes
'
;
...
@@ -6,7 +6,6 @@ import React from 'react';
...
@@ -6,7 +6,6 @@ import React from 'react';
import
type
{
Address
as
TAddress
}
from
'
types/api/address
'
;
import
type
{
Address
as
TAddress
}
from
'
types/api/address
'
;
import
appConfig
from
'
configs/app/config
'
;
import
blockIcon
from
'
icons/block.svg
'
;
import
blockIcon
from
'
icons/block.svg
'
;
import
type
{
ResourceError
}
from
'
lib/api/resources
'
;
import
type
{
ResourceError
}
from
'
lib/api/resources
'
;
import
useApiQuery
from
'
lib/api/useApiQuery
'
;
import
useApiQuery
from
'
lib/api/useApiQuery
'
;
...
@@ -18,8 +17,8 @@ import DataFetchAlert from 'ui/shared/DataFetchAlert';
...
@@ -18,8 +17,8 @@ import DataFetchAlert from 'ui/shared/DataFetchAlert';
import
DetailsInfoItem
from
'
ui/shared/DetailsInfoItem
'
;
import
DetailsInfoItem
from
'
ui/shared/DetailsInfoItem
'
;
import
DetailsSponsoredItem
from
'
ui/shared/DetailsSponsoredItem
'
;
import
DetailsSponsoredItem
from
'
ui/shared/DetailsSponsoredItem
'
;
import
HashStringShortenDynamic
from
'
ui/shared/HashStringShortenDynamic
'
;
import
HashStringShortenDynamic
from
'
ui/shared/HashStringShortenDynamic
'
;
import
LinkExternal
from
'
ui/shared/LinkExternal
'
;
import
LinkInternal
from
'
ui/shared/LinkInternal
'
;
import
LinkInternal
from
'
ui/shared/LinkInternal
'
;
import
NetworkExplorers
from
'
ui/shared/NetworkExplorers
'
;
import
AddressBalance
from
'
./details/AddressBalance
'
;
import
AddressBalance
from
'
./details/AddressBalance
'
;
import
AddressDetailsSkeleton
from
'
./details/AddressDetailsSkeleton
'
;
import
AddressDetailsSkeleton
from
'
./details/AddressDetailsSkeleton
'
;
...
@@ -83,21 +82,12 @@ const AddressDetails = ({ addressQuery, scrollRef }: Props) => {
...
@@ -83,21 +82,12 @@ const AddressDetails = ({ addressQuery, scrollRef }: Props) => {
return
<
AddressDetailsSkeleton
/>;
return
<
AddressDetailsSkeleton
/>;
}
}
const
explorers
=
appConfig
.
network
.
explorers
.
filter
(({
paths
})
=>
paths
.
address
);
const
data
=
addressQuery
.
isError
?
errorData
:
addressQuery
.
data
;
const
data
=
addressQuery
.
isError
?
errorData
:
addressQuery
.
data
;
return
(
return
(
<
Box
>
<
Box
>
<
AddressHeadingInfo
address=
{
data
}
token=
{
data
.
token
}
isLinkDisabled
/>
<
AddressHeadingInfo
address=
{
data
}
token=
{
data
.
token
}
isLinkDisabled
/>
{
explorers
.
length
>
0
&&
(
<
NetworkExplorers
mt=
{
8
}
type=
"address"
pathParam=
{
addressHash
}
/>
<
Flex
mt=
{
8
}
columnGap=
{
4
}
flexWrap=
"wrap"
>
<
Text
fontSize=
"sm"
>
Verify with other explorers
</
Text
>
{
explorers
.
map
((
explorer
)
=>
{
const
url
=
new
URL
(
explorer
.
paths
.
address
+
'
/
'
+
addressHash
,
explorer
.
baseUrl
);
return
<
LinkExternal
key=
{
explorer
.
baseUrl
}
href=
{
url
.
toString
()
}
>
{
explorer
.
title
}
</
LinkExternal
>;
})
}
</
Flex
>
)
}
<
Grid
<
Grid
mt=
{
8
}
mt=
{
8
}
columnGap=
{
8
}
columnGap=
{
8
}
...
...
ui/shared/NetworkExplorers.tsx
View file @
4f84209a
...
@@ -3,9 +3,9 @@ import React from 'react';
...
@@ -3,9 +3,9 @@ import React from 'react';
import
type
{
NetworkExplorer
as
TNetworkExplorer
}
from
'
types/networks
'
;
import
type
{
NetworkExplorer
as
TNetworkExplorer
}
from
'
types/networks
'
;
import
appConfig
from
'
configs/app/config
'
;
import
arrowIcon
from
'
icons/arrows/east-mini.svg
'
;
import
arrowIcon
from
'
icons/arrows/east-mini.svg
'
;
import
searchIcon
from
'
icons/search.svg
'
;
import
searchIcon
from
'
icons/search.svg
'
;
import
networkExplorers
from
'
lib/networks/networkExplorers
'
;
import
LinkExternal
from
'
ui/shared/LinkExternal
'
;
import
LinkExternal
from
'
ui/shared/LinkExternal
'
;
interface
Props
{
interface
Props
{
...
@@ -17,7 +17,7 @@ interface Props {
...
@@ -17,7 +17,7 @@ interface Props {
const
NetworkExplorers
=
({
className
,
type
,
pathParam
}:
Props
)
=>
{
const
NetworkExplorers
=
({
className
,
type
,
pathParam
}:
Props
)
=>
{
const
{
isOpen
,
onToggle
,
onClose
}
=
useDisclosure
();
const
{
isOpen
,
onToggle
,
onClose
}
=
useDisclosure
();
const
explorersLinks
=
networkE
xplorers
const
explorersLinks
=
appConfig
.
network
.
e
xplorers
.
filter
((
explorer
)
=>
explorer
.
paths
[
type
])
.
filter
((
explorer
)
=>
explorer
.
paths
[
type
])
.
map
((
explorer
)
=>
{
.
map
((
explorer
)
=>
{
const
url
=
new
URL
(
explorer
.
paths
[
type
]
+
'
/
'
+
pathParam
,
explorer
.
baseUrl
);
const
url
=
new
URL
(
explorer
.
paths
[
type
]
+
'
/
'
+
pathParam
,
explorer
.
baseUrl
);
...
...
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