CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/next/components/share/edit/open-directly.tsx
Views: 687
1
/*
2
* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
3
* License: MS-RSL – see LICENSE.md for details
4
*/
5
6
import RunApp from "components/app/path";
7
import A from "components/misc/A";
8
import ConfigurePublicPath from "components/share/configure-public-path";
9
import editURL from "lib/share/edit-url";
10
import shareURL from "lib/share/share-url";
11
import { join } from "path";
12
13
interface Props {
14
id: string;
15
project_id: string;
16
path: string;
17
relativePath: string;
18
}
19
20
export default function OpenDirectly(props: Props) {
21
const { project_id, path, id, relativePath } = props;
22
const url = editURL({
23
type: "collaborator",
24
project_id,
25
path,
26
relativePath,
27
});
28
return (
29
<div>
30
You are signed in as a collaborator on{" "}
31
<A href={editURL({ type: "collaborator", project_id })} external>
32
the project
33
</A>{" "}
34
that contains{" "}
35
<A href={url} external>
36
this shared document,
37
</A>{" "}
38
so you can edit it below. Scroll further down to adjust the description
39
and license, choose a nice URL, or stop sharing this.
40
<RunApp
41
start
42
project_id={project_id}
43
path={join(path, relativePath)}
44
style={{
45
margin: "30px 0",
46
}}
47
/>
48
<hr />
49
<br />
50
{!relativePath ? (
51
<>
52
You can adjust how this is shared below, or turn off sharing by
53
selecting <em>Private</em>.
54
<ConfigurePublicPath id={id} project_id={project_id} path={path} />
55
</>
56
) : (
57
<>
58
<br />
59
Go to the{" "}
60
<A href={shareURL(id)}>containing directory that was shared</A> to
61
configure how this is shared or unshare it.
62
</>
63
)}
64
</div>
65
);
66
}
67
68