CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/next/pages/auth/try.tsx
Views: 687
1
/*
2
* This file is part of CoCalc: Copyright © 2021 Sagemath, Inc.
3
* License: MS-RSL – see LICENSE.md for details
4
*/
5
6
import { Layout } from "antd";
7
import Try from "components/auth/try";
8
import Footer from "components/landing/footer";
9
import Head from "components/landing/head";
10
import Header from "components/landing/header";
11
import basePath from "lib/base-path";
12
import { Customize } from "lib/customize";
13
import withCustomize from "lib/with-customize";
14
import { useRouter } from "next/router";
15
16
export default function Home({ customize }) {
17
const { siteName } = customize;
18
const router = useRouter();
19
return (
20
<Customize value={customize}>
21
<Head title={`Try ${siteName} Now!`} />
22
<Layout>
23
<Header page="try" />
24
<Layout.Content style={{ backgroundColor: "white" }}>
25
<Try onSuccess={() => router.push("/")} />
26
<Footer />
27
</Layout.Content>
28
</Layout>
29
</Customize>
30
);
31
}
32
33
export async function getServerSideProps(context) {
34
const customize = await withCustomize({ context });
35
if (customize.props.customize.account != null) {
36
// user is already signed in -- redirect them to top level page for now (todo).
37
const { res } = context;
38
res.writeHead(302, { location: basePath });
39
res.end();
40
return { props: { customize: {} } };
41
}
42
return customize;
43
}
44
45