Skip to content

Commit 1526891

Browse files
committed
Merge remote-tracking branch 'origin/master' into i18n-20240924
2 parents 404ead4 + 8028102 commit 1526891

File tree

6 files changed

+111
-111
lines changed

6 files changed

+111
-111
lines changed

src/packages/frontend/file-use/info.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
*/
55

66
import { Component, Rendered, CSS } from "../app-framework";
7-
const { User } = require("../users");
7+
import { User } from "@cocalc/frontend/users";
88
import { Icon, TimeAgo, r_join } from "../components";
99
import { FileUseIcon } from "./icon";
1010
import { Map as iMap } from "immutable";
11-
const { Col, Grid, Row } = require("react-bootstrap");
11+
import { Col, Grid, Row } from "@cocalc/frontend/antd-bootstrap";
1212
import * as misc from "@cocalc/util/misc";
1313
import { open_file_use_entry } from "./util";
1414
import { ProjectTitle } from "@cocalc/frontend/projects/project-title";
@@ -55,7 +55,7 @@ export class FileUseInfo extends Component<Props, {}> {
5555
name={user.account_id === this.props.account_id ? "You" : undefined}
5656
user_map={this.props.user_map}
5757
last_active={user.last_edited ? user.last_edited : user.last_used}
58-
/>
58+
/>,
5959
);
6060
}
6161
if (v.length == 0) {
@@ -83,13 +83,13 @@ export class FileUseInfo extends Component<Props, {}> {
8383
x.get("project_id"),
8484
x.get("path"),
8585
x.get("show_chat", false),
86-
this.props.redux
86+
this.props.redux,
8787
);
8888
}
8989

