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-actions.tsx
Views: 687
/*1* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45import { Icon } from "@cocalc/frontend/components/icon";6import Link from "next/link";7// import ExternalLink from "./external-link";8// import rawURL from "lib/share/raw-url";9import downloadURL from "lib/share/download-url";10import { r_join } from "@cocalc/frontend/components/r_join";11import SiteName from "./site-name";12import Edit from "./edit";1314interface Props {15id: string;16path: string;17url?: string;18relativePath: string;19isDir?: boolean;20exclude?: Set<string>;21project_id: string;22image?: string;23description?: string;24has_site_license?: boolean;25}2627export default function PathActions({28id,29path,30url,31relativePath,32isDir,33exclude,34project_id,35image,36description,37has_site_license,38}: Props) {39const include = (action: string) => !exclude?.has(action);40const v: JSX.Element[] = [];41if (include("edit")) {42if (url && isDir) {43// TODO!44// have to implement git clone...45} else {46v.push(47<Edit48key="edit"49id={id}50path={path}51url={url}52relativePath={relativePath}53image={image}54project_id={project_id}55description={description}56has_site_license={has_site_license}57/>,58);59}60}61if (!url && include("hosted")) {62v.push(63<Link key="hosted" href={`/share/public_paths/${id}`}>64Hosted by <SiteName />65</Link>,66);67}68if (!url && !isDir && include("download")) {69v.push(70<a key="download" href={downloadURL(id, path, relativePath)}>71<Icon name="cloud-download" /> Download72</a>,73);74}75/*76if (!url && include("raw")) {77v.push(78<ExternalLink key="raw" href={rawURL({ id, path, relativePath })}>79Raw80</ExternalLink>,81);82}83if (!url && include("embed")) {84v.push(85<Link86key="embed"87href={`/share/public_paths/embed/${id}${88relativePath ? "/" + relativePath : ""89}`}90>91Embed92</Link>,93);94}95*/9697return <div style={{ marginTop: "5px" }}>{r_join(v, " | ")}</div>;98}99100101