Skip to content

Commit 7c50ff0

Browse files
authored
fix: Add missing eventing to firstMile video (#4640)
* fix: add eventing to onboarding wizard videos
1 parent db0ebb6 commit 7c50ff0

File tree

4 files changed

+59
-39
lines changed

4 files changed

+59
-39
lines changed
Lines changed: 53 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,59 @@
1-
import React, {PureComponent} from 'react'
1+
import React, {FC, useEffect, useRef} from 'react'
22
import {SafeBlankLink} from 'src/utils/SafeBlankLink'
3+
import {event} from 'src/cloud/utils/reporting'
34

4-
export class Overview extends PureComponent {
5-
render() {
6-
return (
7-
<div>
8-
<h1>Hello, Time-Series World!</h1>
9-
<article>
10-
<p>Welcome and thanks for checking out InfluxData!</p>
5+
type Props = {
6+
wizard: string
7+
}
8+
9+
export const Overview: FC<Props> = ({wizard}) => {
10+
const videoFrame = useRef<null | HTMLIFrameElement>(null)
11+
12+
// iFrames represent separate browsing context, requiring this workaround. For more, see resolution of this ticket (https://github.com/influxdata/ui/issues/4623)
1113

12-
<p>
13-
In the next 5 minutes, you will set up InfluxData on your machine
14-
and write and execute some basic queries.
15-
</p>
14+
useEffect(() => {
15+
const checkVidClick = () => {
16+
if (
17+
document.activeElement &&
18+
document.activeElement.nodeName.toLowerCase() === 'iframe' &&
19+
videoFrame.current &&
20+
videoFrame.current === document.activeElement
21+
) {
22+
event(`firstMile.${wizard}Video.clicked`)
23+
}
24+
}
25+
window.addEventListener('blur', checkVidClick)
26+
}, [])
1627

17-
<iframe
18-
width="560"
19-
height="315"
20-
src="https://www.youtube.com/embed/KZwr1xBDbBQ"
21-
title="InfluxData - What is Time Series"
22-
frameBorder="0"
23-
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
24-
allowFullScreen
25-
style={{marginBottom: '20px'}}
26-
/>
28+
return (
29+
<div>
30+
<h1>Hello, Time-Series World!</h1>
31+
<article>
32+
<p>Welcome and thanks for checking out InfluxData!</p>
2733

28-
<p>
29-
Join our{' '}
30-
<SafeBlankLink href="https://www.influxdata.com/slack">
31-
community slack{' '}
32-
</SafeBlankLink>{' '}
33-
to ask any questions you have along the way!
34-
</p>
35-
</article>
36-
</div>
37-
)
38-
}
34+
<p>
35+
In the next 5 minutes, you will set up InfluxData on your machine and
36+
write and execute some basic queries.
37+
</p>
38+
<iframe
39+
ref={videoFrame}
40+
width="560"
41+
height="315"
42+
src="https://www.youtube.com/embed/KZwr1xBDbBQ"
43+
title="InfluxData - What is Time Series"
44+
frameBorder="0"
45+
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
46+
allowFullScreen
47+
style={{marginBottom: '20px'}}
48+
/>
49+
<p>
50+
Join our{' '}
51+
<SafeBlankLink href="https://www.influxdata.com/slack">
52+
community slack{' '}
53+
</SafeBlankLink>{' '}
54+
to ask any questions you have along the way!
55+
</p>
56+
</article>
57+
</div>
58+
)
3959
}

src/homepageExperience/containers/GoWizard.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export class GoWizard extends PureComponent<null, State> {
9191
renderStep = () => {
9292
switch (this.state.currentStep) {
9393
case 1: {
94-
return <Overview />
94+
return <Overview wizard="goWizard" />
9595
}
9696
case 2: {
9797
return <InstallDependencies />
@@ -129,7 +129,7 @@ export class GoWizard extends PureComponent<null, State> {
129129
)
130130
}
131131
default: {
132-
return <Overview />
132+
return <Overview wizard="goWizard" />
133133
}
134134
}
135135
}

src/homepageExperience/containers/NodejsWizard.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export class NodejsWizard extends PureComponent<null, State> {
9191
renderStep = () => {
9292
switch (this.state.currentStep) {
9393
case 1: {
94-
return <Overview />
94+
return <Overview wizard="nodejsWizard" />
9595
}
9696
case 2: {
9797
return <InstallDependencies />
@@ -129,7 +129,7 @@ export class NodejsWizard extends PureComponent<null, State> {
129129
)
130130
}
131131
default: {
132-
return <Overview />
132+
return <Overview wizard="nodejsWizard" />
133133
}
134134
}
135135
}

src/homepageExperience/containers/PythonWizard.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export class PythonWizard extends PureComponent<null, State> {
9292
renderStep = () => {
9393
switch (this.state.currentStep) {
9494
case 1: {
95-
return <Overview />
95+
return <Overview wizard="pythonWizard" />
9696
}
9797
case 2: {
9898
return <InstallDependencies />
@@ -130,7 +130,7 @@ export class PythonWizard extends PureComponent<null, State> {
130130
)
131131
}
132132
default: {
133-
return <Overview />
133+
return <Overview wizard="pythonWizard" />
134134
}
135135
}
136136
}

0 commit comments

Comments
 (0)