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
e9e3cc24
Commit
e9e3cc24
authored
Jan 12, 2024
by
Max Alekseenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add new mixpanel events
parent
596ad55c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
89 additions
and
39 deletions
+89
-39
utils.ts
lib/mixpanel/utils.ts
+23
-4
MarketplaceAppCard.tsx
ui/marketplace/MarketplaceAppCard.tsx
+2
-0
useMarketplace.tsx
ui/marketplace/useMarketplace.tsx
+9
-0
WalletMenuContent.tsx
ui/snippets/walletMenu/WalletMenuContent.tsx
+41
-33
WalletMenuDesktop.tsx
ui/snippets/walletMenu/WalletMenuDesktop.tsx
+7
-1
WalletMenuMobile.tsx
ui/snippets/walletMenu/WalletMenuMobile.tsx
+7
-1
No files found.
lib/mixpanel/utils.ts
View file @
e9e3cc24
...
@@ -3,17 +3,20 @@ import type { WalletType } from 'types/client/wallets';
...
@@ -3,17 +3,20 @@ import type { WalletType } from 'types/client/wallets';
export
enum
EventTypes
{
export
enum
EventTypes
{
PAGE_VIEW
=
'
Page view
'
,
PAGE_VIEW
=
'
Page view
'
,
SEARCH_QUERY
=
'
Search query
'
,
SEARCH_QUERY
=
'
Search query
'
,
LOCAL_SEARCH
=
'
Local search
'
,
ADD_TO_WALLET
=
'
Add to wallet
'
,
ADD_TO_WALLET
=
'
Add to wallet
'
,
ACCOUNT_ACCESS
=
'
Account access
'
,
ACCOUNT_ACCESS
=
'
Account access
'
,
PRIVATE_TAG
=
'
Private tag
'
,
PRIVATE_TAG
=
'
Private tag
'
,
VERIFY_ADDRESS
=
'
Verify address
'
,
VERIFY_ADDRESS
=
'
Verify address
'
,
VERIFY_TOKEN
=
'
Verify token
'
,
VERIFY_TOKEN
=
'
Verify token
'
,
WALLET_CONNECT
=
'
Wallet connect
'
,
WALLET_CONNECT
=
'
Wallet connect
'
,
WALLET_ACTION
=
'
Wallet action
'
,
CONTRACT_INTERACTION
=
'
Contract interaction
'
,
CONTRACT_INTERACTION
=
'
Contract interaction
'
,
CONTRACT_VERIFICATION
=
'
Contract verification
'
,
CONTRACT_VERIFICATION
=
'
Contract verification
'
,
QR_CODE
=
'
QR code
'
,
QR_CODE
=
'
QR code
'
,
PAGE_WIDGET
=
'
Page widget
'
,
PAGE_WIDGET
=
'
Page widget
'
,
TX_INTERPRETATION_INTERACTION
=
'
Transaction interpratetion interaction
'
TX_INTERPRETATION_INTERACTION
=
'
Transaction interpratetion interaction
'
,
FILTERS
=
'
Filters
'
}
}
/* eslint-disable @typescript-eslint/indent */
/* eslint-disable @typescript-eslint/indent */
...
@@ -30,6 +33,10 @@ Type extends EventTypes.SEARCH_QUERY ? {
...
@@ -30,6 +33,10 @@ Type extends EventTypes.SEARCH_QUERY ? {
'
Source page type
'
:
string
;
'
Source page type
'
:
string
;
'
Result URL
'
:
string
;
'
Result URL
'
:
string
;
}
:
}
:
Type
extends
EventTypes
.
LOCAL_SEARCH
?
{
'
Search query
'
:
string
;
'
Source
'
:
'
Marketplace
'
;
}
:
Type
extends
EventTypes
.
ADD_TO_WALLET
?
(
Type
extends
EventTypes
.
ADD_TO_WALLET
?
(
{
{
'
Wallet
'
:
WalletType
;
'
Wallet
'
:
WalletType
;
...
@@ -65,6 +72,9 @@ Type extends EventTypes.WALLET_CONNECT ? {
...
@@ -65,6 +72,9 @@ Type extends EventTypes.WALLET_CONNECT ? {
'
Source
'
:
'
Header
'
|
'
Smart contracts
'
;
'
Source
'
:
'
Header
'
|
'
Smart contracts
'
;
'
Status
'
:
'
Started
'
|
'
Connected
'
;
'
Status
'
:
'
Started
'
|
'
Connected
'
;
}
:
}
:
Type
extends
EventTypes
.
WALLET_ACTION
?
{
'
Action
'
:
'
Open
'
|
'
Address click
'
;
}
:
Type
extends
EventTypes
.
CONTRACT_INTERACTION
?
{
Type
extends
EventTypes
.
CONTRACT_INTERACTION
?
{
'
Method type
'
:
'
Read
'
|
'
Write
'
;
'
Method type
'
:
'
Read
'
|
'
Write
'
;
'
Method name
'
:
string
;
'
Method name
'
:
string
;
...
@@ -76,11 +86,20 @@ Type extends EventTypes.CONTRACT_VERIFICATION ? {
...
@@ -76,11 +86,20 @@ Type extends EventTypes.CONTRACT_VERIFICATION ? {
Type
extends
EventTypes
.
QR_CODE
?
{
Type
extends
EventTypes
.
QR_CODE
?
{
'
Page type
'
:
string
;
'
Page type
'
:
string
;
}
:
}
:
Type
extends
EventTypes
.
PAGE_WIDGET
?
{
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
'
;
'
Info
'
:
string
;
}
)
:
Type
extends
EventTypes
.
TX_INTERPRETATION_INTERACTION
?
{
Type
extends
EventTypes
.
TX_INTERPRETATION_INTERACTION
?
{
'
Type
'
:
'
Address click
'
|
'
Token click
'
;
'
Type
'
:
'
Address click
'
|
'
Token click
'
;
}
:
}
:
Type
extends
EventTypes
.
FILTERS
?
{
'
Source
'
:
'
Marketplace
'
;
'
Filter name
'
:
string
;
}
:
undefined
;
undefined
;
/* eslint-enable @typescript-eslint/indent */
/* eslint-enable @typescript-eslint/indent */
ui/marketplace/MarketplaceAppCard.tsx
View file @
e9e3cc24
...
@@ -4,6 +4,7 @@ import React, { useCallback } from 'react';
...
@@ -4,6 +4,7 @@ import React, { useCallback } from 'react';
import
type
{
MarketplaceAppPreview
}
from
'
types/client/marketplace
'
;
import
type
{
MarketplaceAppPreview
}
from
'
types/client/marketplace
'
;
import
*
as
mixpanel
from
'
lib/mixpanel/index
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
import
MarketplaceAppCardLink
from
'
./MarketplaceAppCardLink
'
;
import
MarketplaceAppCardLink
from
'
./MarketplaceAppCardLink
'
;
...
@@ -43,6 +44,7 @@ const MarketplaceAppCard = ({
...
@@ -43,6 +44,7 @@ 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
});
onInfoClick
(
id
);
onInfoClick
(
id
);
},
[
onInfoClick
,
id
]);
},
[
onInfoClick
,
id
]);
...
...
ui/marketplace/useMarketplace.tsx
View file @
e9e3cc24
...
@@ -6,6 +6,7 @@ import React from 'react';
...
@@ -6,6 +6,7 @@ import React from 'react';
import
{
MarketplaceCategory
}
from
'
types/client/marketplace
'
;
import
{
MarketplaceCategory
}
from
'
types/client/marketplace
'
;
import
useDebounce
from
'
lib/hooks/useDebounce
'
;
import
useDebounce
from
'
lib/hooks/useDebounce
'
;
import
*
as
mixpanel
from
'
lib/mixpanel/index
'
;
import
getQueryParamString
from
'
lib/router/getQueryParamString
'
;
import
getQueryParamString
from
'
lib/router/getQueryParamString
'
;
import
useMarketplaceApps
from
'
./useMarketplaceApps
'
;
import
useMarketplaceApps
from
'
./useMarketplaceApps
'
;
...
@@ -33,6 +34,8 @@ export default function useMarketplace() {
...
@@ -33,6 +34,8 @@ export default function useMarketplace() {
const
[
isDisclaimerModalOpen
,
setIsDisclaimerModalOpen
]
=
React
.
useState
<
boolean
>
(
false
);
const
[
isDisclaimerModalOpen
,
setIsDisclaimerModalOpen
]
=
React
.
useState
<
boolean
>
(
false
);
const
handleFavoriteClick
=
React
.
useCallback
((
id
:
string
,
isFavorite
:
boolean
)
=>
{
const
handleFavoriteClick
=
React
.
useCallback
((
id
:
string
,
isFavorite
:
boolean
)
=>
{
mixpanel
.
logEvent
(
mixpanel
.
EventTypes
.
PAGE_WIDGET
,
{
Type
:
'
Favorite app
'
,
Info
:
id
});
const
favoriteApps
=
getFavoriteApps
();
const
favoriteApps
=
getFavoriteApps
();
if
(
isFavorite
)
{
if
(
isFavorite
)
{
...
@@ -64,6 +67,7 @@ export default function useMarketplace() {
...
@@ -64,6 +67,7 @@ export default function useMarketplace() {
},
[]);
},
[]);
const
handleCategoryChange
=
React
.
useCallback
((
newCategory
:
string
)
=>
{
const
handleCategoryChange
=
React
.
useCallback
((
newCategory
:
string
)
=>
{
mixpanel
.
logEvent
(
mixpanel
.
EventTypes
.
FILTERS
,
{
Source
:
'
Marketplace
'
,
'
Filter name
'
:
newCategory
});
setSelectedCategoryId
(
newCategory
);
setSelectedCategoryId
(
newCategory
);
},
[]);
},
[]);
...
@@ -91,6 +95,11 @@ export default function useMarketplace() {
...
@@ -91,6 +95,11 @@ export default function useMarketplace() {
category
:
selectedCategoryId
===
MarketplaceCategory
.
ALL
?
undefined
:
selectedCategoryId
,
category
:
selectedCategoryId
===
MarketplaceCategory
.
ALL
?
undefined
:
selectedCategoryId
,
filter
:
debouncedFilterQuery
,
filter
:
debouncedFilterQuery
,
},
Boolean
);
},
Boolean
);
if
(
debouncedFilterQuery
.
length
>
0
)
{
mixpanel
.
logEvent
(
mixpanel
.
EventTypes
.
LOCAL_SEARCH
,
{
Source
:
'
Marketplace
'
,
'
Search query
'
:
debouncedFilterQuery
});
}
router
.
replace
(
router
.
replace
(
{
pathname
:
'
/apps
'
,
query
},
{
pathname
:
'
/apps
'
,
query
},
undefined
,
undefined
,
...
...
ui/snippets/walletMenu/WalletMenuContent.tsx
View file @
e9e3cc24
import
{
Box
,
Button
,
Text
}
from
'
@chakra-ui/react
'
;
import
{
Box
,
Button
,
Text
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
*
as
mixpanel
from
'
lib/mixpanel/index
'
;
import
getDefaultTransitionProps
from
'
theme/utils/getDefaultTransitionProps
'
;
import
getDefaultTransitionProps
from
'
theme/utils/getDefaultTransitionProps
'
;
import
AddressEntity
from
'
ui/shared/entities/address/AddressEntity
'
;
import
AddressEntity
from
'
ui/shared/entities/address/AddressEntity
'
;
...
@@ -9,38 +10,45 @@ type Props = {
...
@@ -9,38 +10,45 @@ type Props = {
disconnect
?:
()
=>
void
;
disconnect
?:
()
=>
void
;
};
};
const
WalletMenuContent
=
({
address
,
disconnect
}:
Props
)
=>
(
const
WalletMenuContent
=
({
address
,
disconnect
}:
Props
)
=>
{
<
Box
>
const
onAddressClick
=
React
.
useCallback
(()
=>
{
<
Text
mixpanel
.
logEvent
(
mixpanel
.
EventTypes
.
WALLET_ACTION
,
{
Action
:
'
Address click
'
});
fontSize=
"sm"
},
[]);
fontWeight=
{
600
}
mb=
{
1
}
return
(
{
...
getDefaultTransitionProps
()
}
<
Box
>
>
<
Text
My wallet
fontSize=
"sm"
</
Text
>
fontWeight=
{
600
}
<
Text
mb=
{
1
}
fontSize=
"sm"
{
...
getDefaultTransitionProps
()
}
mb=
{
5
}
>
fontWeight=
{
400
}
My wallet
color=
"text_secondary"
</
Text
>
{
...
getDefaultTransitionProps
()
}
<
Text
>
fontSize=
"sm"
Your wallet is used to interact with apps and contracts in the explorer.
mb=
{
5
}
</
Text
>
fontWeight=
{
400
}
<
AddressEntity
color=
"text_secondary"
address=
{
{
hash
:
address
}
}
{
...
getDefaultTransitionProps
()
}
noTooltip
>
truncation=
"dynamic"
Your wallet is used to interact with apps and contracts in the explorer.
fontSize=
"sm"
</
Text
>
fontWeight=
{
700
}
<
AddressEntity
color=
"text"
address=
{
{
hash
:
address
}
}
mb=
{
6
}
noTooltip
/>
truncation=
"dynamic"
<
Button
size=
"sm"
width=
"full"
variant=
"outline"
onClick=
{
disconnect
}
>
fontSize=
"sm"
Disconnect
fontWeight=
{
700
}
</
Button
>
color=
"text"
</
Box
>
mb=
{
6
}
);
onClick=
{
onAddressClick
}
/>
<
Button
size=
"sm"
width=
"full"
variant=
"outline"
onClick=
{
disconnect
}
>
Disconnect
</
Button
>
</
Box
>
);
};
export
default
WalletMenuContent
;
export
default
WalletMenuContent
;
ui/snippets/walletMenu/WalletMenuDesktop.tsx
View file @
e9e3cc24
...
@@ -3,6 +3,7 @@ import { Popover, PopoverContent, PopoverBody, PopoverTrigger, Button, Box, useB
...
@@ -3,6 +3,7 @@ import { Popover, PopoverContent, PopoverBody, PopoverTrigger, Button, Box, useB
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
*
as
mixpanel
from
'
lib/mixpanel/index
'
;
import
AddressIdenticon
from
'
ui/shared/entities/address/AddressIdenticon
'
;
import
AddressIdenticon
from
'
ui/shared/entities/address/AddressIdenticon
'
;
import
HashStringShorten
from
'
ui/shared/HashStringShorten
'
;
import
HashStringShorten
from
'
ui/shared/HashStringShorten
'
;
import
useWallet
from
'
ui/snippets/walletMenu/useWallet
'
;
import
useWallet
from
'
ui/snippets/walletMenu/useWallet
'
;
...
@@ -48,6 +49,11 @@ const WalletMenuDesktop = ({ isHomePage }: Props) => {
...
@@ -48,6 +49,11 @@ const WalletMenuDesktop = ({ isHomePage }: Props) => {
};
};
}
}
const
openPopover
=
React
.
useCallback
(()
=>
{
mixpanel
.
logEvent
(
mixpanel
.
EventTypes
.
WALLET_ACTION
,
{
Action
:
'
Open
'
});
setIsPopoverOpen
.
on
();
},
[
setIsPopoverOpen
]);
return
(
return
(
<
Popover
<
Popover
openDelay=
{
300
}
openDelay=
{
300
}
...
@@ -66,7 +72,7 @@ const WalletMenuDesktop = ({ isHomePage }: Props) => {
...
@@ -66,7 +72,7 @@ const WalletMenuDesktop = ({ isHomePage }: Props) => {
flexShrink=
{
0
}
flexShrink=
{
0
}
isLoading=
{
isModalOpening
||
isModalOpen
}
isLoading=
{
isModalOpening
||
isModalOpen
}
loadingText=
"Connect wallet"
loadingText=
"Connect wallet"
onClick=
{
isWalletConnected
?
setIsPopoverOpen
.
on
:
connect
}
onClick=
{
isWalletConnected
?
openPopover
:
connect
}
fontSize=
"sm"
fontSize=
"sm"
{
...
buttonStyles
}
{
...
buttonStyles
}
>
>
...
...
ui/snippets/walletMenu/WalletMenuMobile.tsx
View file @
e9e3cc24
...
@@ -2,6 +2,7 @@ import { Drawer, DrawerOverlay, DrawerContent, DrawerBody, useDisclosure, IconBu
...
@@ -2,6 +2,7 @@ import { Drawer, DrawerOverlay, DrawerContent, DrawerBody, useDisclosure, IconBu
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
*
as
mixpanel
from
'
lib/mixpanel/index
'
;
import
AddressIdenticon
from
'
ui/shared/entities/address/AddressIdenticon
'
;
import
AddressIdenticon
from
'
ui/shared/entities/address/AddressIdenticon
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
import
useWallet
from
'
ui/snippets/walletMenu/useWallet
'
;
import
useWallet
from
'
ui/snippets/walletMenu/useWallet
'
;
...
@@ -16,6 +17,11 @@ const WalletMenuMobile = () => {
...
@@ -16,6 +17,11 @@ const WalletMenuMobile = () => {
const
{
themedBackground
,
themedBorderColor
,
themedColor
}
=
useMenuButtonColors
();
const
{
themedBackground
,
themedBorderColor
,
themedColor
}
=
useMenuButtonColors
();
const
isMobile
=
useIsMobile
();
const
isMobile
=
useIsMobile
();
const
openPopover
=
React
.
useCallback
(()
=>
{
mixpanel
.
logEvent
(
mixpanel
.
EventTypes
.
WALLET_ACTION
,
{
Action
:
'
Open
'
});
onOpen
();
},
[
onOpen
]);
return
(
return
(
<>
<>
<
WalletTooltip
isDisabled=
{
isWalletConnected
||
isMobile
===
undefined
||
!
isMobile
}
isMobile
>
<
WalletTooltip
isDisabled=
{
isWalletConnected
||
isMobile
===
undefined
||
!
isMobile
}
isMobile
>
...
@@ -32,7 +38,7 @@ const WalletMenuMobile = () => {
...
@@ -32,7 +38,7 @@ const WalletMenuMobile = () => {
bg=
{
isWalletConnected
?
themedBackground
:
undefined
}
bg=
{
isWalletConnected
?
themedBackground
:
undefined
}
color=
{
themedColor
}
color=
{
themedColor
}
borderColor=
{
!
isWalletConnected
?
themedBorderColor
:
undefined
}
borderColor=
{
!
isWalletConnected
?
themedBorderColor
:
undefined
}
onClick=
{
isWalletConnected
?
o
nOpen
:
connect
}
onClick=
{
isWalletConnected
?
o
penPopover
:
connect
}
isLoading=
{
isModalOpening
||
isModalOpen
}
isLoading=
{
isModalOpening
||
isModalOpen
}
/>
/>
</
WalletTooltip
>
</
WalletTooltip
>
...
...
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