Skip to content

Commit 3f1c640

Browse files
committed
frontend/project panels: fix styling, such that on narrower viewports you can scroll to see everything
1 parent 67c57ae commit 3f1c640

File tree

10 files changed

+47
-50
lines changed

10 files changed

+47
-50
lines changed

src/packages/frontend/account/licenses/projects-with-licenses.tsx

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

6-
import { Alert, Row, Col } from "antd";
6+
import { Alert, Col, Row } from "antd";
77
import { useEffect, useMemo, useState } from "react";
8-
import { useTypedRedux, redux } from "../../app-framework";
9-
import { Loading, TimeAgo } from "../../components";
10-
import { projects_with_licenses } from "./util";
11-
import { plural, trunc_middle } from "@cocalc/util/misc";
12-
import { LICENSES_STYLE } from "./managed-licenses";
138
import { Virtuoso } from "react-virtuoso";
14-
import { SelectProject } from "@cocalc/frontend/projects/select-project";
9+
10+
import { redux, useTypedRedux } from "@cocalc/frontend/app-framework";
11+
import { Loading, TimeAgo } from "@cocalc/frontend/components";
1512
import { SiteLicense } from "@cocalc/frontend/project/settings/site-license";
13+
import { SelectProject } from "@cocalc/frontend/projects/select-project";
14+
import { plural, trunc_middle } from "@cocalc/util/misc";
15+
import { LICENSES_STYLE } from "./managed-licenses";
16+
import { projects_with_licenses } from "./util";
1617

