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