Path: blob/main/components/dashboard/src/FromReferrer.tsx
2498 views
/**1* Copyright (c) 2021 Gitpod GmbH. All rights reserved.2* Licensed under the GNU Affero General Public License (AGPL).3* See License.AGPL.txt in the project root for license information.4*/56import { LinkButton } from "@podkit/buttons/LinkButton";7import { Heading1, Subheading } from "@podkit/typography/Headings";89export default function FromReferrer() {10const contextUrl = document.referrer;1112if (contextUrl && contextUrl !== "" && new URL(contextUrl).pathname !== "/") {13// Redirect to gitpod.io/#<contextUrl> to get the same experience as with direct call14const url = new URL(window.location.toString());15url.pathname = "/";16url.hash = contextUrl;17window.location.href = url.toString();18return <div></div>;19}2021return (22<div className="app-container flex flex-col space-y-2">23<div className="px-6 py-3 flex justify-between space-x-2 h-96">24<div className="flex flex-col items-center w-96 m-auto mt-40">25<Heading1>No Referrer Found</Heading1>26<Subheading className="text-center pb-6">27It looks like you are trying to open a workspace, but the referrer URL is empty or has an28incomplete path. This happens when the Git hoster or browser doesn't send the referrer header.29<br /> Please prefix the repository URL with <pre>https://{window.location.host}/#</pre> in30order to start a workspace.{" "}31<a className="gp-link" href="https://www.gitpod.io/docs/getting-started/">32Learn more33</a>34</Subheading>35<span>36<LinkButton variant="secondary" href="/">37Go to Dashboard38</LinkButton>39</span>40</div>41</div>42</div>43);44}454647