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