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/vouchers/index.tsx
Views: 687
1
/*
2
* This file is part of CoCalc: Copyright © 2022 Sagemath, Inc.
3
* License: MS-RSL – see LICENSE.md for details
4
*/
5
6
import { Layout } from "antd";
7
import Header from "components/landing/header";
8
import Head from "components/landing/head";
9
import { Icon } from "@cocalc/frontend/components/icon";
10
import A from "components/misc/A";
11
import SiteName from "components/share/site-name";
12
import {
13
OverviewRow,
14
OVERVIEW_LARGE_ICON,
15
OVERVIEW_STYLE,
16
Product,
17
} from "lib/styles/layouts";
18
import withCustomize from "lib/with-customize";
19
import { Customize } from "lib/customize";
20
import useProfile from "lib/hooks/profile";
21
22
export default function Overview({ customize }) {
23
const profile = useProfile();
24
return (
25
<Customize value={customize}>
26
<Head title="Voucher Center" />
27
<Layout>
28
<Header />
29
<Layout.Content style={{ background: "white" }}>
30
<div style={OVERVIEW_STYLE}>
31
<Icon style={OVERVIEW_LARGE_ICON} name="gift" />
32
<h2 style={{ marginBottom: "30px" }}>
33
Welcome to the <SiteName /> Voucher Center!
34
</h2>
35
<div style={{ fontSize: "12pt" }}>
36
<div style={{ maxWidth: "700px", margin: "auto" }}>
37
<A href="https://doc.cocalc.com/vouchers.html">Vouchers</A> are
38
like a digital gift card, which can be used to purchase anything
39
on <SiteName />.
40
</div>
41
</div>
42
<OverviewRow>
43
<Product
44
href={"/store/vouchers"}
45
icon="shopping-cart"
46
title="Buy Vouchers"
47
>
48
Create voucher codes that you can share, resell, or use later.
49
</Product>
50
<Product icon="gift2" title="Redeem a Voucher" href="/redeem">
51
Redeem a voucher code to add{" "}
52
<A href="/settings/purchases">money</A> or{" "}
53
<A href="/settings/licenses">licenses</A> to your account.
54
</Product>
55
<Product
56
icon="table"
57
title="Vouchers You Redeemed"
58
href="/vouchers/redeemed"
59
>
60
See a list of all vouchers you have redeemed and links to the
61
corresponding <A href="/settings/licenses">licenses</A>.
62
</Product>
63
<Product
64
href={"/vouchers/created"}
65
icon="csv"
66
title="Your Vouchers"
67
>
68
Browse all vouchers you have created and see their status.
69
</Product>
70
</OverviewRow>
71
{profile?.is_admin && (
72
<div
73
style={{
74
display: "flex",
75
justifyContent: "center",
76
marginBottom: "30px",
77
}}
78
>
79
<Product
80
href={"/vouchers/admin"}
81
icon="users"
82
title="Admin -- Voucher Payment Status"
83
>
84
See the status of all vouchers that users have created.{" "}
85
<b>This page is only available to site admins.</b>
86
</Product>
87
</div>
88
)}
89
</div>
90
</Layout.Content>
91
</Layout>
92
</Customize>
93
);
94
}
95
96
export async function getServerSideProps(context) {
97
return await withCustomize({ context });
98
}
99
100