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
a4ba2e3a
Commit
a4ba2e3a
authored
May 08, 2024
by
Max Alekseenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add isEnabled param for useAppActionData
parent
7f6373db
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
6 deletions
+8
-6
useAppActionData.tsx
ui/shared/AppActionButton/useAppActionData.tsx
+2
-2
TokenDetails.tsx
ui/token/TokenDetails.tsx
+1
-1
TokenInstanceDetails.tsx
ui/tokenInstance/TokenInstanceDetails.tsx
+1
-1
TxSubHeading.tsx
ui/tx/TxSubHeading.tsx
+4
-2
No files found.
ui/shared/AppActionButton/useAppActionData.tsx
View file @
a4ba2e3a
...
@@ -2,8 +2,8 @@ import { useMemo } from 'react';
...
@@ -2,8 +2,8 @@ import { useMemo } from 'react';
import
useAddressMetadataInfoQuery
from
'
lib/address/useAddressMetadataInfoQuery
'
;
import
useAddressMetadataInfoQuery
from
'
lib/address/useAddressMetadataInfoQuery
'
;
export
default
function
useAppActionData
(
address
:
string
|
undefined
=
''
)
{
export
default
function
useAppActionData
(
address
:
string
|
undefined
=
''
,
isEnabled
=
false
)
{
const
memoizedArray
=
useMemo
(()
=>
address
?
[
address
]
:
[],
[
address
]);
const
memoizedArray
=
useMemo
(()
=>
(
address
&&
isEnabled
)
?
[
address
]
:
[],
[
address
,
isEnabled
]);
const
{
data
}
=
useAddressMetadataInfoQuery
(
memoizedArray
);
const
{
data
}
=
useAddressMetadataInfoQuery
(
memoizedArray
);
const
metadata
=
data
?.
addresses
[
address
?.
toLowerCase
()];
const
metadata
=
data
?.
addresses
[
address
?.
toLowerCase
()];
const
tag
=
metadata
?.
tags
?.
find
(({
tagType
})
=>
tagType
===
'
protocol
'
);
const
tag
=
metadata
?.
tags
?.
find
(({
tagType
})
=>
tagType
===
'
protocol
'
);
...
...
ui/token/TokenDetails.tsx
View file @
a4ba2e3a
...
@@ -40,7 +40,7 @@ const TokenDetails = ({ tokenQuery }: Props) => {
...
@@ -40,7 +40,7 @@ const TokenDetails = ({ tokenQuery }: Props) => {
queryOptions
:
{
enabled
:
Boolean
(
router
.
query
.
hash
),
placeholderData
:
TOKEN_COUNTERS
},
queryOptions
:
{
enabled
:
Boolean
(
router
.
query
.
hash
),
placeholderData
:
TOKEN_COUNTERS
},
});
});
const
appActionData
=
useAppActionData
(
hash
);
const
appActionData
=
useAppActionData
(
hash
,
isActionButtonExperiment
);
const
changeUrlAndScroll
=
useCallback
((
tab
:
TokenTabs
)
=>
()
=>
{
const
changeUrlAndScroll
=
useCallback
((
tab
:
TokenTabs
)
=>
()
=>
{
router
.
push
(
router
.
push
(
...
...
ui/tokenInstance/TokenInstanceDetails.tsx
View file @
a4ba2e3a
...
@@ -28,8 +28,8 @@ interface Props {
...
@@ -28,8 +28,8 @@ interface Props {
}
}
const
TokenInstanceDetails
=
({
data
,
token
,
scrollRef
,
isLoading
}:
Props
)
=>
{
const
TokenInstanceDetails
=
({
data
,
token
,
scrollRef
,
isLoading
}:
Props
)
=>
{
const
appActionData
=
useAppActionData
(
token
?.
address
);
const
{
value
:
isActionButtonExperiment
}
=
useFeatureValue
(
'
action_button_exp
'
,
false
);
const
{
value
:
isActionButtonExperiment
}
=
useFeatureValue
(
'
action_button_exp
'
,
false
);
const
appActionData
=
useAppActionData
(
token
?.
address
,
isActionButtonExperiment
&&
!
isLoading
);
const
handleCounterItemClick
=
React
.
useCallback
(()
=>
{
const
handleCounterItemClick
=
React
.
useCallback
(()
=>
{
window
.
setTimeout
(()
=>
{
window
.
setTimeout
(()
=>
{
...
...
ui/tx/TxSubHeading.tsx
View file @
a4ba2e3a
...
@@ -29,8 +29,8 @@ const TxSubHeading = ({ hash, hasTag, txQuery }: Props) => {
...
@@ -29,8 +29,8 @@ const TxSubHeading = ({ hash, hasTag, txQuery }: Props) => {
const
hasInterpretationFeature
=
feature
.
isEnabled
;
const
hasInterpretationFeature
=
feature
.
isEnabled
;
const
isNovesInterpretation
=
hasInterpretationFeature
&&
feature
.
provider
===
'
noves
'
;
const
isNovesInterpretation
=
hasInterpretationFeature
&&
feature
.
provider
===
'
noves
'
;
const
appActionData
=
useAppActionData
(
txQuery
.
data
?.
to
?.
hash
);
const
{
value
:
isActionButtonExperiment
}
=
useFeatureValue
(
'
action_button_exp
'
,
false
);
const
{
value
:
isActionButtonExperiment
}
=
useFeatureValue
(
'
action_button_exp
'
,
false
);
const
appActionData
=
useAppActionData
(
txQuery
.
data
?.
to
?.
hash
,
isActionButtonExperiment
&&
!
txQuery
.
isPlaceholderData
);
const
txInterpretationQuery
=
useApiQuery
(
'
tx_interpretation
'
,
{
const
txInterpretationQuery
=
useApiQuery
(
'
tx_interpretation
'
,
{
pathParams
:
{
hash
},
pathParams
:
{
hash
},
...
@@ -57,7 +57,9 @@ const TxSubHeading = ({ hash, hasTag, txQuery }: Props) => {
...
@@ -57,7 +57,9 @@ const TxSubHeading = ({ hash, hasTag, txQuery }: Props) => {
const
hasViewAllInterpretationsLink
=
const
hasViewAllInterpretationsLink
=
!
txInterpretationQuery
.
isPlaceholderData
&&
txInterpretationQuery
.
data
?.
data
.
summaries
&&
txInterpretationQuery
.
data
?.
data
.
summaries
.
length
>
1
;
!
txInterpretationQuery
.
isPlaceholderData
&&
txInterpretationQuery
.
data
?.
data
.
summaries
&&
txInterpretationQuery
.
data
?.
data
.
summaries
.
length
>
1
;
const
hasAnyInterpretation
=
(
hasNovesInterpretation
&&
novesInterpretationQuery
.
data
)
||
hasInternalInterpretation
;
const
hasAnyInterpretation
=
(
hasNovesInterpretation
&&
novesInterpretationQuery
.
data
&&
!
novesInterpretationQuery
.
isPlaceholderData
)
||
(
hasInternalInterpretation
&&
!
txInterpretationQuery
.
isPlaceholderData
);
const
content
=
(()
=>
{
const
content
=
(()
=>
{
if
(
hasNovesInterpretation
&&
novesInterpretationQuery
.
data
)
{
if
(
hasNovesInterpretation
&&
novesInterpretationQuery
.
data
)
{
...
...
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