Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemathinc
GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/next/pages/software/index.tsx
1450 views
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 { Button, Layout, Space } from "antd";
7
8
import {
9
LanguageName,
10
SOFTWARE_ENV_DEFAULT,
11
SOFTWARE_ENV_NAMES,
12
} from "@cocalc/util/consts/software-envs";
13
import Footer from "components/landing/footer";
14
import Head from "components/landing/head";
15
import Header from "components/landing/header";
16
import IndexList, { DataSource } from "components/landing/index-list";
17
import { Paragraph } from "components/misc";
18
import A from "components/misc/A";
19
import { MAX_WIDTH } from "lib/config";
20
import { Customize } from "lib/customize";
21
import withCustomize from "lib/with-customize";
22
import juliaLogo from "public/features/julia-logo.svg";
23
import sageScreenshot from "public/features/sage-worksheet.png";
24
import executablesScreenshot from "public/software/executables.png";
25
import octaveJupyter from "/public/features/cocalc-octave-jupyter-20200511.png";
26
import RJupyter from "/public/features/cocalc-r-jupyter.png";
27
import pythonScreenshot from "/public/features/frame-editor-python.png";
28
import octaveLogo from "/public/features/octave-logo.svg";
29
import PythonLogo from "/public/features/python-logo.svg";
30
import Rlogo from "/public/features/r-logo.svg";
31
import sageLogo from "/public/features/sage-sticker-1x1_inch-small.png";
32
import JuliaJupyter from "/public/software/julia-jupyter.png";
33
34
export const STYLE_PAGE: React.CSSProperties = {
35
maxWidth: MAX_WIDTH,
36
margin: "0 auto",
37
padding: "40px 15px 0 15px",
38
backgroundColor: "white",
39
} as const;
40
41
// STYLE_PAGE should have a max width of 1200px
42
export const STYLE_PAGE_WIDE: React.CSSProperties = {
43
...STYLE_PAGE,
44
maxWidth: "1200px",
45
} as const;
46
47
const LINKS: { [lang in LanguageName | "executables"]: string } = {
48
executables: `/software/executables/${SOFTWARE_ENV_DEFAULT}`,
49
python: `/software/python/${SOFTWARE_ENV_DEFAULT}`,
50
R: `/software/r/${SOFTWARE_ENV_DEFAULT}`,
51
julia: `/software/julia/${SOFTWARE_ENV_DEFAULT}`,
52
octave: `/software/octave/${SOFTWARE_ENV_DEFAULT}`,
53
sagemath: `/software/sagemath/${SOFTWARE_ENV_DEFAULT}`,
54
} as const;
55
56
function renderSoftwareEnvLinks(lang: LanguageName | "executables") {
57
return (
58
<Paragraph>
59
<Space>
60
{SOFTWARE_ENV_NAMES.map((name) => {
61
const type = SOFTWARE_ENV_DEFAULT === name ? "primary" : undefined;
62
const style = type === "primary" ? { fontWeight: "bold" } : {};
63
// toLowerCase is necessary for R → r
64
const href = `/software/${lang.toLowerCase()}/${name}`;
65
return (
66
<Button
67
size="small"
68
type={type}
69
href={href}
70
style={{ ...style, padding: "5px" }}
71
>
72
{name}
73
</Button>
74
);
75
})}
76
</Space>
77
</Paragraph>
78
);
79
}
80
81
const dataSource: DataSource = [
82
{
83
link: LINKS.executables,
84
title: "Executables",
85
logo: "laptop",
86
image: executablesScreenshot,
87
description: (
88
<>
89
<Paragraph>
90
CoCalc comes pre-installed with{" "}
91
<A href={LINKS.executables}>thousands of programs</A> that you can run
92
from the terminal or in an X11 environment, or call from your
93
notebooks or scripts.
94
</Paragraph>
95
{renderSoftwareEnvLinks("executables")}
96
</>
97
),
98
},
99
{
100
link: LINKS.python,
101
title: "Python Libraries",
102
logo: PythonLogo,
103
logoBackground: "white",
104
image: pythonScreenshot,
105
description: (
106
<>
107
<Paragraph>
108
CoCalc offers a large number of{" "}
109
<A href={LINKS.python}>Python libraries preinstalled</A> system wide,
110
in Anaconda, and in several versions of Sage.
111
</Paragraph>
112
{renderSoftwareEnvLinks("python")}
113
</>
114
),
115
},
116
{
117
link: LINKS.sagemath,
118
title: "SageMath Packages",
119
logo: sageLogo,
120
logoBackground: "white",
121
image: sageScreenshot,
122
description: (
123
<>
124
<Paragraph>
125
CoCalc provides <A href={LINKS.sagemath}>SageMath environments</A>{" "}
126
with additional preinstalled packages.
127
</Paragraph>
128
{renderSoftwareEnvLinks("sagemath")}
129
</>
130
),
131
},
132
{
133
link: LINKS.R,
134
title: "R Statistical Software Packages",
135
logo: Rlogo,
136
logoBackground: "white",
137
image: RJupyter,
138
description: (
139
<>
140
<Paragraph>
141
CoCalc maintains an extensive set of <A href={LINKS.R}>R packages</A>
142
</Paragraph>
143
{renderSoftwareEnvLinks("R")}
144
</>
145
),
146
},
147
{
148
link: LINKS.julia,
149
title: "Julia Packages",
150
logo: juliaLogo,
151
logoBackground: "white",
152
image: JuliaJupyter,
153
description: (
154
<>
155
<Paragraph>
156
CoCalc regularly updates Julia and installs{" "}
157
<A href={LINKS.julia}>many common Julia packages</A>.
158
</Paragraph>
159
{renderSoftwareEnvLinks("julia")}
160
</>
161
),
162
},
163
{
164
link: LINKS.octave,
165
title: "Octave Packages",
166
logo: octaveLogo,
167
logoBackground: "white",
168
image: octaveJupyter,
169
description: (
170
<>
171
<Paragraph>
172
There are several <A href={LINKS.octave}>Octave packages</A> that are
173
preinstalled.
174
</Paragraph>
175
{renderSoftwareEnvLinks("octave")}
176
</>
177
),
178
},
179
];
180
181
export default function Software({ customize }) {
182
const description = (
183
<>
184
<p>These pages contain information about available software on CoCalc.</p>
185
<p>
186
By default, projects are running in an environment based on{" "}
187
<A href="https://en.wikipedia.org/wiki/Ubuntu">
188
Ubuntu {SOFTWARE_ENV_DEFAULT}
189
</A>
190
, but there are also {SOFTWARE_ENV_NAMES.length - 1} other variants
191
available. The default variant is actively maintained and regularly
192
updated – others are for testing or are deprected. The reason to pick an
193
older environment is backwards compatibility with older software,
194
running an older project of yours, or for historic purposes.
195
</p>
196
</>
197
);
198
199
return (
200
<Customize value={customize}>
201
<Head title="Software" />
202
<Layout>
203
<Header page="software" />
204
<IndexList
205
title="Available Software"
206
description={description}
207
dataSource={dataSource}
208
/>
209
<Footer />
210
</Layout>
211
</Customize>
212
);
213
}
214
215
export async function getServerSideProps(context) {
216
return await withCustomize({ context });
217
}
218
219