Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/src/packages/next/components/account/config/editor/terminal.tsx
Views: 687
/*1* This file is part of CoCalc: Copyright © 2021 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45import { Col, Row, Space } from "antd";67import {8example,9theme_desc,10} from "@cocalc/frontend/frame-editors/terminal-editor/theme-data";11import Loading from "components/share/loading";12import useEditTable from "lib/hooks/edit-table";13import register from "../register";14import { Paragraph, Title } from "components/misc";1516interface Data {17terminal: {18color_scheme: keyof typeof theme_desc;19font_size: number;20};21}2223const desc = {24font_size: `New terminals will use this font size by default. You can change this25for a particular terminal at any time.`,26color_scheme: `The color scheme used for terminals.`,27font: `The CoCalc terminal uses your browser's fixed-width font, which you can change in your browser's preferences.`,28} as const;2930register({31path: "editor/terminal",32title: "Terminals",33icon: "terminal",34desc: "Terminal default font size, color theme, etc.",35search: desc,36Component: () => {37const { edited, original, Save, EditNumber, EditSelect } =38useEditTable<Data>({39accounts: { terminal: null },40});4142if (original == null || edited == null) {43return <Loading />;44}4546return (47<Row gutter={[20, 30]}>48<Col md={24} sm={24}>49<Save />50</Col>51<Col md={14} sm={24}>52<Space direction="vertical" size="large">53<EditNumber54path="terminal.font_size"55title="Terminal Font Size"56icon="text-height"57desc={desc.font_size}58min={5}59max={32}60units="px"61/>62<EditSelect63path="terminal.color_scheme"64icon="colors"65desc={desc.color_scheme}66options={theme_desc}67style={{ width: "30ex" }}68/>69<Space direction="vertical">70<Title level={2} style={{ marginTop: "15px" }}>71Font72</Title>73<Paragraph>{desc.font}</Paragraph>74</Space>75</Space>76</Col>77<Col md={10} sm={24}>78<h3 style={{ marginTop: "10px" }}>Preview</h3>79<div80style={{81fontSize: `${edited.terminal.font_size}px`,82overflow: "hidden",83}}84dangerouslySetInnerHTML={{85__html: example(edited.terminal.color_scheme),86}}87/>88</Col>89</Row>90);91},92});939495