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
3bff33f8
Commit
3bff33f8
authored
Mar 21, 2024
by
Max Alekseenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add mixpanel events
parent
b89c3a17
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
72 additions
and
24 deletions
+72
-24
utils.ts
lib/mixpanel/utils.ts
+5
-1
AppSecurityReport.tsx
ui/marketplace/AppSecurityReport.tsx
+16
-2
ContractSecurityReport.tsx
ui/marketplace/ContractSecurityReport.tsx
+6
-0
MarketplaceAppCard.tsx
ui/marketplace/MarketplaceAppCard.tsx
+3
-3
MarketplaceAppModal.tsx
ui/marketplace/MarketplaceAppModal.tsx
+13
-5
MarketplaceAppTopBar.tsx
ui/marketplace/MarketplaceAppTopBar.tsx
+2
-0
MarketplaceList.tsx
ui/marketplace/MarketplaceList.tsx
+1
-1
MarketplaceListWithScores.tsx
ui/marketplace/MarketplaceListWithScores.tsx
+1
-1
ListItem.tsx
ui/marketplace/MarketplaceListWithScores/ListItem.tsx
+7
-3
Table.tsx
ui/marketplace/MarketplaceListWithScores/Table.tsx
+1
-1
TableItem.tsx
ui/marketplace/MarketplaceListWithScores/TableItem.tsx
+7
-3
useMarketplace.tsx
ui/marketplace/useMarketplace.tsx
+2
-2
SolidityscanReportButton.tsx
ui/shared/solidityscanReport/SolidityscanReportButton.tsx
+8
-2
No files found.
lib/mixpanel/utils.ts
View file @
3bff33f8
...
@@ -98,8 +98,12 @@ Type extends EventTypes.PAGE_WIDGET ? (
...
@@ -98,8 +98,12 @@ Type extends EventTypes.PAGE_WIDGET ? (
{
{
'
Type
'
:
'
Tokens dropdown
'
|
'
Tokens show all (icon)
'
|
'
Add to watchlist
'
|
'
Address actions (more button)
'
;
'
Type
'
:
'
Tokens dropdown
'
|
'
Tokens show all (icon)
'
|
'
Add to watchlist
'
|
'
Address actions (more button)
'
;
}
|
{
}
|
{
'
Type
'
:
'
Favorite app
'
|
'
More button
'
;
'
Type
'
:
'
Favorite app
'
|
'
More button
'
|
'
Security score
'
|
'
Total contracts
'
|
'
Verified contracts
'
|
'
Analyzed contracts
'
;
'
Info
'
:
string
;
'
Info
'
:
string
;
'
Source
'
:
'
Discovery view
'
|
'
Security view
'
|
'
App modal
'
|
'
App page
'
|
'
Security score popup
'
;
}
|
{
'
Type
'
:
'
Security score
'
;
'
Source
'
:
'
Analyzed contracts popup
'
;
}
}
)
:
)
:
Type
extends
EventTypes
.
TX_INTERPRETATION_INTERACTION
?
{
Type
extends
EventTypes
.
TX_INTERPRETATION_INTERACTION
?
{
...
...
ui/marketplace/AppSecurityReport.tsx
View file @
3bff33f8
...
@@ -3,20 +3,33 @@ import React from 'react';
...
@@ -3,20 +3,33 @@ import React from 'react';
import
config
from
'
configs/app
'
;
import
config
from
'
configs/app
'
;
import
{
apos
}
from
'
lib/html-entities
'
;
import
{
apos
}
from
'
lib/html-entities
'
;
import
*
as
mixpanel
from
'
lib/mixpanel/index
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
import
SolidityscanReportButton
from
'
ui/shared/solidityscanReport/SolidityscanReportButton
'
;
import
SolidityscanReportButton
from
'
ui/shared/solidityscanReport/SolidityscanReportButton
'
;
import
SolidityscanReportDetails
from
'
ui/shared/solidityscanReport/SolidityscanReportDetails
'
;
import
SolidityscanReportDetails
from
'
ui/shared/solidityscanReport/SolidityscanReportDetails
'
;
import
SolidityscanReportScore
from
'
ui/shared/solidityscanReport/SolidityscanReportScore
'
;
import
SolidityscanReportScore
from
'
ui/shared/solidityscanReport/SolidityscanReportScore
'
;
type
Props
=
{
type
Props
=
{
id
:
string
;
securityReport
?:
any
;
// eslint-disable-line @typescript-eslint/no-explicit-any
securityReport
?:
any
;
// eslint-disable-line @typescript-eslint/no-explicit-any
height
?:
string
|
undefined
;
height
?:
string
|
undefined
;
showContractList
:
()
=>
void
;
showContractList
:
()
=>
void
;
isLoading
?:
boolean
;
isLoading
?:
boolean
;
onlyIcon
?:
boolean
;
onlyIcon
?:
boolean
;
source
:
'
Security view
'
|
'
App modal
'
|
'
App page
'
;
}
}
const
AppSecurityReport
=
({
securityReport
,
height
,
showContractList
,
isLoading
,
onlyIcon
}:
Props
)
=>
{
const
AppSecurityReport
=
({
id
,
securityReport
,
height
,
showContractList
,
isLoading
,
onlyIcon
,
source
}:
Props
)
=>
{
const
handleButtonClick
=
React
.
useCallback
(()
=>
{
mixpanel
.
logEvent
(
mixpanel
.
EventTypes
.
PAGE_WIDGET
,
{
Type
:
'
Security score
'
,
Info
:
id
,
Source
:
source
});
},
[
id
,
source
]);
const
handleLinkClick
=
React
.
useCallback
(()
=>
{
mixpanel
.
logEvent
(
mixpanel
.
EventTypes
.
PAGE_WIDGET
,
{
Type
:
'
Analyzed contracts
'
,
Info
:
id
,
Source
:
'
Security score popup
'
});
showContractList
();
},
[
id
,
showContractList
]);
if
(
!
securityReport
&&
!
isLoading
)
{
if
(
!
securityReport
&&
!
isLoading
)
{
return
null
;
return
null
;
}
}
...
@@ -34,6 +47,7 @@ const AppSecurityReport = ({ securityReport, height, showContractList, isLoading
...
@@ -34,6 +47,7 @@ const AppSecurityReport = ({ securityReport, height, showContractList, isLoading
height=
{
height
}
height=
{
height
}
score=
{
securityScore
}
score=
{
securityScore
}
onlyIcon=
{
onlyIcon
}
onlyIcon=
{
onlyIcon
}
onClick=
{
handleButtonClick
}
popoverContent=
{
(
popoverContent=
{
(
<>
<>
<
Box
mb=
{
5
}
>
<
Box
mb=
{
5
}
>
...
@@ -47,7 +61,7 @@ const AppSecurityReport = ({ securityReport, height, showContractList, isLoading
...
@@ -47,7 +61,7 @@ const AppSecurityReport = ({ securityReport, height, showContractList, isLoading
<
SolidityscanReportDetails
vulnerabilities=
{
issueSeverityDistribution
}
vulnerabilitiesCount=
{
totalIssues
}
/>
<
SolidityscanReportDetails
vulnerabilities=
{
issueSeverityDistribution
}
vulnerabilitiesCount=
{
totalIssues
}
/>
</
Box
>
</
Box
>
)
}
)
}
<
Link
onClick=
{
showContractList
}
display=
"inline-flex"
alignItems=
"center"
>
<
Link
onClick=
{
handleLinkClick
}
display=
"inline-flex"
alignItems=
"center"
>
Analyzed contracts
Analyzed contracts
<
IconSvg
name=
"arrows/north-east"
boxSize=
{
5
}
color=
"gray.400"
/>
<
IconSvg
name=
"arrows/north-east"
boxSize=
{
5
}
color=
"gray.400"
/>
</
Link
>
</
Link
>
...
...
ui/marketplace/ContractSecurityReport.tsx
View file @
3bff33f8
...
@@ -2,6 +2,7 @@ import { Box, Text } from '@chakra-ui/react';
...
@@ -2,6 +2,7 @@ import { Box, Text } from '@chakra-ui/react';
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
config
from
'
configs/app
'
;
import
config
from
'
configs/app
'
;
import
*
as
mixpanel
from
'
lib/mixpanel/index
'
;
import
LinkExternal
from
'
ui/shared/LinkExternal
'
;
import
LinkExternal
from
'
ui/shared/LinkExternal
'
;
import
SolidityscanReportButton
from
'
ui/shared/solidityscanReport/SolidityscanReportButton
'
;
import
SolidityscanReportButton
from
'
ui/shared/solidityscanReport/SolidityscanReportButton
'
;
import
SolidityscanReportDetails
from
'
ui/shared/solidityscanReport/SolidityscanReportDetails
'
;
import
SolidityscanReportDetails
from
'
ui/shared/solidityscanReport/SolidityscanReportDetails
'
;
...
@@ -22,9 +23,14 @@ const ContractSecurityReport = ({ securityReport }: Props) => {
...
@@ -22,9 +23,14 @@ const ContractSecurityReport = ({ securityReport }: Props) => {
const
totalIssues
=
Object
.
values
(
issueSeverityDistribution
as
Record
<
string
,
number
>
).
reduce
((
acc
,
val
)
=>
acc
+
val
,
0
);
const
totalIssues
=
Object
.
values
(
issueSeverityDistribution
as
Record
<
string
,
number
>
).
reduce
((
acc
,
val
)
=>
acc
+
val
,
0
);
const
handleClick
=
React
.
useCallback
(()
=>
{
mixpanel
.
logEvent
(
mixpanel
.
EventTypes
.
PAGE_WIDGET
,
{
Type
:
'
Security score
'
,
Source
:
'
Analyzed contracts popup
'
});
},
[
]);
return
(
return
(
<
SolidityscanReportButton
<
SolidityscanReportButton
score=
{
securityScore
}
score=
{
securityScore
}
onClick=
{
handleClick
}
popoverContent=
{
(
popoverContent=
{
(
<>
<>
<
Box
mb=
{
5
}
>
<
Box
mb=
{
5
}
>
...
...
ui/marketplace/MarketplaceAppCard.tsx
View file @
3bff33f8
...
@@ -13,7 +13,7 @@ import MarketplaceAppIntegrationIcon from './MarketplaceAppIntegrationIcon';
...
@@ -13,7 +13,7 @@ import MarketplaceAppIntegrationIcon from './MarketplaceAppIntegrationIcon';
interface
Props
extends
MarketplaceAppPreview
{
interface
Props
extends
MarketplaceAppPreview
{
onInfoClick
:
(
id
:
string
)
=>
void
;
onInfoClick
:
(
id
:
string
)
=>
void
;
isFavorite
:
boolean
;
isFavorite
:
boolean
;
onFavoriteClick
:
(
id
:
string
,
isFavorite
:
boolean
)
=>
void
;
onFavoriteClick
:
(
id
:
string
,
isFavorite
:
boolean
,
source
:
'
Discovery view
'
)
=>
void
;
isLoading
:
boolean
;
isLoading
:
boolean
;
onAppClick
:
(
event
:
MouseEvent
,
id
:
string
)
=>
void
;
onAppClick
:
(
event
:
MouseEvent
,
id
:
string
)
=>
void
;
}
}
...
@@ -38,12 +38,12 @@ const MarketplaceAppCard = ({
...
@@ -38,12 +38,12 @@ const MarketplaceAppCard = ({
const
handleInfoClick
=
useCallback
((
event
:
MouseEvent
)
=>
{
const
handleInfoClick
=
useCallback
((
event
:
MouseEvent
)
=>
{
event
.
preventDefault
();
event
.
preventDefault
();
mixpanel
.
logEvent
(
mixpanel
.
EventTypes
.
PAGE_WIDGET
,
{
Type
:
'
More button
'
,
Info
:
id
});
mixpanel
.
logEvent
(
mixpanel
.
EventTypes
.
PAGE_WIDGET
,
{
Type
:
'
More button
'
,
Info
:
id
,
Source
:
'
Discovery view
'
});
onInfoClick
(
id
);
onInfoClick
(
id
);
},
[
onInfoClick
,
id
]);
},
[
onInfoClick
,
id
]);
const
handleFavoriteClick
=
useCallback
(()
=>
{
const
handleFavoriteClick
=
useCallback
(()
=>
{
onFavoriteClick
(
id
,
isFavorite
);
onFavoriteClick
(
id
,
isFavorite
,
'
Discovery view
'
);
},
[
onFavoriteClick
,
id
,
isFavorite
]);
},
[
onFavoriteClick
,
id
,
isFavorite
]);
const
logoUrl
=
useColorModeValue
(
logo
,
logoDarkMode
||
logo
);
const
logoUrl
=
useColorModeValue
(
logo
,
logoDarkMode
||
logo
);
...
...
ui/marketplace/MarketplaceAppModal.tsx
View file @
3bff33f8
...
@@ -10,6 +10,7 @@ import { ContractListTypes } from 'types/client/marketplace';
...
@@ -10,6 +10,7 @@ import { ContractListTypes } from 'types/client/marketplace';
import
useFeatureValue
from
'
lib/growthbook/useFeatureValue
'
;
import
useFeatureValue
from
'
lib/growthbook/useFeatureValue
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
{
nbsp
}
from
'
lib/html-entities
'
;
import
{
nbsp
}
from
'
lib/html-entities
'
;
import
*
as
mixpanel
from
'
lib/mixpanel/index
'
;
import
type
{
IconName
}
from
'
ui/shared/IconSvg
'
;
import
type
{
IconName
}
from
'
ui/shared/IconSvg
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
...
@@ -20,7 +21,7 @@ import MarketplaceAppModalLink from './MarketplaceAppModalLink';
...
@@ -20,7 +21,7 @@ import MarketplaceAppModalLink from './MarketplaceAppModalLink';
type
Props
=
{
type
Props
=
{
onClose
:
()
=>
void
;
onClose
:
()
=>
void
;
isFavorite
:
boolean
;
isFavorite
:
boolean
;
onFavoriteClick
:
(
id
:
string
,
isFavorite
:
boolean
)
=>
void
;
onFavoriteClick
:
(
id
:
string
,
isFavorite
:
boolean
,
source
:
'
App modal
'
)
=>
void
;
data
:
MarketplaceAppWithSecurityReport
;
data
:
MarketplaceAppWithSecurityReport
;
showContractList
:
(
id
:
string
,
type
:
ContractListTypes
)
=>
void
;
showContractList
:
(
id
:
string
,
type
:
ContractListTypes
)
=>
void
;
}
}
...
@@ -71,7 +72,7 @@ const MarketplaceAppModal = ({
...
@@ -71,7 +72,7 @@ const MarketplaceAppModal = ({
}
}
const
handleFavoriteClick
=
useCallback
(()
=>
{
const
handleFavoriteClick
=
useCallback
(()
=>
{
onFavoriteClick
(
id
,
isFavorite
);
onFavoriteClick
(
id
,
isFavorite
,
'
App modal
'
);
},
[
onFavoriteClick
,
id
,
isFavorite
]);
},
[
onFavoriteClick
,
id
,
isFavorite
]);
const
showContractList
=
useCallback
((
type
:
ContractListTypes
)
=>
{
const
showContractList
=
useCallback
((
type
:
ContractListTypes
)
=>
{
...
@@ -80,12 +81,14 @@ const MarketplaceAppModal = ({
...
@@ -80,12 +81,14 @@ const MarketplaceAppModal = ({
},
[
onClose
,
showContractListDefault
,
id
]);
},
[
onClose
,
showContractListDefault
,
id
]);
const
showAllContracts
=
React
.
useCallback
(()
=>
{
const
showAllContracts
=
React
.
useCallback
(()
=>
{
mixpanel
.
logEvent
(
mixpanel
.
EventTypes
.
PAGE_WIDGET
,
{
Type
:
'
Total contracts
'
,
Info
:
id
,
Source
:
'
App modal
'
});
showContractList
(
ContractListTypes
.
ALL
);
showContractList
(
ContractListTypes
.
ALL
);
},
[
showContractList
]);
},
[
showContractList
,
id
]);
const
showVerifiedContracts
=
React
.
useCallback
(()
=>
{
const
showVerifiedContracts
=
React
.
useCallback
(()
=>
{
mixpanel
.
logEvent
(
mixpanel
.
EventTypes
.
PAGE_WIDGET
,
{
Type
:
'
Verified contracts
'
,
Info
:
id
,
Source
:
'
App modal
'
});
showContractList
(
ContractListTypes
.
VERIFIED
);
showContractList
(
ContractListTypes
.
VERIFIED
);
},
[
showContractList
]);
},
[
showContractList
,
id
]);
const
showAnalyzedContracts
=
React
.
useCallback
(()
=>
{
const
showAnalyzedContracts
=
React
.
useCallback
(()
=>
{
showContractList
(
ContractListTypes
.
ANALYZED
);
showContractList
(
ContractListTypes
.
ANALYZED
);
...
@@ -174,7 +177,12 @@ const MarketplaceAppModal = ({
...
@@ -174,7 +177,12 @@ const MarketplaceAppModal = ({
{
(
isExperiment
&&
securityReport
)
&&
(
{
(
isExperiment
&&
securityReport
)
&&
(
<
Flex
alignItems=
"center"
gap=
{
3
}
>
<
Flex
alignItems=
"center"
gap=
{
3
}
>
<
AppSecurityReport
securityReport=
{
securityReport
}
showContractList=
{
showAnalyzedContracts
}
/>
<
AppSecurityReport
id=
{
id
}
securityReport=
{
securityReport
}
showContractList=
{
showAnalyzedContracts
}
source=
"App modal"
/>
<
ContractListButton
<
ContractListButton
onClick=
{
showAllContracts
}
onClick=
{
showAllContracts
}
variant=
{
ContractListButtonVariants
.
ALL_CONTRACTS
}
variant=
{
ContractListButtonVariants
.
ALL_CONTRACTS
}
...
...
ui/marketplace/MarketplaceAppTopBar.tsx
View file @
3bff33f8
...
@@ -61,10 +61,12 @@ const MarketplaceAppTopBar = ({ data, isLoading, isWalletConnected, securityRepo
...
@@ -61,10 +61,12 @@ const MarketplaceAppTopBar = ({ data, isLoading, isWalletConnected, securityRepo
{
(
isExperiment
&&
(
securityReport
||
isLoading
))
&&
(
{
(
isExperiment
&&
(
securityReport
||
isLoading
))
&&
(
<
Box
order=
{
{
base
:
3
,
md
:
4
}
}
>
<
Box
order=
{
{
base
:
3
,
md
:
4
}
}
>
<
AppSecurityReport
<
AppSecurityReport
id=
{
data
?.
id
||
''
}
securityReport=
{
securityReport
}
securityReport=
{
securityReport
}
showContractList=
{
setShowContractList
.
on
}
showContractList=
{
setShowContractList
.
on
}
isLoading=
{
isLoading
}
isLoading=
{
isLoading
}
onlyIcon=
{
isMobile
}
onlyIcon=
{
isMobile
}
source=
"App page"
/>
/>
</
Box
>
</
Box
>
)
}
)
}
...
...
ui/marketplace/MarketplaceList.tsx
View file @
3bff33f8
...
@@ -11,7 +11,7 @@ type Props = {
...
@@ -11,7 +11,7 @@ type Props = {
apps
:
Array
<
MarketplaceAppPreview
>
;
apps
:
Array
<
MarketplaceAppPreview
>
;
showAppInfo
:
(
id
:
string
)
=>
void
;
showAppInfo
:
(
id
:
string
)
=>
void
;
favoriteApps
:
Array
<
string
>
;
favoriteApps
:
Array
<
string
>
;
onFavoriteClick
:
(
id
:
string
,
isFavorite
:
boolean
)
=>
void
;
onFavoriteClick
:
(
id
:
string
,
isFavorite
:
boolean
,
source
:
'
Discovery view
'
)
=>
void
;
isLoading
:
boolean
;
isLoading
:
boolean
;
selectedCategoryId
?:
string
;
selectedCategoryId
?:
string
;
onAppClick
:
(
event
:
MouseEvent
,
id
:
string
)
=>
void
;
onAppClick
:
(
event
:
MouseEvent
,
id
:
string
)
=>
void
;
...
...
ui/marketplace/MarketplaceListWithScores.tsx
View file @
3bff33f8
...
@@ -14,7 +14,7 @@ interface Props {
...
@@ -14,7 +14,7 @@ interface Props {
apps
:
Array
<
MarketplaceAppWithSecurityReport
>
;
apps
:
Array
<
MarketplaceAppWithSecurityReport
>
;
showAppInfo
:
(
id
:
string
)
=>
void
;
showAppInfo
:
(
id
:
string
)
=>
void
;
favoriteApps
:
Array
<
string
>
;
favoriteApps
:
Array
<
string
>
;
onFavoriteClick
:
(
id
:
string
,
isFavorite
:
boolean
)
=>
void
;
onFavoriteClick
:
(
id
:
string
,
isFavorite
:
boolean
,
source
:
'
Security view
'
)
=>
void
;
isLoading
:
boolean
;
isLoading
:
boolean
;
selectedCategoryId
?:
string
;
selectedCategoryId
?:
string
;
onAppClick
:
(
event
:
MouseEvent
,
id
:
string
)
=>
void
;
onAppClick
:
(
event
:
MouseEvent
,
id
:
string
)
=>
void
;
...
...
ui/marketplace/MarketplaceListWithScores/ListItem.tsx
View file @
3bff33f8
...
@@ -18,7 +18,7 @@ type Props = {
...
@@ -18,7 +18,7 @@ type Props = {
app
:
MarketplaceAppPreview
&
{
securityReport
?:
any
};
// eslint-disable-line @typescript-eslint/no-explicit-any
app
:
MarketplaceAppPreview
&
{
securityReport
?:
any
};
// eslint-disable-line @typescript-eslint/no-explicit-any
onInfoClick
:
(
id
:
string
)
=>
void
;
onInfoClick
:
(
id
:
string
)
=>
void
;
isFavorite
:
boolean
;
isFavorite
:
boolean
;
onFavoriteClick
:
(
id
:
string
,
isFavorite
:
boolean
)
=>
void
;
onFavoriteClick
:
(
id
:
string
,
isFavorite
:
boolean
,
source
:
'
Security view
'
)
=>
void
;
isLoading
:
boolean
;
isLoading
:
boolean
;
onAppClick
:
(
event
:
MouseEvent
,
id
:
string
)
=>
void
;
onAppClick
:
(
event
:
MouseEvent
,
id
:
string
)
=>
void
;
showContractList
:
(
id
:
string
,
type
:
ContractListTypes
)
=>
void
;
showContractList
:
(
id
:
string
,
type
:
ContractListTypes
)
=>
void
;
...
@@ -29,19 +29,21 @@ const ListItem = ({ app, onInfoClick, isFavorite, onFavoriteClick, isLoading, on
...
@@ -29,19 +29,21 @@ const ListItem = ({ app, onInfoClick, isFavorite, onFavoriteClick, isLoading, on
const
handleInfoClick
=
React
.
useCallback
((
event
:
MouseEvent
)
=>
{
const
handleInfoClick
=
React
.
useCallback
((
event
:
MouseEvent
)
=>
{
event
.
preventDefault
();
event
.
preventDefault
();
mixpanel
.
logEvent
(
mixpanel
.
EventTypes
.
PAGE_WIDGET
,
{
Type
:
'
More button
'
,
Info
:
id
});
mixpanel
.
logEvent
(
mixpanel
.
EventTypes
.
PAGE_WIDGET
,
{
Type
:
'
More button
'
,
Info
:
id
,
Source
:
'
Security view
'
});
onInfoClick
(
id
);
onInfoClick
(
id
);
},
[
onInfoClick
,
id
]);
},
[
onInfoClick
,
id
]);
const
handleFavoriteClick
=
React
.
useCallback
(()
=>
{
const
handleFavoriteClick
=
React
.
useCallback
(()
=>
{
onFavoriteClick
(
id
,
isFavorite
);
onFavoriteClick
(
id
,
isFavorite
,
'
Security view
'
);
},
[
onFavoriteClick
,
id
,
isFavorite
]);
},
[
onFavoriteClick
,
id
,
isFavorite
]);
const
showAllContracts
=
React
.
useCallback
(()
=>
{
const
showAllContracts
=
React
.
useCallback
(()
=>
{
mixpanel
.
logEvent
(
mixpanel
.
EventTypes
.
PAGE_WIDGET
,
{
Type
:
'
Total contracts
'
,
Info
:
id
,
Source
:
'
Security view
'
});
showContractList
(
id
,
ContractListTypes
.
ALL
);
showContractList
(
id
,
ContractListTypes
.
ALL
);
},
[
showContractList
,
id
]);
},
[
showContractList
,
id
]);
const
showVerifiedContracts
=
React
.
useCallback
(()
=>
{
const
showVerifiedContracts
=
React
.
useCallback
(()
=>
{
mixpanel
.
logEvent
(
mixpanel
.
EventTypes
.
PAGE_WIDGET
,
{
Type
:
'
Verified contracts
'
,
Info
:
id
,
Source
:
'
Security view
'
});
showContractList
(
id
,
ContractListTypes
.
VERIFIED
);
showContractList
(
id
,
ContractListTypes
.
VERIFIED
);
},
[
showContractList
,
id
]);
},
[
showContractList
,
id
]);
...
@@ -96,10 +98,12 @@ const ListItem = ({ app, onInfoClick, isFavorite, onFavoriteClick, isLoading, on
...
@@ -96,10 +98,12 @@ const ListItem = ({ app, onInfoClick, isFavorite, onFavoriteClick, isLoading, on
{
(
securityReport
||
isLoading
)
?
(
{
(
securityReport
||
isLoading
)
?
(
<>
<>
<
AppSecurityReport
<
AppSecurityReport
id=
{
id
}
isLoading=
{
isLoading
}
isLoading=
{
isLoading
}
securityReport=
{
securityReport
}
securityReport=
{
securityReport
}
showContractList=
{
showAnalyzedContracts
}
showContractList=
{
showAnalyzedContracts
}
height=
"30px"
height=
"30px"
source=
"Security view"
/>
/>
<
ContractListButton
<
ContractListButton
onClick=
{
showAllContracts
}
onClick=
{
showAllContracts
}
...
...
ui/marketplace/MarketplaceListWithScores/Table.tsx
View file @
3bff33f8
...
@@ -12,7 +12,7 @@ type Props = {
...
@@ -12,7 +12,7 @@ type Props = {
apps
:
Array
<
MarketplaceAppPreview
>
;
apps
:
Array
<
MarketplaceAppPreview
>
;
isLoading
?:
boolean
;
isLoading
?:
boolean
;
favoriteApps
:
Array
<
string
>
;
favoriteApps
:
Array
<
string
>
;
onFavoriteClick
:
(
id
:
string
,
isFavorite
:
boolean
)
=>
void
;
onFavoriteClick
:
(
id
:
string
,
isFavorite
:
boolean
,
source
:
'
Security view
'
)
=>
void
;
onAppClick
:
(
event
:
MouseEvent
,
id
:
string
)
=>
void
;
onAppClick
:
(
event
:
MouseEvent
,
id
:
string
)
=>
void
;
onInfoClick
:
(
id
:
string
)
=>
void
;
onInfoClick
:
(
id
:
string
)
=>
void
;
showContractList
:
(
id
:
string
,
type
:
ContractListTypes
)
=>
void
;
showContractList
:
(
id
:
string
,
type
:
ContractListTypes
)
=>
void
;
...
...
ui/marketplace/MarketplaceListWithScores/TableItem.tsx
View file @
3bff33f8
...
@@ -17,7 +17,7 @@ type Props = {
...
@@ -17,7 +17,7 @@ type Props = {
app
:
MarketplaceAppPreview
&
{
securityReport
?:
any
};
// eslint-disable-line @typescript-eslint/no-explicit-any
app
:
MarketplaceAppPreview
&
{
securityReport
?:
any
};
// eslint-disable-line @typescript-eslint/no-explicit-any
isLoading
?:
boolean
;
isLoading
?:
boolean
;
isFavorite
:
boolean
;
isFavorite
:
boolean
;
onFavoriteClick
:
(
id
:
string
,
isFavorite
:
boolean
)
=>
void
;
onFavoriteClick
:
(
id
:
string
,
isFavorite
:
boolean
,
source
:
'
Security view
'
)
=>
void
;
onAppClick
:
(
event
:
MouseEvent
,
id
:
string
)
=>
void
;
onAppClick
:
(
event
:
MouseEvent
,
id
:
string
)
=>
void
;
onInfoClick
:
(
id
:
string
)
=>
void
;
onInfoClick
:
(
id
:
string
)
=>
void
;
showContractList
:
(
id
:
string
,
type
:
ContractListTypes
)
=>
void
;
showContractList
:
(
id
:
string
,
type
:
ContractListTypes
)
=>
void
;
...
@@ -37,19 +37,21 @@ const TableItem = ({
...
@@ -37,19 +37,21 @@ const TableItem = ({
const
handleInfoClick
=
React
.
useCallback
((
event
:
MouseEvent
)
=>
{
const
handleInfoClick
=
React
.
useCallback
((
event
:
MouseEvent
)
=>
{
event
.
preventDefault
();
event
.
preventDefault
();
mixpanel
.
logEvent
(
mixpanel
.
EventTypes
.
PAGE_WIDGET
,
{
Type
:
'
More button
'
,
Info
:
id
});
mixpanel
.
logEvent
(
mixpanel
.
EventTypes
.
PAGE_WIDGET
,
{
Type
:
'
More button
'
,
Info
:
id
,
Source
:
'
Security view
'
});
onInfoClick
(
id
);
onInfoClick
(
id
);
},
[
onInfoClick
,
id
]);
},
[
onInfoClick
,
id
]);
const
handleFavoriteClick
=
React
.
useCallback
(()
=>
{
const
handleFavoriteClick
=
React
.
useCallback
(()
=>
{
onFavoriteClick
(
id
,
isFavorite
);
onFavoriteClick
(
id
,
isFavorite
,
'
Security view
'
);
},
[
onFavoriteClick
,
id
,
isFavorite
]);
},
[
onFavoriteClick
,
id
,
isFavorite
]);
const
showAllContracts
=
React
.
useCallback
(()
=>
{
const
showAllContracts
=
React
.
useCallback
(()
=>
{
mixpanel
.
logEvent
(
mixpanel
.
EventTypes
.
PAGE_WIDGET
,
{
Type
:
'
Total contracts
'
,
Info
:
id
,
Source
:
'
Security view
'
});
showContractList
(
id
,
ContractListTypes
.
ALL
);
showContractList
(
id
,
ContractListTypes
.
ALL
);
},
[
showContractList
,
id
]);
},
[
showContractList
,
id
]);
const
showVerifiedContracts
=
React
.
useCallback
(()
=>
{
const
showVerifiedContracts
=
React
.
useCallback
(()
=>
{
mixpanel
.
logEvent
(
mixpanel
.
EventTypes
.
PAGE_WIDGET
,
{
Type
:
'
Verified contracts
'
,
Info
:
id
,
Source
:
'
Security view
'
});
showContractList
(
id
,
ContractListTypes
.
VERIFIED
);
showContractList
(
id
,
ContractListTypes
.
VERIFIED
);
},
[
showContractList
,
id
]);
},
[
showContractList
,
id
]);
...
@@ -83,9 +85,11 @@ const TableItem = ({
...
@@ -83,9 +85,11 @@ const TableItem = ({
<>
<>
<
Td
verticalAlign=
"middle"
>
<
Td
verticalAlign=
"middle"
>
<
AppSecurityReport
<
AppSecurityReport
id=
{
id
}
securityReport=
{
securityReport
}
securityReport=
{
securityReport
}
showContractList=
{
showAnalyzedContracts
}
showContractList=
{
showAnalyzedContracts
}
isLoading=
{
isLoading
}
isLoading=
{
isLoading
}
source=
"Security view"
/>
/>
</
Td
>
</
Td
>
<
Td
verticalAlign=
"middle"
>
<
Td
verticalAlign=
"middle"
>
...
...
ui/marketplace/useMarketplace.tsx
View file @
3bff33f8
...
@@ -42,8 +42,8 @@ export default function useMarketplace() {
...
@@ -42,8 +42,8 @@ export default function useMarketplace() {
const
[
isDisclaimerModalOpen
,
setIsDisclaimerModalOpen
]
=
React
.
useState
<
boolean
>
(
false
);
const
[
isDisclaimerModalOpen
,
setIsDisclaimerModalOpen
]
=
React
.
useState
<
boolean
>
(
false
);
const
[
contractListModalType
,
setContractListModalType
]
=
React
.
useState
<
ContractListTypes
|
null
>
(
null
);
const
[
contractListModalType
,
setContractListModalType
]
=
React
.
useState
<
ContractListTypes
|
null
>
(
null
);
const
handleFavoriteClick
=
React
.
useCallback
((
id
:
string
,
isFavorite
:
boolean
)
=>
{
const
handleFavoriteClick
=
React
.
useCallback
((
id
:
string
,
isFavorite
:
boolean
,
source
:
'
Discovery view
'
|
'
Security view
'
|
'
App modal
'
)
=>
{
mixpanel
.
logEvent
(
mixpanel
.
EventTypes
.
PAGE_WIDGET
,
{
Type
:
'
Favorite app
'
,
Info
:
id
});
mixpanel
.
logEvent
(
mixpanel
.
EventTypes
.
PAGE_WIDGET
,
{
Type
:
'
Favorite app
'
,
Info
:
id
,
Source
:
source
});
const
favoriteApps
=
getFavoriteApps
();
const
favoriteApps
=
getFavoriteApps
();
...
...
ui/shared/solidityscanReport/SolidityscanReportButton.tsx
View file @
3bff33f8
...
@@ -21,12 +21,18 @@ interface Props {
...
@@ -21,12 +21,18 @@ interface Props {
isLoading
?:
boolean
;
isLoading
?:
boolean
;
height
?:
string
;
height
?:
string
;
onlyIcon
?:
boolean
;
onlyIcon
?:
boolean
;
onClick
?:
()
=>
void
;
}
}
const
SolidityscanReportButton
=
({
className
,
score
,
popoverContent
,
isLoading
,
height
=
'
32px
'
,
onlyIcon
}:
Props
)
=>
{
const
SolidityscanReportButton
=
({
className
,
score
,
popoverContent
,
isLoading
,
height
=
'
32px
'
,
onlyIcon
,
onClick
}:
Props
)
=>
{
const
{
isOpen
,
onToggle
,
onClose
}
=
useDisclosure
();
const
{
isOpen
,
onToggle
,
onClose
}
=
useDisclosure
();
const
{
scoreColor
}
=
useScoreLevelAndColor
(
score
);
const
{
scoreColor
}
=
useScoreLevelAndColor
(
score
);
const
handleClick
=
React
.
useCallback
(()
=>
{
onClick
?.();
onToggle
();
},
[
onClick
,
onToggle
]);
return
(
return
(
<
Popover
isOpen=
{
isOpen
}
onClose=
{
onClose
}
placement=
"bottom-start"
isLazy
>
<
Popover
isOpen=
{
isOpen
}
onClose=
{
onClose
}
placement=
"bottom-start"
isLazy
>
<
PopoverTrigger
>
<
PopoverTrigger
>
...
@@ -37,7 +43,7 @@ const SolidityscanReportButton = ({ className, score, popoverContent, isLoading,
...
@@ -37,7 +43,7 @@ const SolidityscanReportButton = ({ className, score, popoverContent, isLoading,
size=
"sm"
size=
"sm"
variant=
"outline"
variant=
"outline"
colorScheme=
"gray"
colorScheme=
"gray"
onClick=
{
onToggle
}
onClick=
{
handleClick
}
aria
-
label=
"SolidityScan score"
aria
-
label=
"SolidityScan score"
fontWeight=
{
500
}
fontWeight=
{
500
}
px=
"6px"
px=
"6px"
...
...
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