|
1 | | -import React, {PureComponent} from 'react' |
| 1 | +import React, {FC, useEffect, useRef} from 'react' |
2 | 2 | import {SafeBlankLink} from 'src/utils/SafeBlankLink' |
| 3 | +import {event} from 'src/cloud/utils/reporting' |
3 | 4 |
|
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) |
11 | 13 |
|
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 | + }, []) |
16 | 27 |
|
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> |
27 | 33 |
|
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 | + ) |
39 | 59 | } |
0 commit comments