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
02d5fd97
Commit
02d5fd97
authored
Apr 05, 2024
by
Max Alekseenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add event for banner
parent
e6b4b29e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
7 deletions
+13
-7
utils.ts
lib/mixpanel/utils.ts
+5
-0
Banner.tsx
ui/marketplace/Banner.tsx
+8
-7
No files found.
lib/mixpanel/utils.ts
View file @
02d5fd97
...
...
@@ -19,6 +19,7 @@ export enum EventTypes {
EXPERIMENT_STARTED
=
'
Experiment started
'
,
FILTERS
=
'
Filters
'
,
BUTTON_CLICK
=
'
Button click
'
,
PROMO_BANNER
=
'
Promo banner
'
,
}
/* eslint-disable @typescript-eslint/indent */
...
...
@@ -122,5 +123,9 @@ Type extends EventTypes.BUTTON_CLICK ? {
'
Content
'
:
'
Swap button
'
;
'
Source
'
:
string
;
}
:
Type
extends
EventTypes
.
PROMO_BANNER
?
{
'
Source
'
:
'
Marketplace
'
;
'
Link
'
:
string
;
}
:
undefined
;
/* eslint-enable @typescript-eslint/indent */
ui/marketplace/Banner.tsx
View file @
02d5fd97
...
...
@@ -182,16 +182,16 @@ const FeaturedApp = ({
);
};
const
IframeBanner
=
()
=>
{
const
IframeBanner
=
(
{
contentUrl
,
linkUrl
}:
{
contentUrl
:
string
;
linkUrl
:
string
}
)
=>
{
const
[
isFrameLoading
,
setIsFrameLoading
]
=
useState
(
true
);
const
handleIframeLoad
=
useCallback
(()
=>
{
setIsFrameLoading
(
false
);
},
[]);
if
(
!
feature
.
isEnabled
)
{
return
null
;
}
const
handleClick
=
useCallback
(()
=>
{
mixpanel
.
logEvent
(
mixpanel
.
EventTypes
.
PROMO_BANNER
,
{
Source
:
'
Marketplace
'
,
Link
:
linkUrl
})
;
}
,
[
linkUrl
]);
return
(
<
Skeleton
...
...
@@ -204,9 +204,10 @@ const IframeBanner = () => {
overflow=
"hidden"
>
<
Link
href=
{
feature
.
banner
?.
linkUrl
}
href=
{
linkUrl
}
target=
"_blank"
rel=
"noopener noreferrer"
onClick=
{
handleClick
}
position=
"absolute"
w=
"100%"
h=
"100%"
...
...
@@ -218,7 +219,7 @@ const IframeBanner = () => {
as=
"iframe"
h=
"100%"
w=
"100%"
src=
{
feature
.
banner
?.
contentUrl
}
src=
{
contentUrl
}
title=
"Marketplace banner"
onLoad=
{
handleIframeLoad
}
/>
...
...
@@ -248,7 +249,7 @@ const Banner = ({ apps, favoriteApps, isLoading, onInfoClick, onFavoriteClick, o
/>
);
}
else
if
(
feature
.
banner
)
{
return
<
IframeBanner
/>;
return
<
IframeBanner
contentUrl=
{
feature
.
banner
.
contentUrl
}
linkUrl=
{
feature
.
banner
.
linkUrl
}
/>;
}
return
null
;
...
...
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