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
c3f130ae
Commit
c3f130ae
authored
Jul 18, 2024
by
Max Alekseenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove action button experiment
parent
6000e9cd
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
15 additions
and
30 deletions
+15
-30
init.ts
lib/growthbook/init.ts
+0
-1
useAppActionData.tsx
ui/shared/AppActionButton/useAppActionData.tsx
+1
-1
TokenDetails.tsx
ui/token/TokenDetails.tsx
+2
-5
TokenNftMarketplaces.tsx
ui/token/TokenNftMarketplaces.tsx
+3
-4
TokenInstanceDetails.pw.tsx
ui/tokenInstance/TokenInstanceDetails.pw.tsx
+1
-2
TokenInstanceDetails.tsx
ui/tokenInstance/TokenInstanceDetails.tsx
+2
-5
TxSubHeading.pw.tsx
ui/tx/TxSubHeading.pw.tsx
+4
-8
TxSubHeading.tsx
ui/tx/TxSubHeading.tsx
+2
-4
No files found.
lib/growthbook/init.ts
View file @
c3f130ae
...
...
@@ -7,7 +7,6 @@ import { STORAGE_KEY, STORAGE_LIMIT } from './consts';
export
interface
GrowthBookFeatures
{
test_value
:
string
;
action_button_exp
:
boolean
;
}
export
const
growthBook
=
(()
=>
{
...
...
ui/shared/AppActionButton/useAppActionData.tsx
View file @
c3f130ae
...
...
@@ -2,7 +2,7 @@ import { useMemo } from 'react';
import
useAddressMetadataInfoQuery
from
'
lib/address/useAddressMetadataInfoQuery
'
;
export
default
function
useAppActionData
(
address
:
string
|
undefined
=
''
,
isEnabled
=
fals
e
)
{
export
default
function
useAppActionData
(
address
:
string
|
undefined
=
''
,
isEnabled
=
tru
e
)
{
const
memoizedArray
=
useMemo
(()
=>
address
?
[
address
]
:
[],
[
address
]);
const
{
data
}
=
useAddressMetadataInfoQuery
(
memoizedArray
,
isEnabled
);
const
metadata
=
data
?.
addresses
[
address
?.
toLowerCase
()];
...
...
ui/token/TokenDetails.tsx
View file @
c3f130ae
...
...
@@ -12,7 +12,6 @@ import type { ResourceError } from 'lib/api/resources';
import
useApiQuery
from
'
lib/api/useApiQuery
'
;
import
throwOnResourceLoadError
from
'
lib/errors/throwOnResourceLoadError
'
;
import
getCurrencyValue
from
'
lib/getCurrencyValue
'
;
import
useFeatureValue
from
'
lib/growthbook/useFeatureValue
'
;
import
useIsMounted
from
'
lib/hooks/useIsMounted
'
;
import
{
TOKEN_COUNTERS
}
from
'
stubs/token
'
;
import
type
{
TokenTabs
}
from
'
ui/pages/Token
'
;
...
...
@@ -31,7 +30,6 @@ interface Props {
const
TokenDetails
=
({
tokenQuery
}:
Props
)
=>
{
const
router
=
useRouter
();
const
isMounted
=
useIsMounted
();
const
{
value
:
isActionButtonExperiment
}
=
useFeatureValue
(
'
action_button_exp
'
,
false
);
const
hash
=
router
.
query
.
hash
?.
toString
();
...
...
@@ -40,7 +38,7 @@ const TokenDetails = ({ tokenQuery }: Props) => {
queryOptions
:
{
enabled
:
Boolean
(
router
.
query
.
hash
),
placeholderData
:
TOKEN_COUNTERS
},
});
const
appActionData
=
useAppActionData
(
hash
,
isActionButtonExperiment
);
const
appActionData
=
useAppActionData
(
hash
);
const
changeUrlAndScroll
=
useCallback
((
tab
:
TokenTabs
)
=>
()
=>
{
router
.
push
(
...
...
@@ -200,11 +198,10 @@ const TokenDetails = ({ tokenQuery }: Props) => {
isLoading=
{
tokenQuery
.
isPlaceholderData
}
appActionData=
{
appActionData
}
source=
"NFT collection"
isActionButtonExperiment=
{
isActionButtonExperiment
}
/>
)
}
{
(
type
!==
'
ERC-20
'
&&
config
.
UI
.
views
.
nft
.
marketplaces
.
length
===
0
&&
appActionData
&&
isActionButtonExperiment
)
&&
(
{
(
type
!==
'
ERC-20
'
&&
config
.
UI
.
views
.
nft
.
marketplaces
.
length
===
0
&&
appActionData
)
&&
(
<>
<
DetailsInfoItem
.
Label
hint=
"Link to the dapp"
...
...
ui/token/TokenNftMarketplaces.tsx
View file @
c3f130ae
...
...
@@ -14,10 +14,9 @@ interface Props {
isLoading
?:
boolean
;
appActionData
?:
AddressMetadataTagFormatted
[
'
meta
'
];
source
:
'
NFT collection
'
|
'
NFT item
'
;
isActionButtonExperiment
?:
boolean
;
}
const
TokenNftMarketplaces
=
({
hash
,
id
,
isLoading
,
appActionData
,
source
,
isActionButtonExperiment
}:
Props
)
=>
{
const
TokenNftMarketplaces
=
({
hash
,
id
,
isLoading
,
appActionData
,
source
}:
Props
)
=>
{
if
(
!
hash
||
config
.
UI
.
views
.
nft
.
marketplaces
.
length
===
0
)
{
return
null
;
}
...
...
@@ -31,7 +30,7 @@ const TokenNftMarketplaces = ({ hash, id, isLoading, appActionData, source, isAc
Marketplaces
</
DetailsInfoItem
.
Label
>
<
DetailsInfoItem
.
Value
py=
{
(
appActionData
&&
isActionButtonExperiment
)
?
'
1px
'
:
'
6px
'
}
py=
{
appActionData
?
'
1px
'
:
'
6px
'
}
>
<
Skeleton
isLoaded=
{
!
isLoading
}
display=
"flex"
columnGap=
{
3
}
flexWrap=
"wrap"
alignItems=
"center"
>
{
config
.
UI
.
views
.
nft
.
marketplaces
.
map
((
item
)
=>
{
...
...
@@ -52,7 +51,7 @@ const TokenNftMarketplaces = ({ hash, id, isLoading, appActionData, source, isAc
</
Tooltip
>
);
})
}
{
(
appActionData
&&
isActionButtonExperiment
)
&&
(
{
appActionData
&&
(
<>
<
TextSeparator
color=
"gray.500"
margin=
{
0
}
/>
<
AppActionButton
data=
{
appActionData
}
height=
"30px"
source=
{
source
}
/>
...
...
ui/tokenInstance/TokenInstanceDetails.pw.tsx
View file @
c3f130ae
...
...
@@ -55,8 +55,7 @@ test('base view +@dark-mode +@mobile', async({ render, page }) => {
});
test
.
describe
(
'
action button
'
,
()
=>
{
test
.
beforeEach
(
async
({
mockFeatures
,
mockApiResponse
,
mockAssetResponse
})
=>
{
await
mockFeatures
([
[
'
action_button_exp
'
,
true
]
]);
test
.
beforeEach
(
async
({
mockApiResponse
,
mockAssetResponse
})
=>
{
const
metadataResponse
=
generateAddressMetadataResponse
(
protocolTagWithMeta
);
await
mockApiResponse
(
'
address_metadata_info
'
,
metadataResponse
,
{
queryParams
:
addressMetadataQueryParams
});
await
mockAssetResponse
(
protocolTagWithMeta
?.
meta
?.
appLogoURL
as
string
,
'
./playwright/mocks/image_s.jpg
'
);
...
...
ui/tokenInstance/TokenInstanceDetails.tsx
View file @
c3f130ae
...
...
@@ -4,7 +4,6 @@ import React from 'react';
import
type
{
TokenInfo
,
TokenInstance
}
from
'
types/api/token
'
;
import
config
from
'
configs/app
'
;
import
useFeatureValue
from
'
lib/growthbook/useFeatureValue
'
;
import
useIsMounted
from
'
lib/hooks/useIsMounted
'
;
import
AppActionButton
from
'
ui/shared/AppActionButton/AppActionButton
'
;
import
useAppActionData
from
'
ui/shared/AppActionButton/useAppActionData
'
;
...
...
@@ -29,8 +28,7 @@ interface Props {
}
const
TokenInstanceDetails
=
({
data
,
token
,
scrollRef
,
isLoading
}:
Props
)
=>
{
const
{
value
:
isActionButtonExperiment
}
=
useFeatureValue
(
'
action_button_exp
'
,
false
);
const
appActionData
=
useAppActionData
(
token
?.
address
,
isActionButtonExperiment
&&
!
isLoading
);
const
appActionData
=
useAppActionData
(
token
?.
address
,
!
isLoading
);
const
isMounted
=
useIsMounted
();
const
handleCounterItemClick
=
React
.
useCallback
(()
=>
{
...
...
@@ -96,10 +94,9 @@ const TokenInstanceDetails = ({ data, token, scrollRef, isLoading }: Props) => {
id=
{
data
.
id
}
appActionData=
{
appActionData
}
source=
"NFT item"
isActionButtonExperiment=
{
isActionButtonExperiment
}
/>
{
(
config
.
UI
.
views
.
nft
.
marketplaces
.
length
===
0
&&
appActionData
&&
isActionButtonExperiment
)
&&
(
{
(
config
.
UI
.
views
.
nft
.
marketplaces
.
length
===
0
&&
appActionData
)
&&
(
<>
<
DetailsInfoItem
.
Label
hint=
"Link to the dapp"
...
...
ui/tx/TxSubHeading.pw.tsx
View file @
c3f130ae
...
...
@@ -55,8 +55,7 @@ test.describe('blockscout provider', () => {
await
expect
(
component
).
toHaveScreenshot
();
});
test
(
'
with interpretation and action button +@mobile +@dark-mode
'
,
async
({
render
,
mockApiResponse
,
mockAssetResponse
,
mockFeatures
})
=>
{
await
mockFeatures
([
[
'
action_button_exp
'
,
true
]
]);
test
(
'
with interpretation and action button +@mobile +@dark-mode
'
,
async
({
render
,
mockApiResponse
,
mockAssetResponse
})
=>
{
const
metadataResponse
=
generateAddressMetadataResponse
(
protocolTagWithMeta
);
await
mockApiResponse
(
'
address_metadata_info
'
,
metadataResponse
,
{
queryParams
:
addressMetadataQueryParams
});
await
mockAssetResponse
(
protocolTagWithMeta
?.
meta
?.
appLogoURL
as
string
,
'
./playwright/mocks/image_s.jpg
'
);
...
...
@@ -76,9 +75,8 @@ test.describe('blockscout provider', () => {
});
test
(
'
with interpretation and view all link, and action button (external link) +@mobile
'
,
async
({
render
,
mockApiResponse
,
mockAssetResponse
,
mockFeatures
,
render
,
mockApiResponse
,
mockAssetResponse
,
})
=>
{
await
mockFeatures
([
[
'
action_button_exp
'
,
true
]
]);
delete
protocolTagWithMeta
?.
meta
?.
appID
;
const
metadataResponse
=
generateAddressMetadataResponse
(
protocolTagWithMeta
);
await
mockApiResponse
(
'
address_metadata_info
'
,
metadataResponse
,
{
queryParams
:
addressMetadataQueryParams
});
...
...
@@ -92,9 +90,8 @@ test.describe('blockscout provider', () => {
await
expect
(
component
).
toHaveScreenshot
();
});
test
(
'
no interpretation, has method called
'
,
async
({
render
,
mockApiResponse
,
mockFeatures
})
=>
{
test
(
'
no interpretation, has method called
'
,
async
({
render
,
mockApiResponse
})
=>
{
// the action button should not render if there is no interpretation
await
mockFeatures
([
[
'
action_button_exp
'
,
true
]
]);
const
metadataResponse
=
generateAddressMetadataResponse
(
protocolTagWithMeta
);
await
mockApiResponse
(
'
address_metadata_info
'
,
metadataResponse
,
{
queryParams
:
addressMetadataQueryParams
});
...
...
@@ -103,9 +100,8 @@ test.describe('blockscout provider', () => {
await
expect
(
component
).
toHaveScreenshot
();
});
test
(
'
no interpretation
'
,
async
({
render
,
mockApiResponse
,
mockFeatures
})
=>
{
test
(
'
no interpretation
'
,
async
({
render
,
mockApiResponse
})
=>
{
// the action button should not render if there is no interpretation
await
mockFeatures
([
[
'
action_button_exp
'
,
true
]
]);
const
metadataResponse
=
generateAddressMetadataResponse
(
protocolTagWithMeta
);
await
mockApiResponse
(
'
address_metadata_info
'
,
metadataResponse
,
{
queryParams
:
addressMetadataQueryParams
});
...
...
ui/tx/TxSubHeading.tsx
View file @
c3f130ae
...
...
@@ -3,7 +3,6 @@ import React from 'react';
import
config
from
'
configs/app
'
;
import
useApiQuery
from
'
lib/api/useApiQuery
'
;
import
useFeatureValue
from
'
lib/growthbook/useFeatureValue
'
;
import
{
NOVES_TRANSLATE
}
from
'
stubs/noves/NovesTranslate
'
;
import
{
TX_INTERPRETATION
}
from
'
stubs/txInterpretation
'
;
import
AccountActionsMenu
from
'
ui/shared/AccountActionsMenu/AccountActionsMenu
'
;
...
...
@@ -29,8 +28,7 @@ const TxSubHeading = ({ hash, hasTag, txQuery }: Props) => {
const
hasInterpretationFeature
=
feature
.
isEnabled
;
const
isNovesInterpretation
=
hasInterpretationFeature
&&
feature
.
provider
===
'
noves
'
;
const
{
value
:
isActionButtonExperiment
}
=
useFeatureValue
(
'
action_button_exp
'
,
false
);
const
appActionData
=
useAppActionData
(
txQuery
.
data
?.
to
?.
hash
,
isActionButtonExperiment
&&
!
txQuery
.
isPlaceholderData
);
const
appActionData
=
useAppActionData
(
txQuery
.
data
?.
to
?.
hash
,
!
txQuery
.
isPlaceholderData
);
const
txInterpretationQuery
=
useApiQuery
(
'
tx_interpretation
'
,
{
pathParams
:
{
hash
},
...
...
@@ -127,7 +125,7 @@ const TxSubHeading = ({ hash, hasTag, txQuery }: Props) => {
mt=
{
{
base
:
3
,
lg
:
0
}
}
>
{
!
hasTag
&&
<
AccountActionsMenu
/>
}
{
(
appActionData
&&
isActionButtonExperiment
&&
hasAnyInterpretation
)
&&
(
{
(
appActionData
&&
hasAnyInterpretation
)
&&
(
<
AppActionButton
data=
{
appActionData
}
txHash=
{
hash
}
source=
"Txn"
/>
)
}
<
NetworkExplorers
type=
"tx"
pathParam=
{
hash
}
ml=
{
{
base
:
0
,
lg
:
'
auto
'
}
}
/>
...
...
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