|
4 | 4 | * See License.AGPL.txt in the project root for license information.
|
5 | 5 | */
|
6 | 6 |
|
7 |
| -import React, { useEffect } from "react"; |
8 | 7 | import { LinkButton } from "@podkit/buttons/LinkButton";
|
9 | 8 | import { Heading2, Subheading } from "@podkit/typography/Headings";
|
10 | 9 | import { trackVideoClick } from "../Analytics";
|
11 | 10 |
|
| 11 | +import "lite-youtube-embed/src/lite-yt-embed.css"; |
| 12 | +import "lite-youtube-embed/src/lite-yt-embed"; |
| 13 | + |
12 | 14 | declare global {
|
13 | 15 | interface Window {
|
14 | 16 | onYouTubeIframeAPIReady: () => void;
|
15 | 17 | YT: any;
|
16 | 18 | }
|
| 19 | + namespace JSX { |
| 20 | + interface IntrinsicElements { |
| 21 | + "lite-youtube": any; |
| 22 | + } |
| 23 | + } |
17 | 24 | }
|
18 | 25 |
|
19 | 26 | export const EmptyWorkspacesContent = () => {
|
20 |
| - useEffect(() => { |
21 |
| - // Load the YouTube IFrame Player API code asynchronously |
22 |
| - const tag = document.createElement("script"); |
23 |
| - tag.src = "https://www.youtube.com/iframe_api"; |
24 |
| - const firstScriptTag = document.getElementsByTagName("script")[0]; |
25 |
| - firstScriptTag.parentNode?.insertBefore(tag, firstScriptTag); |
26 |
| - |
27 |
| - // Create YouTube player when API is ready |
28 |
| - window.onYouTubeIframeAPIReady = () => { |
29 |
| - new window.YT.Player("gitpod-video", { |
30 |
| - events: { |
31 |
| - onStateChange: onPlayerStateChange, |
32 |
| - }, |
33 |
| - }); |
34 |
| - }; |
35 |
| - }, []); |
36 |
| - |
37 |
| - const onPlayerStateChange = (event: any) => { |
38 |
| - if (event.data === window.YT.PlayerState.PLAYING) { |
39 |
| - trackVideoClick("create-new-workspace"); |
40 |
| - } |
| 27 | + const onPlayerStateChange = () => { |
| 28 | + trackVideoClick("create-new-workspace"); |
41 | 29 | };
|
42 | 30 |
|
43 | 31 | return (
|
44 | 32 | <div className="app-container flex flex-col space-y-2">
|
45 |
| - <div className="px-6 mt-16 flex flex-row items-center justify-center space-x-14"> |
46 |
| - <div> |
47 |
| - <iframe |
48 |
| - id="gitpod-video" |
49 |
| - width="535" |
50 |
| - height="307" |
51 |
| - src="https://www.youtube.com/embed/1ZBN-b2cIB8?enablejsapi=1&modestbranding=1&rel=0&controls=1&showinfo=0&fs=1" |
52 |
| - title="YouTube - Gitpod in 120 seconds" |
53 |
| - allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" |
54 |
| - allowFullScreen |
55 |
| - className="rounded-xl" |
56 |
| - ></iframe> |
57 |
| - </div> |
58 |
| - <div> |
59 |
| - <div className="flex flex-col items-left justify-center h-96 w-96"> |
60 |
| - <Heading2 className="text-left mb-4 !font-semibold !text-lg"> |
61 |
| - Create your first workspace |
62 |
| - </Heading2> |
63 |
| - <Subheading className="text-left max-w-xs"> |
64 |
| - Write code in your personal development environment that’s running in the cloud |
65 |
| - </Subheading> |
66 |
| - <span className="flex flex-col space-y-4 w-fit"> |
67 |
| - <LinkButton |
68 |
| - variant="secondary" |
69 |
| - className="mt-4 border !border-pk-content-invert-primary text-pk-content-secondary bg-pk-surface-secondary" |
70 |
| - href={"/new?showExamples=true"} |
71 |
| - > |
72 |
| - Try a configured demo repository |
73 |
| - </LinkButton> |
74 |
| - <LinkButton href={"/new"} className="gap-1.5"> |
75 |
| - Configure your own repository |
76 |
| - </LinkButton> |
77 |
| - </span> |
78 |
| - </div> |
| 33 | + <div className="px-6 mt-16 flex flex-col xl:flex-row items-center justify-center gap-x-14 gap-y-10 min-h-96 min-w-96"> |
| 34 | + <lite-youtube |
| 35 | + videoid="1ZBN-b2cIB8" |
| 36 | + width="535" |
| 37 | + height="307" |
| 38 | + onClick={onPlayerStateChange} |
| 39 | + style={{ |
| 40 | + width: "535px", |
| 41 | + backgroundImage: "url('https://i.ytimg.com/vi_webp/1ZBN-b2cIB8/maxresdefault.webp')", |
| 42 | + }} |
| 43 | + class="rounded-xl" |
| 44 | + playlabel="Gitpod in under 120 seconds" |
| 45 | + ></lite-youtube> |
| 46 | + <div className="flex flex-col items-center xl:items-start justify-center"> |
| 47 | + <Heading2 className="mb-4 !font-semibold !text-lg">Create your first workspace</Heading2> |
| 48 | + <Subheading className="max-w-xs xl:text-left text-center"> |
| 49 | + Write code in your personal development environment that’s running in the cloud |
| 50 | + </Subheading> |
| 51 | + <span className="flex flex-col space-y-4 w-fit"> |
| 52 | + <LinkButton |
| 53 | + variant="secondary" |
| 54 | + className="mt-4 border !border-pk-content-invert-primary text-pk-content-secondary bg-pk-surface-secondary" |
| 55 | + href={"/new?showExamples=true"} |
| 56 | + > |
| 57 | + Try a configured demo repository |
| 58 | + </LinkButton> |
| 59 | + <LinkButton href={"/new"} className="gap-1.5"> |
| 60 | + Configure your own repository |
| 61 | + </LinkButton> |
| 62 | + </span> |
79 | 63 | </div>
|
80 | 64 | </div>
|
81 | 65 | </div>
|
|
0 commit comments