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
c6133dc4
Commit
c6133dc4
authored
Feb 27, 2024
by
Max Alekseenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add mixpanel event for swap button
parent
d806732c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletion
+17
-1
utils.ts
lib/mixpanel/utils.ts
+6
-1
SwapButton.tsx
ui/snippets/topBar/SwapButton.tsx
+11
-0
No files found.
lib/mixpanel/utils.ts
View file @
c6133dc4
...
...
@@ -17,7 +17,8 @@ export enum EventTypes {
PAGE_WIDGET
=
'
Page widget
'
,
TX_INTERPRETATION_INTERACTION
=
'
Transaction interpratetion interaction
'
,
EXPERIMENT_STARTED
=
'
Experiment started
'
,
FILTERS
=
'
Filters
'
FILTERS
=
'
Filters
'
,
BUTTON_CLICK
=
'
Button click
'
,
}
/* eslint-disable @typescript-eslint/indent */
...
...
@@ -107,5 +108,9 @@ Type extends EventTypes.FILTERS ? {
'
Source
'
:
'
Marketplace
'
;
'
Filter name
'
:
string
;
}
:
Type
extends
EventTypes
.
BUTTON_CLICK
?
{
'
Content
'
:
'
Swap button
'
;
'
Source
'
:
string
;
}
:
undefined
;
/* eslint-enable @typescript-eslint/indent */
ui/snippets/topBar/SwapButton.tsx
View file @
c6133dc4
import
{
Button
,
Box
}
from
'
@chakra-ui/react
'
;
import
{
useRouter
}
from
'
next/router
'
;
import
React
from
'
react
'
;
import
{
route
}
from
'
nextjs-routes
'
;
import
config
from
'
configs/app
'
;
import
getPageType
from
'
lib/mixpanel/getPageType
'
;
import
*
as
mixpanel
from
'
lib/mixpanel/index
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
const
feature
=
config
.
features
.
swapButton
;
const
SwapButton
=
()
=>
{
const
router
=
useRouter
();
const
source
=
getPageType
(
router
.
pathname
);
const
handleClick
=
React
.
useCallback
(()
=>
{
mixpanel
.
logEvent
(
mixpanel
.
EventTypes
.
BUTTON_CLICK
,
{
Content
:
'
Swap button
'
,
Source
:
source
});
},
[
source
]);
if
(
!
feature
.
isEnabled
)
{
return
null
;
}
...
...
@@ -27,6 +37,7 @@ const SwapButton = () => {
borderRadius=
"sm"
height=
{
5
}
px=
{
1.5
}
onClick=
{
handleClick
}
>
<
IconSvg
name=
"swap"
boxSize=
{
3
}
mr=
{
{
base
:
0
,
sm
:
1
}
}
/>
<
Box
display=
{
{
base
:
'
none
'
,
sm
:
'
inline
'
}
}
>
...
...
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