1718
export function ProjectsWithLicenses({}) {
1819
const [project_id, setProjectId] = useState<string | undefined>(undefined);

src/packages/frontend/project/info/full.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import {
3131
} from "./components";
3232
import { CGroupInfo, DUState, PTStats, ProcessRow } from "./types";
3333
import { DETAILS_BTN_TEXT, SSH_KEYS_DOC } from "./utils";
34+
import { ROOT_STYLE } from "../servers/consts";
3435

3536
interface Props {
3637
any_alerts: () => boolean;
@@ -518,12 +519,10 @@ export function Full(props: Readonly<Props>): JSX.Element {
518519
}
519520

520521
return (
521-
<Row style={{ padding: "15px 15px 0 15px" }}>
522-
<Col md={12}>
523-
{render_not_running()}
524-
{render_error()}
525-
{render_body()}
526-
</Col>
527-
</Row>
522+
<div style={ROOT_STYLE}>
523+
{render_not_running()}
524+
{render_error()}
525+
{render_body()}
526+
</div>
528527
);
529528
}

src/packages/frontend/project/new/project-new.tsx

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

66
import { Col, Row } from "@cocalc/frontend/antd-bootstrap";
7-
import { CSS } from "@cocalc/frontend/app-framework";
87
import { useProjectContext } from "@cocalc/frontend/project/context";
98
import NewFilePage from "./new-file-page";
9+
import { ROOT_STYLE } from "../servers/consts";
1010

1111
interface Props {
1212
project_id: string;
@@ -17,10 +17,9 @@ export function ProjectNew({ project_id }: Props): JSX.Element {
1717

1818
const isWide = mainWidthPx > 800;
1919
const offset = isWide ? 1 : 0;
20-
const style: CSS = isWide ? {} : { marginLeft: "10px", marginRight: "10px" };
2120

2221
return (
23-
<Row style={style}>
22+
<Row style={{ ...ROOT_STYLE }}>
2423
<Col md={12} mdOffset={0} lg={12 - 2 * offset} lgOffset={offset}>
2524
<NewFilePage project_id={project_id} />
2625
</Col>

src/packages/frontend/project/page/content.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ import getUrlTransform from "./url-transform";
5959
const DEFAULT_CHAT_WIDTH = IS_MOBILE ? 0.5 : 0.3;
6060

6161
const MAIN_STYLE: React.CSSProperties = {
62-
overflowX: "hidden",
62+
overflowX: "auto",
6363
flex: "1 1 auto",
6464
height: 0,
6565
position: "relative",

src/packages/frontend/project/page/project-collaborators.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,7 @@ export function ProjectCollaboratorsPage(): JSX.Element {
7373
}
7474

7575
return (
76-
<div
77-
style={{
78-
...ROOT_STYLE,
79-
width: "1000px",
80-
maxWidth: "100%",
81-
margin: "auto",
82-
}}
83-
>
76+
<div style={ROOT_STYLE}>
8477
<Title level={2}>
8578
<Icon name={ICON_USERS} /> {intl.formatMessage(labels.users)}
8679
</Title>

src/packages/frontend/project/page/project-licenses.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export function ProjectLicenses({ project_id }): JSX.Element {
8787
}
8888

8989
return (
90-
<div style={{ ...ROOT_STYLE, maxWidth: undefined }}>
90+
<div style={ROOT_STYLE}>
9191
<Title level={2}>
9292
<Icon name={ICON_UPGRADES} />{" "}
9393
<FormattedMessage

src/packages/frontend/project/servers/consts.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,5 @@ export const ROOT_STYLE: CSS = {
1616
paddingLeft: "20px",
1717
paddingRight: "20px",
1818
maxWidth: "100%",
19-
width: "1100px",
20-
margin: "auto",
19+
margin: "0 auto",
2120
} as const;

src/packages/frontend/project/servers/project-servers.tsx

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,32 @@
55

66
import { Col, Divider, Modal, Row, Tabs, TabsProps } from "antd";
77
import { Gutter } from "antd/es/grid/row";
8-
import { useProjectContext } from "@cocalc/frontend/project/context";
8+
import { FormattedMessage } from "react-intl";
9+
910
import { useState } from "@cocalc/frontend/app-framework";
1011
import { A, Icon, Paragraph, Text, Title } from "@cocalc/frontend/components";
1112
import {
13+
cloudFilesystemsEnabled,
1214
ComputeServerDocs,
1315
ComputeServers,
1416
computeServersEnabled,
15-
cloudFilesystemsEnabled,
1617
} from "@cocalc/frontend/compute";
18+
import CloudFilesystems from "@cocalc/frontend/compute/cloud-filesystem/cloud-filesystems";
19+
import {
20+
getServerTab,
21+
setServerTab,
22+
TabName,
23+
} from "@cocalc/frontend/compute/tab";
24+
import { useStudentProjectFunctionality } from "@cocalc/frontend/course";
1725
import { HelpEmailLink } from "@cocalc/frontend/customize";
26+
import { useProjectContext } from "@cocalc/frontend/project/context";
1827
import { R_IDE } from "@cocalc/util/consts/ui";
1928
import { NamedServerName } from "@cocalc/util/types/servers";
2029
import { NamedServerPanel } from "../named-server-panel";
2130
import { NewFileButton } from "../new/new-file-button";
2231
import { SagewsControl } from "../settings/sagews-control";
2332
import { useAvailableFeatures } from "../use-available-features";
2433
import { ICON_NAME, ROOT_STYLE, TITLE } from "./consts";
25-
import CloudFilesystems from "@cocalc/frontend/compute/cloud-filesystem/cloud-filesystems";
26-
import {
27-
getServerTab,
28-
setServerTab,
29-
TabName,
30-
} from "@cocalc/frontend/compute/tab";
31-
import { FormattedMessage } from "react-intl";
32-
import { useStudentProjectFunctionality } from "@cocalc/frontend/course";
3334

3435
// Antd's 24 grid system
3536
const md = 6;
@@ -243,7 +244,7 @@ export function ProjectServers() {
243244
}
244245

245246
return (
246-
<div style={{ ...ROOT_STYLE, margin: "0 auto" }}>
247+
<div style={ROOT_STYLE}>
247248
<Title level={2}>
248249
<Icon name={ICON_NAME} /> {TITLE}
249250
</Title>

src/packages/frontend/project/settings/site-license.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import { Button, Card, Popover } from "antd";
1010
import { FormattedMessage, useIntl } from "react-intl";
11+
1112
import { alert_message } from "@cocalc/frontend/alerts";
1213
import {
1314
redux,
@@ -18,6 +19,7 @@ import {
1819
} from "@cocalc/frontend/app-framework";
1920
import { Icon, Paragraph, Text, Title } from "@cocalc/frontend/components";
2021
import { labels } from "@cocalc/frontend/i18n";
22+
import { ProjectTitle } from "@cocalc/frontend/projects/project-title";
2123
import { SiteLicenseInput } from "@cocalc/frontend/site-licenses/input";
2224
import { BuyLicenseForProject } from "@cocalc/frontend/site-licenses/purchase/buy-license-for-project";
2325
import { LICENSE_INFORMATION } from "@cocalc/frontend/site-licenses/rules";
@@ -31,7 +33,6 @@ import {
3133
} from "@cocalc/util/upgrades/quota";
3234
import { isBoostLicense } from "@cocalc/util/upgrades/utils";
3335
import { SiteLicense as SiteLicenseT } from "./types";
34-
import { ProjectTitle } from "@cocalc/frontend/projects/project-title";
3536

3637
interface Props {
3738
project_id: string;
@@ -232,8 +233,10 @@ export function SiteLicense({
232233
<>
233234
{isFlyout && haveLicenses ? (
234235
<Paragraph type="secondary" style={{ padding: "5px" }}>
235-
Information about attached licenses. Click on a row to expand
236-
details.
236+
<FormattedMessage
237+
id="project.settings.site-license.body.info"
238+
defaultMessage={`Information about attached licenses. Click on a row to expand details.`}
239+
/>
237240
</Paragraph>
238241
) : undefined}
239242
{render_current_licenses()}

src/packages/frontend/project/settings/upgrade-usage.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import { Button, Card, Typography } from "antd";
77
import { List } from "immutable";
88
import { join } from "path";
9-
import { FormattedMessage } from "react-intl";
9+
import { FormattedMessage, useIntl } from "react-intl";
1010

1111
import {
1212
CSS,
@@ -73,6 +73,7 @@ export const UpgradeUsage: React.FC<Props> = React.memo(
7373
dedicated_resources,
7474
mode,
7575
}: Readonly<Props>) => {
76+
const intl = useIntl();
7677
const actions: ProjectsActions = useActions("projects");
7778
const project_actions = useActions({ project_id });
7879
const account_groups: List<string> =
@@ -383,6 +384,7 @@ export const UpgradeUsage: React.FC<Props> = React.memo(
383384
if (project == null) {
384385
return <Loading theme="medium" transparent />;
385386
}
387+
386388
return (
387389
<div style={{ maxWidth: "1000px" }}>
388390
<Title level={4}>
@@ -395,12 +397,12 @@ export const UpgradeUsage: React.FC<Props> = React.memo(
395397
type="secondary"
396398
ellipsis={{ rows: 1, expandable: true, symbol: "more" }}
397399
>
398-
<FormattedMessage
399-
id="project.settings.upgrade-usage.intro"
400-
defaultMessage={`This table lists project quotas, their current usage,
401-
and their value/limit. Click on a row to show more details about it.
402-
If the project is not running, you see the last known quota values.`}
403-
/>
400+
{intl.formatMessage({
401+
id: "project.settings.upgrade-usage.intro",
402+
defaultMessage: `This table lists project quotas, their current usage, and their value/limit.
403+
Click on a row to show more details about it.
404+
If the project is not running, you see the last known quota values.`,
405+
})}
404406
</Paragraph>
405407
{render_run_quota()}
406408
{render_upgrades_button()}

0 commit comments

Comments
 (0)