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
d4612970
Unverified
Commit
d4612970
authored
Jan 06, 2025
by
Igor Stuev
Committed by
GitHub
Jan 06, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Filecoin: display address id instead of hash (#2497)
parent
de43f3dc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
AddressEntity.tsx
ui/shared/entities/address/AddressEntity.tsx
+11
-4
No files found.
ui/shared/entities/address/AddressEntity.tsx
View file @
d4612970
...
@@ -18,6 +18,10 @@ import AddressIdenticon from './AddressIdenticon';
...
@@ -18,6 +18,10 @@ import AddressIdenticon from './AddressIdenticon';
type
LinkProps
=
EntityBase
.
LinkBaseProps
&
Pick
<
EntityProps
,
'
address
'
>
;
type
LinkProps
=
EntityBase
.
LinkBaseProps
&
Pick
<
EntityProps
,
'
address
'
>
;
const
getDisplayedAddress
=
(
address
:
AddressProp
,
altHash
?:
string
)
=>
{
return
address
.
filecoin
?.
robust
??
address
.
filecoin
?.
id
??
altHash
??
address
.
hash
;
};
const
Link
=
chakra
((
props
:
LinkProps
)
=>
{
const
Link
=
chakra
((
props
:
LinkProps
)
=>
{
const
defaultHref
=
route
({
pathname
:
'
/address/[hash]
'
,
query
:
{
...
props
.
query
,
hash
:
props
.
address
.
hash
}
});
const
defaultHref
=
route
({
pathname
:
'
/address/[hash]
'
,
query
:
{
...
props
.
query
,
hash
:
props
.
address
.
hash
}
});
...
@@ -80,7 +84,7 @@ const Icon = (props: IconProps) => {
...
@@ -80,7 +84,7 @@ const Icon = (props: IconProps) => {
<
Flex
marginRight=
{
styles
.
marginRight
}
>
<
Flex
marginRight=
{
styles
.
marginRight
}
>
<
AddressIdenticon
<
AddressIdenticon
size=
{
props
.
size
===
'
lg
'
?
30
:
20
}
size=
{
props
.
size
===
'
lg
'
?
30
:
20
}
hash=
{
props
.
address
.
filecoin
?.
robust
??
props
.
address
.
hash
}
hash=
{
getDisplayedAddress
(
props
.
address
)
}
/>
/>
</
Flex
>
</
Flex
>
);
);
...
@@ -89,6 +93,7 @@ const Icon = (props: IconProps) => {
...
@@ -89,6 +93,7 @@ const Icon = (props: IconProps) => {
export
type
ContentProps
=
Omit
<
EntityBase
.
ContentBaseProps
,
'
text
'
>
&
Pick
<
EntityProps
,
'
address
'
>
&
{
altHash
?:
string
};
export
type
ContentProps
=
Omit
<
EntityBase
.
ContentBaseProps
,
'
text
'
>
&
Pick
<
EntityProps
,
'
address
'
>
&
{
altHash
?:
string
};
const
Content
=
chakra
((
props
:
ContentProps
)
=>
{
const
Content
=
chakra
((
props
:
ContentProps
)
=>
{
const
displayedAddress
=
getDisplayedAddress
(
props
.
address
,
props
.
altHash
);
const
nameTag
=
props
.
address
.
metadata
?.
tags
.
find
(
tag
=>
tag
.
tagType
===
'
name
'
)?.
name
;
const
nameTag
=
props
.
address
.
metadata
?.
tags
.
find
(
tag
=>
tag
.
tagType
===
'
name
'
)?.
name
;
const
nameText
=
nameTag
||
props
.
address
.
ens_domain_name
||
props
.
address
.
name
;
const
nameText
=
nameTag
||
props
.
address
.
ens_domain_name
||
props
.
address
.
name
;
...
@@ -102,7 +107,9 @@ const Content = chakra((props: ContentProps) => {
...
@@ -102,7 +107,9 @@ const Content = chakra((props: ContentProps) => {
const
label
=
(
const
label
=
(
<
VStack
gap=
{
0
}
py=
{
1
}
color=
"inherit"
>
<
VStack
gap=
{
0
}
py=
{
1
}
color=
"inherit"
>
<
Box
fontWeight=
{
600
}
whiteSpace=
"pre-wrap"
wordBreak=
"break-word"
>
{
nameText
}
</
Box
>
<
Box
fontWeight=
{
600
}
whiteSpace=
"pre-wrap"
wordBreak=
"break-word"
>
{
nameText
}
</
Box
>
<
Box
whiteSpace=
"pre-wrap"
wordBreak=
"break-word"
>
{
props
.
address
.
filecoin
?.
robust
??
props
.
altHash
??
props
.
address
.
hash
}
</
Box
>
<
Box
whiteSpace=
"pre-wrap"
wordBreak=
"break-word"
>
{
displayedAddress
}
</
Box
>
</
VStack
>
</
VStack
>
);
);
...
@@ -118,7 +125,7 @@ const Content = chakra((props: ContentProps) => {
...
@@ -118,7 +125,7 @@ const Content = chakra((props: ContentProps) => {
return
(
return
(
<
EntityBase
.
Content
<
EntityBase
.
Content
{
...
props
}
{
...
props
}
text=
{
props
.
address
.
filecoin
?.
robust
??
props
.
altHash
??
props
.
address
.
hash
}
text=
{
displayedAddress
}
/>
/>
);
);
});
});
...
@@ -129,7 +136,7 @@ const Copy = (props: CopyProps) => {
...
@@ -129,7 +136,7 @@ const Copy = (props: CopyProps) => {
return
(
return
(
<
EntityBase
.
Copy
<
EntityBase
.
Copy
{
...
props
}
{
...
props
}
text=
{
props
.
address
.
filecoin
?.
robust
??
props
.
altHash
??
props
.
address
.
hash
}
text=
{
getDisplayedAddress
(
props
.
address
,
props
.
altHash
)
}
/>
/>
);
);
};
};
...
...
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