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/frontend/app/settings-modal.tsx
Views: 687
/*1Easily show a global settings modal at any point in cocalc by doing23await redux.getActions("page").settings(name)45This should be used only for various types of configuration that is not6specific to a particular project. E.g., many of the panels in the Account7tab could also be accessed this way.8*/910import { Modal } from "antd";11import { useActions, useRedux } from "@cocalc/frontend/app-framework";12import { TerminalSettings } from "@cocalc/frontend/account/terminal-settings";13import { EditorSettings } from "@cocalc/frontend/account/editor-settings/editor-settings";1415// Ensure the billing Actions and Store are created, which are needed for purchases, etc., to work...16import "@cocalc/frontend/billing/actions";1718export default function SettingsModal({}) {19const actions = useActions("page");20const name = useRedux("page", "settingsModal");2122if (!name) {23return null;24}2526const { Component, title } = getDescription(name);2728const close = () => {29actions.settings("");30};3132// destroyOnClose so values in quota input, etc. get updated33return (34<Modal35key="settings-modal"36width={"800px"}37destroyOnClose38open39title={title}40onOk={close}41onCancel={close}42cancelButtonProps={{ style: { display: "none" } }}43okText="Close"44>45<br />46{Component != null ? <Component /> : undefined}47</Modal>48);49}5051function getDescription(name: string): { Component?; title? } {52switch (name) {53case "terminal-settings":54return { Component: TerminalSettings };55case "editor-settings":56return { Component: EditorSettings };57default:58return {59title: <div>Unknown component {name}</div>,60};61}62}636465