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
486fce60
Commit
486fce60
authored
Jun 09, 2025
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add more "button click" events
parent
3bbeec15
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
5 deletions
+35
-5
index.ts
lib/mixpanel/index.ts
+2
-1
MarketplaceAppTopBar.tsx
ui/marketplace/MarketplaceAppTopBar.tsx
+6
-0
PageTitle.tsx
ui/shared/Page/PageTitle.tsx
+10
-1
TimeFormatToggle.tsx
ui/shared/time/TimeFormatToggle.tsx
+7
-1
useNetworkMenu.tsx
ui/snippets/networkMenu/useNetworkMenu.tsx
+10
-2
No files found.
lib/mixpanel/index.ts
View file @
486fce60
import
getPageType
from
'
./getPageType
'
;
import
getPageType
,
{
PAGE_TYPE_DICT
}
from
'
./getPageType
'
;
import
logEvent
from
'
./logEvent
'
;
import
reset
from
'
./reset
'
;
import
useInit
from
'
./useInit
'
;
...
...
@@ -13,4 +13,5 @@ export {
getPageType
,
userProfile
,
reset
,
PAGE_TYPE_DICT
,
};
ui/marketplace/MarketplaceAppTopBar.tsx
View file @
486fce60
...
...
@@ -8,6 +8,7 @@ import { route } from 'nextjs-routes';
import
config
from
'
configs/app
'
;
import
{
useAppContext
}
from
'
lib/contexts/app
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
*
as
mixpanel
from
'
lib/mixpanel/index
'
;
import
{
Link
}
from
'
toolkit/chakra/link
'
;
import
{
BackToButton
}
from
'
toolkit/components/buttons/BackToButton
'
;
import
{
makePrettyLink
}
from
'
toolkit/utils/url
'
;
...
...
@@ -46,6 +47,10 @@ const MarketplaceAppTopBar = ({ appId, data, isLoading, securityReport }: Props)
const
showContractList
=
React
.
useCallback
((
id
:
string
,
type
:
ContractListTypes
)
=>
setContractListType
(
type
),
[]);
const
hideContractList
=
React
.
useCallback
(()
=>
setContractListType
(
undefined
),
[]);
const
handleBackToClick
=
React
.
useCallback
(()
=>
{
mixpanel
.
logEvent
(
mixpanel
.
EventTypes
.
BUTTON_CLICK
,
{
Content
:
'
Back to
'
,
Source
:
mixpanel
.
PAGE_TYPE_DICT
[
'
/apps/[id]
'
]
});
},
[]);
return
(
<>
<
Flex
alignItems=
"center"
mb=
{
{
base
:
3
,
md
:
2
}
}
rowGap=
{
3
}
columnGap=
{
2
}
>
...
...
@@ -54,6 +59,7 @@ const MarketplaceAppTopBar = ({ appId, data, isLoading, securityReport }: Props)
href=
{
goBackUrl
}
hint=
"Back to dApps list"
loading=
{
isLoading
}
onClick=
{
handleBackToClick
}
/>
<
Link
external
...
...
ui/shared/Page/PageTitle.tsx
View file @
486fce60
import
{
Flex
,
chakra
}
from
'
@chakra-ui/react
'
;
import
{
debounce
}
from
'
es-toolkit
'
;
import
{
useRouter
}
from
'
next/router
'
;
import
React
from
'
react
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
*
as
mixpanel
from
'
lib/mixpanel/index
'
;
import
{
Heading
}
from
'
toolkit/chakra/heading
'
;
import
{
Skeleton
}
from
'
toolkit/chakra/skeleton
'
;
import
{
Tooltip
}
from
'
toolkit/chakra/tooltip
'
;
...
...
@@ -29,10 +31,12 @@ const TEXT_MAX_LINES = 1;
const
PageTitle
=
({
title
,
contentAfter
,
withTextAd
,
backLink
,
className
,
isLoading
=
false
,
afterTitle
,
beforeTitle
,
secondRow
}:
Props
)
=>
{
const
tooltip
=
useDisclosure
();
const
isMobile
=
useIsMobile
();
const
router
=
useRouter
();
const
[
isTextTruncated
,
setIsTextTruncated
]
=
React
.
useState
(
false
);
const
headingRef
=
React
.
useRef
<
HTMLHeadingElement
>
(
null
);
const
textRef
=
React
.
useRef
<
HTMLSpanElement
>
(
null
);
const
pageType
=
mixpanel
.
getPageType
(
router
.
pathname
);
const
updatedTruncateState
=
React
.
useCallback
(()
=>
{
if
(
!
headingRef
.
current
||
!
textRef
.
current
)
{
...
...
@@ -71,6 +75,11 @@ const PageTitle = ({ title, contentAfter, withTextAd, backLink, className, isLoa
}
},
[
tooltip
]);
const
handleBackToClick
=
React
.
useCallback
(()
=>
{
mixpanel
.
logEvent
(
mixpanel
.
EventTypes
.
BUTTON_CLICK
,
{
Content
:
'
Back to
'
,
Source
:
pageType
});
backLink
&&
'
onClick
'
in
backLink
&&
backLink
.
onClick
();
},
[
backLink
,
pageType
]);
return
(
<
Flex
className=
{
className
}
flexDir=
"column"
rowGap=
{
3
}
mb=
{
6
}
>
<
Flex
...
...
@@ -85,7 +94,7 @@ const PageTitle = ({ title, contentAfter, withTextAd, backLink, className, isLoa
<
BackToButton
hint=
{
backLink
.
label
}
href=
{
'
url
'
in
backLink
?
backLink
.
url
:
undefined
}
onClick=
{
'
onClick
'
in
backLink
?
backLink
.
onClick
:
undefined
}
onClick=
{
handleBackToClick
}
loadingSkeleton=
{
isLoading
}
mr=
{
3
}
/>
...
...
ui/shared/time/TimeFormatToggle.tsx
View file @
486fce60
import
React
from
'
react
'
;
import
{
useSettingsContext
}
from
'
lib/contexts/settings
'
;
import
*
as
mixpanel
from
'
lib/mixpanel/index
'
;
import
{
IconButton
}
from
'
toolkit/chakra/icon-button
'
;
import
type
{
IconButtonProps
}
from
'
toolkit/chakra/icon-button
'
;
import
{
Tooltip
}
from
'
toolkit/chakra/tooltip
'
;
...
...
@@ -12,12 +13,17 @@ const TimeFormatToggle = (props: Props) => {
const
settings
=
useSettingsContext
();
const
timeFormat
=
settings
?.
timeFormat
||
'
relative
'
;
const
handleClick
=
React
.
useCallback
(()
=>
{
settings
?.
toggleTimeFormat
();
mixpanel
.
logEvent
(
mixpanel
.
EventTypes
.
BUTTON_CLICK
,
{
Content
:
'
Switch time format
'
,
Source
:
'
Table header
'
});
},
[
settings
]);
return
(
<
Tooltip
content=
"Toggle time format"
>
<
IconButton
aria
-
label=
"Toggle time format"
variant=
"icon_secondary"
onClick=
{
settings
?.
toggleTimeFormat
}
onClick=
{
handleClick
}
boxSize=
{
5
}
selected=
{
timeFormat
===
'
absolute
'
}
borderRadius=
"sm"
...
...
ui/snippets/networkMenu/useNetworkMenu.tsx
View file @
486fce60
...
...
@@ -7,6 +7,7 @@ import { NETWORK_GROUPS } from 'types/networks';
import
config
from
'
configs/app
'
;
import
type
{
ResourceError
}
from
'
lib/api/resources
'
;
import
useFetch
from
'
lib/hooks/useFetch
'
;
import
*
as
mixpanel
from
'
lib/mixpanel/index
'
;
import
{
useDisclosure
}
from
'
toolkit/hooks/useDisclosure
'
;
export
default
function
useNetworkMenu
()
{
...
...
@@ -20,14 +21,21 @@ export default function useNetworkMenu() {
staleTime
:
Infinity
,
});
const
handleOpenChange
=
React
.
useCallback
((
details
:
{
open
:
boolean
})
=>
{
if
(
details
.
open
)
{
mixpanel
.
logEvent
(
mixpanel
.
EventTypes
.
BUTTON_CLICK
,
{
Content
:
'
Network menu
'
,
Source
:
'
Header
'
});
}
onOpenChange
(
details
);
},
[
onOpenChange
]);
return
React
.
useMemo
(()
=>
({
open
,
onClose
,
onOpen
,
onToggle
,
onOpenChange
,
onOpenChange
:
handleOpenChange
,
isPending
,
data
,
availableTabs
:
NETWORK_GROUPS
.
filter
((
tab
)
=>
data
?.
some
(({
group
})
=>
group
===
tab
)),
}),
[
open
,
onClose
,
onOpen
,
onToggle
,
on
OpenChange
,
data
,
isPending
]);
}),
[
open
,
onClose
,
onOpen
,
onToggle
,
handle
OpenChange
,
data
,
isPending
]);
}
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