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/share/path-contents.tsx
Views: 687
/*1* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45import { FileInfo } from "lib/share/get-contents";6import DirectoryListing from "./directory-listing";7import FileContents from "./file-contents";8import Loading from "./loading";910interface Props {11id: string;12isdir?: boolean;13listing?: FileInfo[];14content?: string;15relativePath: string;16path: string;17truncated?: string;18jupyter_api?: boolean;19}2021export default function PathContents({22id,23isdir,24listing,25content,26relativePath,27path,28truncated,29jupyter_api,30}: Props) {31if (isdir) {32if (listing == null) return <Loading style={{ fontSize: "30px" }} />;33return (34<>35<Truncated truncated={truncated} />36<DirectoryListing37id={id}38listing={listing}39relativePath={relativePath}40/>41</>42);43} else {44return (45<div46style={{47padding: "20px 0",48}}49>50<Truncated truncated={truncated} />51<FileContents52id={id}53content={content}54path={path}55relativePath={relativePath}56jupyter_api={jupyter_api}57/>58</div>59);60}61}6263const Truncated = ({ truncated }) =>64truncated == null ? null : <h3>{truncated}</h3>;656667