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/app/path.tsx
Views: 687
/*1* This file is part of CoCalc: Copyright © 2021 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45/*6Edit a file using the CoCalc app.7*/89import { Alert } from "antd";10import { join } from "path";11import { CSSProperties } from "react";1213import InPlaceSignInOrUp from "components/auth/in-place-sign-in-or-up";14import OpenAnonymously from "components/share/edit/open-anonymously";15import basePath from "lib/base-path";16import editURL from "lib/share/edit-url";17import useCustomize from "lib/use-customize";18import IFrame from "./iframe";1920interface Props {21description?: string;22embed?: boolean;23fullscreen?: boolean;24path?: string;25project_id: string;26start?: boolean; // if true, immediately load editor rather than waiting for user to click a button.27style?: CSSProperties;28}2930export default function Path(props: Props) {31const { project_id, path, style, fullscreen, embed, description, start } =32props;3334const { account, anonymousSignup } = useCustomize();3536if (!account) {37return (38<Alert39type="success"40style={style}41message={42<div>43<InPlaceSignInOrUp title={`To use ${description ?? "this"}...`} />44{anonymousSignup && <OpenAnonymously />}45</div>46}47/>48);49}5051const appURL = editURL({ type: "collaborator", project_id, path });5253const src = embed54? join(55basePath,56`static/embed.html?target=projects/${project_id}/files/${path ?? ""}`57)58: appURL + "?fullscreen=project&session=";5960return (61<IFrame62src={src}63appURL={appURL}64path={path}65style={style}66fullscreen={fullscreen}67description={description}68start={start}69/>70);71}727374