|
4 | 4 | * See License.AGPL.txt in the project root for license information.
|
5 | 5 | */
|
6 | 6 |
|
| 7 | +import React, { useEffect } from "react"; |
7 | 8 | import { StartWorkspaceModalKeyBinding } from "../App";
|
8 | 9 | import { LinkButton } from "@podkit/buttons/LinkButton";
|
9 |
| -import { Heading2, Subheading } from "@podkit/typography/Headings"; |
| 10 | +import { Heading1, Heading2, Subheading } from "@podkit/typography/Headings"; |
| 11 | +import { trackVideoClick } from "../Analytics"; |
| 12 | + |
| 13 | +declare global { |
| 14 | + interface Window { |
| 15 | + onYouTubeIframeAPIReady: () => void; |
| 16 | + YT: any; |
| 17 | + } |
| 18 | +} |
10 | 19 |
|
11 | 20 | export const EmptyWorkspacesContent = () => {
|
| 21 | + useEffect(() => { |
| 22 | + // Load the YouTube IFrame Player API code asynchronously |
| 23 | + const tag = document.createElement("script"); |
| 24 | + tag.src = "https://www.youtube.com/iframe_api"; |
| 25 | + const firstScriptTag = document.getElementsByTagName("script")[0]; |
| 26 | + firstScriptTag.parentNode?.insertBefore(tag, firstScriptTag); |
| 27 | + |
| 28 | + // Create YouTube player when API is ready |
| 29 | + window.onYouTubeIframeAPIReady = () => { |
| 30 | + new window.YT.Player("gitpod-video", { |
| 31 | + events: { |
| 32 | + onStateChange: onPlayerStateChange, |
| 33 | + }, |
| 34 | + }); |
| 35 | + }; |
| 36 | + }, []); |
| 37 | + |
| 38 | + const onPlayerStateChange = (event: any) => { |
| 39 | + if (event.data === window.YT.PlayerState.PLAYING) { |
| 40 | + trackVideoClick("create-new-workspace"); |
| 41 | + } |
| 42 | + }; |
| 43 | + |
12 | 44 | return (
|
13 | 45 | <div className="app-container flex flex-col space-y-2">
|
14 |
| - <div className="px-6 py-3 flex flex-col"> |
15 |
| - <div className="flex flex-col items-center justify-center h-96 w-96 mx-auto"> |
16 |
| - <Heading2 className="text-center pb-3">No Workspaces</Heading2> |
17 |
| - <Subheading className="text-center pb-6"> |
18 |
| - Prefix any Git repository URL with {window.location.host}/# or create a new workspace for a |
19 |
| - recently used project.{" "} |
20 |
| - <a |
21 |
| - className="gp-link" |
22 |
| - target="_blank" |
23 |
| - rel="noreferrer" |
24 |
| - href="https://www.gitpod.io/docs/getting-started/" |
25 |
| - > |
26 |
| - Learn more |
27 |
| - </a> |
28 |
| - </Subheading> |
29 |
| - <span> |
30 |
| - <LinkButton href={"/new"} className="gap-1.5"> |
31 |
| - New Workspace{" "} |
32 |
| - <span className="opacity-60 hidden md:inline">{StartWorkspaceModalKeyBinding}</span> |
33 |
| - </LinkButton> |
34 |
| - </span> |
| 46 | + <div className="px-6 mt-12 flex flex-row justify-center space-x-8"> |
| 47 | + <div> |
| 48 | + <iframe |
| 49 | + id="gitpod-video" |
| 50 | + width="535" |
| 51 | + height="307" |
| 52 | + src="https://www.youtube.com/embed/1ZBN-b2cIB8?enablejsapi=1&modestbranding=1&rel=0&controls=1&showinfo=0&fs=1" |
| 53 | + title="YouTube - Gitpod in 120 seconds" |
| 54 | + allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" |
| 55 | + allowFullScreen |
| 56 | + className="rounded-xl" |
| 57 | + ></iframe> |
| 58 | + </div> |
| 59 | + <div> |
| 60 | + <div className="flex flex-col items-left h-96 w-96"> |
| 61 | + <Heading1 className="text-left mb-4 !font-semibold !text-2xl">Welcome to Gitpod</Heading1> |
| 62 | + <Heading2 className="text-left !mb-0 !font-semibold !text-lg"> |
| 63 | + Create your first workspace |
| 64 | + </Heading2> |
| 65 | + <Subheading className="text-left max-w-xs"> |
| 66 | + A workspace is a cloud development environment |
| 67 | + </Subheading> |
| 68 | + <span className="flex flex-col space-y-4 w-fit"> |
| 69 | + <LinkButton |
| 70 | + variant="secondary" |
| 71 | + className="mt-4 border border-pk-content-secondary text-pk-content-secondary bg-pk-surface-secondary" |
| 72 | + href={"/new?showExamples=true"} |
| 73 | + > |
| 74 | + Try a configured demo repo |
| 75 | + </LinkButton> |
| 76 | + <LinkButton href={"/new"} className="gap-1.5"> |
| 77 | + Open your repository{" "} |
| 78 | + <span className="opacity-60 hidden md:inline">{StartWorkspaceModalKeyBinding}</span> |
| 79 | + </LinkButton> |
| 80 | + </span> |
| 81 | + </div> |
35 | 82 | </div>
|
36 | 83 | </div>
|
37 | 84 | </div>
|
|
0 commit comments