Path: blob/master/src/packages/next/pages/software/index.tsx
5883 views
/*1* This file is part of CoCalc: Copyright © 2021 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45import { Layout, Radio } from "antd";67import {8LanguageName,9SOFTWARE_ENV_DEFAULT,10SOFTWARE_ENV_NAMES,11} from "@cocalc/util/consts/software-envs";12import Footer from "components/landing/footer";13import Head from "components/landing/head";14import Header from "components/landing/header";15import IndexList, { DataSource } from "components/landing/index-list";16import { Paragraph } from "components/misc";17import A from "components/misc/A";18import { MAX_WIDTH } from "lib/config";19import { Customize } from "lib/customize";20import withCustomize from "lib/with-customize";2122// Images23import juliaLogo from "public/features/julia-logo.svg";24import sageScreenshot from "public/features/sage-worksheet.png";25import executablesScreenshot from "public/software/executables.png";26import octaveJupyter from "/public/features/cocalc-octave-jupyter-20200511.png";27import RJupyter from "/public/features/cocalc-r-jupyter.png";28import pythonScreenshot from "/public/features/frame-editor-python.png";29import octaveLogo from "/public/features/octave-logo.svg";30import PythonLogo from "/public/features/python-logo.svg";31import Rlogo from "/public/features/r-logo.svg";32import sageLogo from "/public/features/sage-sticker-1x1_inch-small.png";33import JuliaJupyter from "/public/software/julia-jupyter.png";3435export const STYLE_PAGE: React.CSSProperties = {36maxWidth: MAX_WIDTH,37margin: "0 auto",38padding: "40px 15px 0 15px",39backgroundColor: "white",40} as const;4142// STYLE_PAGE should have a max width of 1200px43export const STYLE_PAGE_WIDE: React.CSSProperties = {44...STYLE_PAGE,45maxWidth: "1200px",46} as const;4748const LINKS: { [lang in LanguageName | "executables"]: string } = {49executables: `/software/executables/${SOFTWARE_ENV_DEFAULT}`,50python: `/software/python/${SOFTWARE_ENV_DEFAULT}`,51R: `/software/r/${SOFTWARE_ENV_DEFAULT}`,52julia: `/software/julia/${SOFTWARE_ENV_DEFAULT}`,53octave: `/software/octave/${SOFTWARE_ENV_DEFAULT}`,54sagemath: `/software/sagemath/${SOFTWARE_ENV_DEFAULT}`,55} as const;5657function renderSoftwareEnvLinks(lang: LanguageName | "executables") {58return (59<Paragraph>60<Radio.Group61optionType="button"62size="small"63value={SOFTWARE_ENV_DEFAULT}64buttonStyle="solid"65>66{SOFTWARE_ENV_NAMES.map((name) => {67// toLowerCase is necessary for R → r68const href = `/software/${lang.toLowerCase()}/${name}`;69return (70<Radio.Button71key={name}72value={name}73onClick={() => (window.location.href = href)}74>75{name}76</Radio.Button>77);78})}79</Radio.Group>80</Paragraph>81);82}8384const dataSource: DataSource = [85{86link: LINKS.executables,87title: "Executables",88logo: "laptop",89image: executablesScreenshot,90description: (91<>92<Paragraph>93CoCalc comes pre-installed with{" "}94<A href={LINKS.executables}>thousands of programs</A> that you can run95from the terminal or in an X11 environment, or call from your96notebooks or scripts.97</Paragraph>98{renderSoftwareEnvLinks("executables")}99</>100),101},102{103link: LINKS.python,104title: "Python Libraries",105logo: PythonLogo,106logoBackground: "white",107image: pythonScreenshot,108description: (109<>110<Paragraph>111CoCalc offers a large number of{" "}112<A href={LINKS.python}>Python libraries preinstalled</A> system wide,113in Anaconda, and in several versions of Sage.114</Paragraph>115{renderSoftwareEnvLinks("python")}116</>117),118},119{120link: LINKS.sagemath,121title: "SageMath Packages",122logo: sageLogo,123logoBackground: "white",124image: sageScreenshot,125description: (126<>127<Paragraph>128CoCalc provides <A href={LINKS.sagemath}>SageMath environments</A>{" "}129with additional preinstalled packages.130</Paragraph>131{renderSoftwareEnvLinks("sagemath")}132</>133),134},135{136link: LINKS.R,137title: "R Statistical Software Packages",138logo: Rlogo,139logoBackground: "white",140image: RJupyter,141description: (142<>143<Paragraph>144CoCalc maintains an extensive set of <A href={LINKS.R}>R packages</A>145</Paragraph>146{renderSoftwareEnvLinks("R")}147</>148),149},150{151link: LINKS.julia,152title: "Julia Packages",153logo: juliaLogo,154logoBackground: "white",155image: JuliaJupyter,156description: (157<>158<Paragraph>159CoCalc regularly updates Julia and installs{" "}160<A href={LINKS.julia}>many common Julia packages</A>.161</Paragraph>162{renderSoftwareEnvLinks("julia")}163</>164),165},166{167link: LINKS.octave,168title: "Octave Packages",169logo: octaveLogo,170logoBackground: "white",171image: octaveJupyter,172description: (173<>174<Paragraph>175There are several <A href={LINKS.octave}>Octave packages</A> that are176preinstalled.177</Paragraph>178{renderSoftwareEnvLinks("octave")}179</>180),181},182];183184export default function Software({ customize }) {185const description = (186<>187<p>These pages contain information about available software on CoCalc.</p>188<p>189By default, projects are running in an environment based on{" "}190<A href="https://en.wikipedia.org/wiki/Ubuntu">191Ubuntu {SOFTWARE_ENV_DEFAULT}192</A>193, but there are also {SOFTWARE_ENV_NAMES.length - 1} other variants194available. The default variant is actively maintained and regularly195updated – others are for testing or are deprected. The reason to pick an196older environment is backwards compatibility with older software,197running an older project of yours, or for historic purposes.198</p>199</>200);201202return (203<Customize value={customize}>204<Head title="Software" />205<Layout>206<Header page="software" />207<IndexList208title="Available Software"209description={description}210dataSource={dataSource}211/>212<Footer />213</Layout>214</Customize>215);216}217218export async function getServerSideProps(context) {219return await withCustomize({ context });220}221222223