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
5d6fd12d
Unverified
Commit
5d6fd12d
authored
Oct 17, 2024
by
Igor Stuev
Committed by
GitHub
Oct 17, 2024
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2289 from blockscout/fe-2236
Public tags: improvement batch
parents
391b20fe
b9ace387
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
38 additions
and
28 deletions
+38
-28
address.ts
mocks/metadata/address.ts
+11
-0
AddressMetadataAlert.pw.tsx
ui/address/details/AddressMetadataAlert.pw.tsx
+1
-1
AddressMetadataAlert.tsx
ui/address/details/AddressMetadataAlert.tsx
+24
-25
AddressMetadataAlert.pw.tsx_default_base-view-1.png
...ots__/AddressMetadataAlert.pw.tsx_default_base-view-1.png
+0
-0
Address.tsx
ui/pages/Address.tsx
+1
-1
EntityTags.tsx
ui/shared/EntityTags/EntityTags.tsx
+1
-1
No files found.
mocks/metadata/address.ts
View file @
5d6fd12d
...
...
@@ -102,3 +102,14 @@ export const noteTag: AddressMetadataTagApi = {
data
:
'
<b>Warning!</b> This is scam! See the <a href="https://example.com" target="_blank">report</a>
'
,
},
};
export
const
noteTag2
:
AddressMetadataTagApi
=
{
slug
:
'
note0
'
,
name
:
'
note_0
'
,
tagType
:
'
note
'
,
ordinal
:
0
,
meta
:
{
alertStatus
:
'
info
'
,
data
:
'
The token MILF was launched on May 13, 2021. The maximum total supply of the token is 100 billion.
'
,
},
};
ui/address/details/AddressMetadataAlert.pw.tsx
View file @
5d6fd12d
...
...
@@ -6,7 +6,7 @@ import { test, expect } from 'playwright/lib';
import
AddressMetadataAlert
from
'
./AddressMetadataAlert
'
;
test
(
'
base view
'
,
async
({
render
})
=>
{
const
component
=
await
render
(<
AddressMetadataAlert
tags=
{
[
metadataMock
.
noteTag
]
}
/>);
const
component
=
await
render
(<
AddressMetadataAlert
tags=
{
[
metadataMock
.
noteTag
,
metadataMock
.
noteTag2
]
}
/>);
await
expect
(
component
).
toHaveScreenshot
();
});
ui/address/details/AddressMetadataAlert.tsx
View file @
5d6fd12d
import
{
Alert
,
chakra
}
from
'
@chakra-ui/react
'
;
import
{
Alert
,
Flex
,
chakra
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
type
{
AddressMetadataTagFormatted
}
from
'
types/client/addressMetadata
'
;
...
...
@@ -9,35 +9,34 @@ interface Props {
}
const
AddressMetadataAlert
=
({
tags
,
className
}:
Props
)
=>
{
const
noteTag
=
tags
?.
find
(({
tagType
})
=>
tagType
===
'
note
'
);
if
(
!
noteTag
)
{
return
null
;
}
const
content
=
noteTag
.
meta
?.
data
;
const
noteTags
=
tags
?.
filter
(({
tagType
})
=>
tagType
===
'
note
'
).
filter
(({
meta
})
=>
meta
?.
data
);
if
(
!
content
)
{
if
(
!
noteTags
?.
length
)
{
return
null
;
}
return
(
<
Alert
className=
{
className
}
status=
{
noteTag
.
meta
?.
alertStatus
??
'
error
'
}
bgColor=
{
noteTag
.
meta
?.
alertBgColor
}
color=
{
noteTag
.
meta
?.
alertTextColor
}
whiteSpace=
"pre-wrap"
display=
"inline-block"
sx=
{
{
'
& a
'
:
{
color
:
'
link
'
,
_hover
:
{
color
:
'
link_hovered
'
,
},
},
}
}
dangerouslySetInnerHTML=
{
{
__html
:
content
}
}
/>
<
Flex
flexDir=
"column"
gap=
{
3
}
className=
{
className
}
>
{
noteTags
.
map
((
noteTag
)
=>
(
<
Alert
key=
{
noteTag
.
name
}
status=
{
noteTag
.
meta
?.
alertStatus
??
'
error
'
}
bgColor=
{
noteTag
.
meta
?.
alertBgColor
}
color=
{
noteTag
.
meta
?.
alertTextColor
}
whiteSpace=
"pre-wrap"
display=
"inline-block"
sx=
{
{
'
& a
'
:
{
color
:
'
link
'
,
_hover
:
{
color
:
'
link_hovered
'
,
},
},
}
}
dangerouslySetInnerHTML=
{
{
__html
:
noteTag
.
meta
?.
data
??
''
}
}
/>
))
}
</
Flex
>
);
};
...
...
ui/address/details/__screenshots__/AddressMetadataAlert.pw.tsx_default_base-view-1.png
View replaced file @
391b20fe
View file @
5d6fd12d
4.37 KB
|
W:
|
H:
10.1 KB
|
W:
|
H:
2-up
Swipe
Onion skin
ui/pages/Address.tsx
View file @
5d6fd12d
...
...
@@ -282,7 +282,7 @@ const AddressPageContent = () => {
{ slug: 'mud', name: 'MUD World', tagType: 'custom' as const, ordinal: -10 } :
undefined,
...formatUserTags(addressQuery.data),
...(addressMetadataQuery.data?.addresses?.[hash.toLowerCase()]?.tags || []),
...(addressMetadataQuery.data?.addresses?.[hash.toLowerCase()]?.tags
.filter(tag => tag.tagType !== 'note')
|| []),
].filter(Boolean).sort(sortEntityTags);
}, [ addressMetadataQuery.data, addressQuery.data, hash, isSafeAddress, userOpsAccountQuery.data, mudTablesCountQuery.data, usernameApiTag ]);
...
...
ui/shared/EntityTags/EntityTags.tsx
View file @
5d6fd12d
...
...
@@ -45,7 +45,7 @@ const EntityTags = ({ tags, className, isLoading }: Props) => {
+
{
tags
.
length
-
visibleNum
}
</
Tag
>
</
PopoverTrigger
>
<
PopoverContent
w=
"300px
"
>
<
PopoverContent
maxW=
"300px"
w=
"auto
"
>
<
PopoverBody
>
<
Flex
columnGap=
{
2
}
rowGap=
{
2
}
flexWrap=
"wrap"
>
{
tags
.
slice
(
visibleNum
).
map
((
tag
)
=>
<
EntityTag
key=
{
tag
.
slug
}
data=
{
tag
}
/>)
}
...
...
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