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
5c1ecb32
Unverified
Commit
5c1ecb32
authored
Aug 28, 2024
by
tom goriunov
Committed by
GitHub
Aug 28, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Metadata: show Notes (#2191)
Fixes #2174
parent
18eb8120
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
78 additions
and
1 deletion
+78
-1
parseMetaPayload.ts
lib/address/parseMetaPayload.ts
+3
-0
address.ts
mocks/metadata/address.ts
+12
-0
Alert.ts
theme/components/Alert/Alert.ts
+1
-1
addressMetadata.ts
types/api/addressMetadata.ts
+3
-0
AddressMetadataAlert.pw.tsx
ui/address/details/AddressMetadataAlert.pw.tsx
+13
-0
AddressMetadataAlert.tsx
ui/address/details/AddressMetadataAlert.tsx
+43
-0
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
+3
-0
No files found.
lib/address/parseMetaPayload.ts
View file @
5c1ecb32
...
@@ -27,6 +27,9 @@ export default function parseMetaPayload(meta: AddressMetadataTag['meta']): Addr
...
@@ -27,6 +27,9 @@ export default function parseMetaPayload(meta: AddressMetadataTag['meta']): Addr
'
appLogoURL
'
,
'
appLogoURL
'
,
'
appActionButtonText
'
,
'
appActionButtonText
'
,
'
warpcastHandle
'
,
'
warpcastHandle
'
,
'
data
'
,
'
alertBgColor
'
,
'
alertTextColor
'
,
];
];
for
(
const
stringField
of
stringFields
)
{
for
(
const
stringField
of
stringFields
)
{
...
...
mocks/metadata/address.ts
View file @
5c1ecb32
...
@@ -90,3 +90,15 @@ export const warpcastTag: AddressMetadataTagApi = {
...
@@ -90,3 +90,15 @@ export const warpcastTag: AddressMetadataTagApi = {
warpcastHandle
:
'
duckYduck
'
,
warpcastHandle
:
'
duckYduck
'
,
},
},
};
};
export
const
noteTag
:
AddressMetadataTagApi
=
{
slug
:
'
scam-tag
'
,
name
:
'
Phish 🐟
'
,
tagType
:
'
note
'
,
ordinal
:
100
,
meta
:
{
alertBgColor
:
'
deeppink
'
,
alertTextColor
:
'
white
'
,
data
:
'
<b>Warning!</b> This is scam! See the <a href="https://example.com" target="_blank">report</a>
'
,
},
};
theme/components/Alert/Alert.ts
View file @
5c1ecb32
...
@@ -13,7 +13,7 @@ function getBg(props: StyleFunctionProps) {
...
@@ -13,7 +13,7 @@ function getBg(props: StyleFunctionProps) {
const
{
theme
,
colorScheme
:
c
}
=
props
;
const
{
theme
,
colorScheme
:
c
}
=
props
;
const
darkBg
=
transparentize
(
`
${
c
}
.200`
,
0.16
)(
theme
);
const
darkBg
=
transparentize
(
`
${
c
}
.200`
,
0.16
)(
theme
);
return
{
return
{
light
:
`colors.
${
c
}
.
${
c
===
'
red
'
?
'
50
'
:
'
100
'
}
`
,
light
:
`colors.
${
c
}
.
100
`
,
dark
:
darkBg
,
dark
:
darkBg
,
};
};
}
}
...
...
types/api/addressMetadata.ts
View file @
5c1ecb32
...
@@ -32,6 +32,9 @@ export interface AddressMetadataTagApi extends Omit<AddressMetadataTag, 'meta'>
...
@@ -32,6 +32,9 @@ export interface AddressMetadataTagApi extends Omit<AddressMetadataTag, 'meta'>
appLogoURL
?:
string
;
appLogoURL
?:
string
;
appActionButtonText
?:
string
;
appActionButtonText
?:
string
;
warpcastHandle
?:
string
;
warpcastHandle
?:
string
;
data
?:
string
;
alertBgColor
?:
string
;
alertTextColor
?:
string
;
}
|
null
;
}
|
null
;
}
}
...
...
ui/address/details/AddressMetadataAlert.pw.tsx
0 → 100644
View file @
5c1ecb32
import
{
Box
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
*
as
metadataMock
from
'
mocks/metadata/address
'
;
import
{
test
,
expect
}
from
'
playwright/lib
'
;
import
AddressMetadataAlert
from
'
./AddressMetadataAlert
'
;
test
(
'
base view
'
,
async
({
render
})
=>
{
const
component
=
await
render
(<
Box
mt=
{
1
}
><
AddressMetadataAlert
tags=
{
[
metadataMock
.
noteTag
]
}
/></
Box
>);
await
expect
(
component
).
toHaveScreenshot
();
});
ui/address/details/AddressMetadataAlert.tsx
0 → 100644
View file @
5c1ecb32
import
{
Alert
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
type
{
AddressMetadataTagFormatted
}
from
'
types/client/addressMetadata
'
;
interface
Props
{
tags
:
Array
<
AddressMetadataTagFormatted
>
|
undefined
;
}
const
AddressMetadataAlert
=
({
tags
}:
Props
)
=>
{
const
noteTag
=
tags
?.
find
(({
tagType
})
=>
tagType
===
'
note
'
);
if
(
!
noteTag
)
{
return
null
;
}
const
content
=
noteTag
.
meta
?.
data
;
if
(
!
content
)
{
return
null
;
}
return
(
<
Alert
mt=
"-4px"
mb=
{
6
}
status=
"error"
bgColor=
{
noteTag
.
meta
?.
alertBgColor
}
color=
{
noteTag
.
meta
?.
alertTextColor
}
whiteSpace=
"pre-wrap"
sx=
{
{
'
& a
'
:
{
color
:
'
link
'
,
_hover
:
{
color
:
'
link_hovered
'
,
},
},
}
}
dangerouslySetInnerHTML=
{
{
__html
:
content
}
}
/>
);
};
export
default
React
.
memo
(
AddressMetadataAlert
);
ui/address/details/__screenshots__/AddressMetadataAlert.pw.tsx_default_base-view-1.png
0 → 100644
View file @
5c1ecb32
4.3 KB
ui/pages/Address.tsx
View file @
5c1ecb32
...
@@ -31,6 +31,7 @@ import AddressTxs from 'ui/address/AddressTxs';
...
@@ -31,6 +31,7 @@ import AddressTxs from 'ui/address/AddressTxs';
import
AddressUserOps
from
'
ui/address/AddressUserOps
'
;
import
AddressUserOps
from
'
ui/address/AddressUserOps
'
;
import
AddressWithdrawals
from
'
ui/address/AddressWithdrawals
'
;
import
AddressWithdrawals
from
'
ui/address/AddressWithdrawals
'
;
import
AddressFavoriteButton
from
'
ui/address/details/AddressFavoriteButton
'
;
import
AddressFavoriteButton
from
'
ui/address/details/AddressFavoriteButton
'
;
import
AddressMetadataAlert
from
'
ui/address/details/AddressMetadataAlert
'
;
import
AddressQrCode
from
'
ui/address/details/AddressQrCode
'
;
import
AddressQrCode
from
'
ui/address/details/AddressQrCode
'
;
import
AddressEnsDomains
from
'
ui/address/ensDomains/AddressEnsDomains
'
;
import
AddressEnsDomains
from
'
ui/address/ensDomains/AddressEnsDomains
'
;
import
SolidityscanReport
from
'
ui/address/SolidityscanReport
'
;
import
SolidityscanReport
from
'
ui/address/SolidityscanReport
'
;
...
@@ -345,6 +346,8 @@ const AddressPageContent = () => {
...
@@ -345,6 +346,8 @@ const AddressPageContent = () => {
secondRow={ titleSecondRow }
secondRow={ titleSecondRow }
isLoading={ isLoading }
isLoading={ isLoading }
/>
/>
{ !addressMetadataQuery.isPending &&
<AddressMetadataAlert tags={ addressMetadataQuery.data?.addresses?.[hash.toLowerCase()]?.tags }/> }
{ config.features.metasuites.isEnabled && <Box display="none" id="meta-suites__address" data-ready={ !isLoading }/> }
{ config.features.metasuites.isEnabled && <Box display="none" id="meta-suites__address" data-ready={ !isLoading }/> }
<AddressDetails addressQuery={ addressQuery } scrollRef={ tabsScrollRef }/>
<AddressDetails addressQuery={ addressQuery } scrollRef={ tabsScrollRef }/>
{ /* should stay before tabs to scroll up with pagination */ }
{ /* should stay before tabs to scroll up with pagination */ }
...
...
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