9090
render_path(): Rendered {
9191
let { name, ext } = misc.separate_file_extension(
92-
this.props.info.get("path")
92+
this.props.info.get("path"),
9393
);
9494
name = misc.trunc_middle(name, TRUNCATE_LENGTH);
9595
ext = misc.trunc_middle(ext, TRUNCATE_LENGTH);
@@ -154,7 +154,7 @@ export class FileUseInfo extends Component<Props, {}> {
154154
misc.merge(style, { background: "#08c", color: "white" });
155155
}
156156
return (
157-
<Grid style={style} onClick={(e) => this.open(e)} fluid={true}>
157+
<Grid style={style} onClick={(e) => this.open(e)}>
158158
<Row style={{ padding: "5px" }}>
159159
<Col key="action" sm={1} style={{ fontSize: "14pt" }}>
160160
{this.render_action_icon()}

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,8 @@ export class Actions extends BaseActions<LatexEditorState> {
676676
await this.build(); // kicks off a save of all relevant files
677677
}
678678

679-
// used by generic framework – this is bound to the instance, otherwise "this" is undefined
679+
// used by generic framework – this is bound to the instance, otherwise "this" is undefined, hence
680+
// make sure to use an arrow function!
680681
build = async (id?: string, force: boolean = false): Promise<void> => {
681682
this.set_error("");
682683
this.set_status("");
@@ -699,6 +700,7 @@ export class Actions extends BaseActions<LatexEditorState> {
699700
await this.save_all(false);
700701
await this.run_build(this.last_save_time(), force);
701702
} catch (err) {
703+
this.set_error(`${err}`);
702704
// if there is an error, we issue a stop, but keep the build logs
703705
await this.stop_build();
704706
} finally {

src/packages/frontend/frame-editors/latex-editor/gutters.tsx

Lines changed: 45 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// one gets a gutter mark, with pref to errors. The main error log shows everything, so this should be OK.
1010

1111
import { Popover } from "antd";
12+
import { IntlProvider } from "react-intl";
1213

1314
import { Icon } from "@cocalc/frontend/components";
1415
//import { Actions } from "@cocalc/frontend/frame-editors/code-editor/actions";
@@ -17,6 +18,7 @@ import { capitalize } from "@cocalc/util/misc";
1718
import { Actions } from "./actions";
1819
import { SPEC, SpecItem } from "./errors-and-warnings";
1920
import { Error, IProcessedLatexLog } from "./latex-log-parser";
21+
import { DEFAULT_LOCALE } from "@cocalc/frontend/i18n";
2022

2123
export function update_gutters(opts: {
2224
log: IProcessedLatexLog;
@@ -63,42 +65,49 @@ function component(
6365
}
6466
// NOTE/BUG: despite allow_touch true below, this still does NOT work on my iPad -- we see the icon, but nothing
6567
// happens when clicking on it; this may be a codemirror issue.
68+
// NOTE: the IntlProvider is necessary, because this is mounted outside the application's overall context.
69+
// It's just a default IntlProvider to avoid a crash → TODO: make this part of the application react root.
6670
return (
67-
<Popover
68-
title={message}
69-
content={
70-
<div>
71-
{content}
72-
{group == "errors" && (
73-
<>
74-
<br />
75-
<HelpMeFix
76-
size="small"
77-
style={{ marginTop: "5px" }}
78-
task={"ran latex"}
79-
error={content}
80-
input={() => {
81-
const s = actions._syncstring.to_str();
82-
const v = s
83-
.split("\n")
84-
.slice(0, line + 1)
85-
.join("\n");
86-
//line+1 since lines are 1-based
87-
return v + `% this is line number ${line + 1}`;
88-
}}
89-
language={"latex"}
90-
extraFileInfo={actions.languageModelExtraFileInfo()}
91-
tag={"latex-error-popover"}
92-
prioritize="end"
93-
/>
94-
</>
95-
)}
96-
</div>
97-
}
98-
placement={"right"}
99-
mouseEnterDelay={0}
100-
>
101-
<Icon name={spec.icon} style={{ color: spec.color, cursor: "pointer" }} />
102-
</Popover>
71+
<IntlProvider locale="en" defaultLocale={DEFAULT_LOCALE}>
72+
<Popover
73+
title={message}
74+
content={
75+
<div>
76+
{content}
77+
{group == "errors" && (
78+
<>
79+
<br />
80+
<HelpMeFix
81+
size="small"
82+
style={{ marginTop: "5px" }}
83+
task={"ran latex"}
84+
error={content}
85+
input={() => {
86+
const s = actions._syncstring.to_str();
87+
const v = s
88+
.split("\n")
89+
.slice(0, line + 1)
90+
.join("\n");
91+
//line+1 since lines are 1-based
92+
return v + `% this is line number ${line + 1}`;
93+
}}
94+
language={"latex"}
95+
extraFileInfo={actions.languageModelExtraFileInfo()}
96+
tag={"latex-error-popover"}
97+
prioritize="end"
98+
/>
99+
</>
100+
)}
101+
</div>
102+
}
103+
placement={"right"}
104+
mouseEnterDelay={0}
105+
>
106+
<Icon
107+
name={spec.icon}
108+
style={{ color: spec.color, cursor: "pointer" }}
109+
/>
110+
</Popover>
111+
</IntlProvider>
103112
);
104113
}

src/packages/frontend/project/settings/settings.tsx

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* License: MS-RSL – see LICENSE.md for details
44
*/
55

6-
import { Alert as AntdAlert } from "antd";
6+
import { Alert } from "antd";
77
import {
88
redux,
99
rclass,
@@ -23,8 +23,6 @@ import { SCHEMA } from "@cocalc/util/schema";
2323
import React from "react";
2424
import { Body } from "./body";
2525

26-
const { Alert } = require("react-bootstrap");
27-
2826
interface ReactProps {
2927
project_id: string;
3028
group?: string;
@@ -108,7 +106,7 @@ const ProjectSettings0 = rclass<ReactProps>(
108106
}
109107
this._table = webapp_client.sync_client.sync_table(
110108
{ projects_admin: query },
111-
[]
109+
[],
112110
);
113111
this._table.on("change", () => {
114112
this.setState({
@@ -119,23 +117,30 @@ const ProjectSettings0 = rclass<ReactProps>(
119117

120118
render_admin_message() {
121119
return (
122-
<Alert bsStyle="warning" style={{ margin: "10px" }}>
123-
<h4>
124-
<strong>Warning:</strong> you are editing the project settings as an{" "}
125-
<strong>administrator</strong>.
126-
</h4>
127-
<ul>
128-
<li>
129-
{" "}
130-
You are not a collaborator on this project, but can edit files,
131-
etc.{" "}
132-
</li>
133-
<li>
134-
{" "}
135-
You are an admin: actions will not be logged to the project log.
136-
</li>
137-
</ul>
138-
</Alert>
120+
<Alert
121+
type="warning"
122+
style={{ margin: "10px" }}
123+
message={
124+
<>
125+
<strong>Warning:</strong> you are editing the project settings as
126+
an <strong>administrator</strong>. This is deprecated and should
127+
hardly work.
128+
</>
129+
}
130+
description={
131+
<ul>
132+
<li>
133+
You are not a collaborator on this project, but some things
134+
might still work since you are a site admin.
135+
</li>
136+
<li>
137+
You should probably impersonate a collaborator on this project
138+
instead.
139+
</li>
140+
<li>Actions will not be logged to the project log.</li>
141+
</ul>
142+
}
143+
/>
139144
);
140145
}
141146

@@ -167,11 +172,12 @@ const ProjectSettings0 = rclass<ReactProps>(
167172
}
168173
}
169174

170-
if (project == undefined) {
175+
if (project == null) {
171176
return <Loading />;
172177
} else {
173178
return (
174179
<div style={{ padding: "15px" }}>
180+
{this.render_admin_message()}
175181
{this.state.admin_project != undefined
176182
? this.render_admin_message()
177183
: undefined}
@@ -187,12 +193,12 @@ const ProjectSettings0 = rclass<ReactProps>(
187193
);
188194
}
189195
}
190-
}
196+
},
191197
);
192198

193199
export function SandboxProjectSettingsWarning() {
194200
return (
195-
<AntdAlert
201+
<Alert
196202
showIcon
197203
style={{ margin: "auto", fontSize: "14pt" }}
198204
type="warning"

0 commit comments

Comments
 (0)