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