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/store.ts
Views: 687
/*1* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45import { redux, Store, TypedMap } from "@cocalc/frontend/app-framework";6import target from "@cocalc/frontend/client/handle-target";7import { parse_target } from "../history";89type TopTab =10| "about" // the "/help" page11| "account"12| "admin"13| "help" // i.e., the support dialog that makes a ZenDesk ticket....14| "project"15| "projects"16| "file-use"17| "notifications";1819export type ConnectionStatus = "disconnected" | "connecting" | "connected";2021export interface PageState {22active_top_tab: TopTab; // key of the active tab23show_connection: boolean;24ping?: number;25avgping?: number;26connection_status: ConnectionStatus;27connection_quality: "good" | "bad" | "flaky";28new_version?: TypedMap<{ version: number; min_version: number }>;29fullscreen?: "default" | "kiosk" | "project";30test?: string; // test query in the URL31cookie_warning: boolean;32local_storage_warning: boolean;33show_file_use: boolean;34num_ghost_tabs: number;35session?: string; // session query in the URL36last_status_time?: Date;37get_api_key?: string; // Set, e.g., when you visit https://cocalc.com/app?get_api_key=myapp -- see https://doc.cocalc.com/api/index.html#authentication38kiosk_project_id?: string;3940// If true, a modal asking whether you want to use a project invite token appears.41// This is 100% for avoiding tricking a user into clicking on a link and silently42// adding them to a project. If they are explicitly on purpose trying to use a project43// invite token, then they will say yes. Otherwise, they will say no.44popconfirm?: {45title?;46description?;47open?: boolean;48ok?: boolean;49cancelText?: string;50okText?: string;51};5253settingsModal?: string;54}5556export class PageStore extends Store<PageState> {}5758export function init_store() {59const DEFAULT_STATE: PageState = {60active_top_tab: parse_target(target).page as TopTab,61show_connection: false,62connection_status: "connecting",63connection_quality: "good",64cookie_warning: false,65local_storage_warning: false,66show_file_use: false,67num_ghost_tabs: 0,68} as const;6970redux.createStore("page", PageStore, DEFAULT_STATE);71}727374