Skip to content

Commit a0129dd

Browse files
committed
Merge remote-tracking branch 'origin/master' into i18n-pt_br-eu
2 parents 12d455e + 8c50882 commit a0129dd

File tree

15 files changed

+299
-99
lines changed

15 files changed

+299
-99
lines changed

src/packages/frontend/chat/chatroom.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ export function ChatRoom({
143143
}
144144

145145
function renderFilterRecent() {
146+
if (messages == null || messages.size <= 5) {
147+
return null;
148+
}
146149
return (
147150
<Tooltip title="Only show recent threads.">
148151
<Select
@@ -224,7 +227,7 @@ export function ChatRoom({
224227
}
225228

226229
function render_button_row() {
227-
if (messages == null) {
230+
if (messages == null || messages.size <= 5) {
228231
return null;
229232
}
230233
return (
@@ -235,9 +238,6 @@ export function ChatRoom({
235238
style={{
236239
margin: 0,
237240
width: "100%",
238-
...(messages.size >= 2
239-
? undefined
240-
: { visibility: "hidden", height: 0 }),
241241
}}
242242
/>
243243
{renderFilterRecent()}

src/packages/frontend/chat/side-chat.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -238,14 +238,8 @@ function AddChatCollab({ addCollab, project_id }) {
238238
}
239239
return (
240240
<div>
241-
You can{" "}
242-
{redux.getProjectsStore().hasLanguageModelEnabled(project_id) && (
243-
<>chat with AI or notify a collaborator by typing @, </>
244-
)}
245-
<A href="https://github.com/sagemathinc/cocalc/discussions">
246-
join a discussion on GitHub
247-
</A>
248-
, and add more collaborators to this project below.
241+
@mention AI or collaborators, add more collaborators below, or{" "}
242+
<A href="https://discord.gg/EugdaJZ8">join the CoCalc Discord.</A>
249243
<AddCollaborators project_id={project_id} autoFocus where="side-chat" />
250244
<div style={{ color: COLORS.GRAY_M }}>
251245
(Collaborators have access to all files in this project.)

src/packages/frontend/collaborators/project-invite-tokens.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ export const ProjectInviteTokens: React.FC<Props> = React.memo(
300300
}
301301

302302
return (
303-
<Card style={{ width: "100%", overflowX: "auto" }}>
303+
<Card style={{ minWidth: "800px", width: "100%", overflow: "auto" }}>
304304
{heading}
305305
<br />
306306
<br />

src/packages/frontend/editors/markdown-input/multimode.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,8 @@ export default function MultiMarkdownInput({
351351
color: COLORS.GRAY_M,
352352
...(mode == "editor" || hideHelp
353353
? {
354-
position: "absolute",
355-
right: 0,
354+
float: "right",
355+
position: "relative",
356356
zIndex: 1,
357357
}
358358
: { float: "right" }),

src/packages/frontend/frame-editors/code-editor/actions.ts

Lines changed: 49 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import { delay } from "awaiting";
2525
import * as CodeMirror from "codemirror";
2626
import { List, Map, fromJS, Set as iSet } from "immutable";
2727
import { debounce } from "lodash";
28-
2928
import {
3029
Actions as BaseActions,
3130
Rendered,
@@ -74,6 +73,7 @@ import {
7473
history_path,
7574
len,
7675
uuid,
76+
path_split,
7777
} from "@cocalc/util/misc";
7878
import { reuseInFlight } from "@cocalc/util/reuse-in-flight";
7979
import { set_account_table } from "../../account/util";
@@ -111,6 +111,7 @@ import { test_line } from "./simulate_typing";
111111
import { misspelled_words } from "./spell-check";
112112
import { log_opened_time } from "@cocalc/frontend/project/open-file";
113113
import { ensure_project_running } from "@cocalc/frontend/project/project-start-warning";
114+
import { alert_message } from "@cocalc/frontend/alerts";
114115

115116
interface gutterMarkerParams {
116117
line: number;
@@ -1238,7 +1239,7 @@ export class Actions<
12381239
// several other formatting actions.
12391240
// Doing this automatically is fraught with error, since cursors aren't precise...
12401241
if (explicit) {
1241-
if (!await this.ensureProjectIsRunning(`save ${this.path} to disk`)) {
1242+
if (!(await this.ensureProjectIsRunning(`save ${this.path} to disk`))) {
12421243
return;
12431244
}
12441245
const account: any = this.redux.getStore("account");
@@ -1916,31 +1917,30 @@ export class Actions<
19161917
}
19171918
}
19181919

1919-
// big scary error shown at top
1920-
public set_error(
1921-
error?: object | string,
1922-
style?: ErrorStyles,
1923-
_id?: string, // id - not currently used, but would be for frame-specific error.
1924-
): void {
1920+
private formatError = (error?: object | string): string | undefined => {
19251921
if (error === undefined) {
1926-
this.setState({ error });
1927-
} else {
1928-
if (typeof error === "object") {
1929-
const e = (error as any).message;
1930-
if (e === undefined) {
1931-
let e = JSON.stringify(error);
1932-
if (e === "{}") {
1933-
e = `${error}`;
1934-
}
1935-
}
1936-
if (typeof e != "string") throw Error("bug"); // make typescript happy
1937-
error = e;
1938-
}
1939-
if (IS_TIMEOUT_CALLING_PROJECT(error)) {
1940-
error = TIMEOUT_CALLING_PROJECT_MSG;
1922+
return "";
1923+
}
1924+
if (IS_TIMEOUT_CALLING_PROJECT(error)) {
1925+
return TIMEOUT_CALLING_PROJECT_MSG;
1926+
}
1927+
if (typeof error == "string") {
1928+
return error;
1929+
}
1930+
const e = (error as any).message;
1931+
if (e === undefined) {
1932+
let e = JSON.stringify(error);
1933+
if (e === "{}") {
1934+
e = `${error}`;
19411935
}
1942-
this.setState({ error });
19431936
}
1937+
return e;
1938+
};
1939+
1940+
// big scary error shown at top
1941+
topError(error?: object | string, style?: ErrorStyles): void {
1942+
const e = this.formatError(error);
1943+
this.setState({ error: e });
19441944

19451945
switch (style) {
19461946
case "monospace":
@@ -1951,6 +1951,31 @@ export class Actions<
19511951
}
19521952
}
19531953

1954+
set_error(error?: object | string, _style?: ErrorStyles): void {
1955+
// show the error at the a toast if this path is the focused one; otherwise,
1956+
// do not show the error at all. We have shown a lot of useless errors
1957+
// and now we will show less, and in a minimally harmful way.
1958+
if (this.redux.getStore("page").get("active_top_tab") != this.project_id) {
1959+
return;
1960+
}
1961+
if (
1962+
!this.redux
1963+
.getProjectStore(this.project_id)
1964+
.get("active_project_tab")
1965+
.includes(this.path)
1966+
) {
1967+
return;
1968+
}
1969+
const e = this.formatError(error);
1970+
if (e) {
1971+
alert_message({
1972+
type: "error",
1973+
title: path_split(this.path).tail,
1974+
message: e,
1975+
});
1976+
}
1977+
}
1978+
19541979
// status - little status message shown at bottom.
19551980
// timeout -- if status message hasn't changed after
19561981
// this long, then blank it.

src/packages/frontend/frame-editors/jupyter-editor/cell-notebook/actions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ export class NotebookFrameActions {
803803
}
804804

805805
public set_error(error: string): void {
806-
this.frame_tree_actions.set_error(error, undefined, this.frame_id);
806+
this.frame_tree_actions.set_error(error);
807807
}
808808

809809
public async command(name: string): Promise<void> {

src/packages/frontend/jupyter/browser-actions.ts

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,7 @@ export class JupyterActions extends JupyterActions0 {
153153
}
154154
});
155155

156-
// Put an entry in the project log once the jupyter notebook gets opened.
157-
// NOTE: Obviously, the project does NOT need to put entries in the log.
158-
this.syncdb.once("change", () =>
159-
this.redux?.getProjectActions(this.project_id).log_opened_time(this.path),
160-
);
156+
this.initOpenLog();
161157

162158
// project doesn't care about cursors, but browser clients do:
163159
this.syncdb.on("cursor_activity", this.syncdb_cursor_activity);
@@ -176,6 +172,23 @@ export class JupyterActions extends JupyterActions0 {
176172
}
177173
}
178174

175+
initOpenLog = () => {
176+
// Put an entry in the project log once the jupyter notebook gets opened and
177+
// shows cells.
178+
const reportOpened = () => {
179+
if (this._state == "closed") {
180+
return;
181+
}
182+
if (this.syncdb.get_one({ type: "cell" }) != null) {
183+
this.redux
184+
?.getProjectActions(this.project_id)
185+
.log_opened_time(this.path);
186+
this.syncdb.removeListener("change", reportOpened);
187+
}
188+
};
189+
this.syncdb.on("change", reportOpened);
190+
};
191+
179192
initUsageInfo = async () => {
180193
while (this._state != "closed") {
181194
try {

src/packages/next/components/landing/social-media-icon-list.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ enum SocialMediaType {
1111
LINKEDIN = "linkedin",
1212
TWITTER = "twitter",
1313
YOUTUBE = "youtube",
14+
DISCORD = "discord",
1415
}
1516

1617
const ICON_MAP: Record<SocialMediaType, IconName> = {
@@ -20,6 +21,7 @@ const ICON_MAP: Record<SocialMediaType, IconName> = {
2021
[SocialMediaType.LINKEDIN]: "linkedin-filled",
2122
[SocialMediaType.TWITTER]: "twitter",
2223
[SocialMediaType.YOUTUBE]: "youtube-filled",
24+
[SocialMediaType.DISCORD]: "discord",
2325
};
2426

2527
export interface SocialMediaIconListProps {

src/packages/next/pages/support/community.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { MAX_WIDTH } from "lib/config";
1111
import { Customize } from "lib/customize";
1212
import withCustomize from "lib/with-customize";
1313
import MailingList from "public/info/cocalc-mailing-list.png";
14+
import Discord from "public/info/discord.png";
1415
import { COLORS } from "@cocalc/util/theme";
1516
import Facebook from "public/info/facebook.png";
1617
import GitHubDiscussions from "public/info/github-discussions.png";
@@ -22,6 +23,24 @@ import Twitter from "public/info/twitter.png";
2223
const imageWidth = "300px";
2324

2425
const dataSource = [
26+
{
27+
link: "https://discord.gg/nEHs2GK",
28+
title: (
29+
<>
30+
<b>Chat</b> about CoCalc on Discord
31+
</>
32+
),
33+
logo: "comment",
34+
image: Discord,
35+
imageWidth,
36+
description: (
37+
<>
38+
Visit the{" "}
39+
<A href="https://discord.gg/EugdaJZ8">CoCalc Discord server</A> to chat
40+
with other CoCalc users, ask questions, and give us quick feedback.
41+
</>
42+
),
43+
},
2544
{
2645
link: "https://github.com/sagemathinc/cocalc",
2746
logo: "github",

src/packages/next/pages/support/index.tsx

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -73,39 +73,19 @@ const dataSource = [
7373
</>
7474
),
7575
},
76-
{
77-
link: "/support/chatgpt",
78-
title: "ChatGPT Suppport",
79-
logo: "robot",
80-
hide: (customize) => !customize.openaiEnabled || !customize.onCoCalcCom,
81-
description: (
82-
<>
83-
Our <A href="/support/chatgpt">integrated ChatGPT support</A> is free
84-
and often very helpful since it knows so much about the open source
85-
software in CoCalc.
86-
<ChatGPTHelp
87-
style={{ marginTop: "15px" }}
88-
size="large"
89-
tag="support-index"
90-
/>
91-
</>
92-
),
93-
},
9476
{
9577
link: "/support/community",
9678
title: "CoCalc Community Support",
9779
logo: "users",
9880
description: (
9981
<>
100-
<A href="https://github.com/sagemathinc/cocalc/discussions">
101-
Join a discussion
102-
</A>{" "}
103-
or{" "}
82+
<A href="https://discord.gg/EugdaJZ8">Join our Discord server</A> or{" "}
10483
<A href="https://groups.google.com/forum/?fromgroups#!forum/cocalc">
10584
post to the mailing list.{" "}
10685
</A>
10786
<SocialMediaIconList
10887
links={{
88+
discord: "https://discord.gg/EugdaJZ8",
10989
facebook: "https://www.facebook.com/CoCalcOnline",
11090
github: "https://github.com/sagemathinc/cocalc",
11191
linkedin: "https://www.linkedin.com/company/sagemath-inc./",
@@ -117,6 +97,21 @@ const dataSource = [
11797
</>
11898
),
11999
},
100+
{
101+
link: "/support/chatgpt",
102+
title: "ChatGPT",
103+
logo: "robot",
104+
hide: (customize) => !customize.openaiEnabled || !customize.onCoCalcCom,
105+
description: (
106+
<>
107+
<ChatGPTHelp
108+
style={{ marginTop: "15px" }}
109+
size="large"
110+
tag="support-index"
111+
/>
112+
</>
113+
),
114+
},
120115
{
121116
landingPages: true,
122117
link: ({ supportVideoCall }: CustomizeType) => supportVideoCall,

0 commit comments

Comments
 (0)