Skip to content

Commit 6880308

Browse files
committed
convert ancient unused billing react code to antd enough to pass typescript
- it doesn't matter if this looks right since we don't use it. something similar may come back soon though, so I'm not deleting it yet.
1 parent 315ec44 commit 6880308

12 files changed

+43
-68
lines changed

src/packages/frontend/antd-bootstrap.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ export const Button = (props: {
141141
style?: React.CSSProperties;
142142
disabled?: boolean;
143143
onClick?: (e?: any) => void;
144-
key?: string;
144+
key?;
145145
children?: any;
146146
className?: string;
147147
href?: string;
@@ -332,7 +332,7 @@ export type AntdTabItem = NonNullable<AntdTabsProps["items"]>[number];
332332

333333
interface TabsProps {
334334
id?: string;
335-
key?: string;
335+
key?;
336336
activeKey: string;
337337
onSelect?: (activeKey: string) => void;
338338
animation?: boolean;
@@ -360,7 +360,7 @@ export function Tabs(props: Readonly<TabsProps>) {
360360

361361
export function Tab(props: {
362362
id?: string;
363-
key?: string;
363+
key?;
364364
eventKey: string;
365365
title: any;
366366
children?: any;
@@ -438,10 +438,11 @@ export function Alert(props: AlertProps) {
438438
}
439439

440440
export function Panel(props: {
441-
key?: string;
441+
key?;
442442
style?: React.CSSProperties;
443-
header?: any;
443+
header?;
444444
children?: any;
445+
onClick?;
445446
}) {
446447
const style = { ...{ marginBottom: "20px" }, ...props.style };
447448
return (
@@ -451,6 +452,7 @@ export function Panel(props: {
451452
styles={{
452453
header: { color: COLORS.GRAY_DD, backgroundColor: COLORS.GRAY_LLL },
453454
}}
455+
onClick={props.onClick}
454456
>
455457
{props.children}
456458
</AntdCard>

src/packages/frontend/billing/confirm-payment-method.tsx

Lines changed: 1 addition & 1 deletion
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, Well } from "react-bootstrap";
6+
import { Alert, Well } from "@cocalc/frontend/antd-bootstrap";
77
import { Component, Rendered } from "../app-framework";
88
import { Gap } from "../components/gap";
99
import { Icon } from "../components/icon";

src/packages/frontend/billing/license-examples.tsx

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ import {
1010
} from "@cocalc/util/licenses/purchase/consts";
1111
import { Cost, User } from "@cocalc/util/licenses/purchase/types";
1212
import { COLORS } from "@cocalc/util/theme";
13-
import { Col, Row, Table } from "react-bootstrap";
13+
import { Col, Row, Panel } from "@cocalc/frontend/antd-bootstrap";
1414
import { React } from "../app-framework";
1515
import { Icon, IconName, Gap } from "../components";
16-
const { Panel } = require("react-bootstrap");
1716

1817
// This component renders 3 price examples for licensed upgrades in a row
1918

@@ -60,7 +59,7 @@ export const LicenseExamples: React.FC<Props> = ({
6059
large,
6160
emph: boolean,
6261
online: boolean,
63-
descr?: string
62+
descr?: string,
6463
) {
6564
const smallpx = `${small}px`;
6665
const largepx = `${large}px`;
@@ -93,7 +92,7 @@ export const LicenseExamples: React.FC<Props> = ({
9392
30,
9493
true,
9594
true,
96-
"purchased online"
95+
"purchased online",
9796
)}
9897
</>
9998
);
@@ -119,7 +118,7 @@ export const LicenseExamples: React.FC<Props> = ({
119118
const large = 26;
120119
return (
121120
<>
122-
<Table className={"cc-price-table"}>
121+
<table>
123122
<tbody>
124123
<tr>
125124
<td></td>
@@ -134,17 +133,11 @@ export const LicenseExamples: React.FC<Props> = ({
134133
14,
135134
large,
136135
false,
137-
false
136+
false,
138137
)}
139138
</td>
140139
<td>
141-
{render_price_number(
142-
price_monthly.cost,
143-
14,
144-
large,
145-
true,
146-
true
147-
)}
140+
{render_price_number(price_monthly.cost, 14, large, true, true)}
148141
</td>
149142
</tr>
150143
<tr>
@@ -155,21 +148,15 @@ export const LicenseExamples: React.FC<Props> = ({
155148
14,
156149
large,
157150
false,
158-
false
151+
false,
159152
)}
160153
</td>
161154
<td>
162-
{render_price_number(
163-
price_yearly.cost,
164-
14,
165-
large,
166-
true,
167-
true
168-
)}
155+
{render_price_number(price_yearly.cost, 14, large, true, true)}
169156
</td>
170157
</tr>
171158
</tbody>
172-
</Table>
159+
</table>
173160
</>
174161
);
175162
}
@@ -184,7 +171,7 @@ export const LicenseExamples: React.FC<Props> = ({
184171
);
185172
return (
186173
<Col sm={4} key={title}>
187-
<Panel header={header} bsStyle={"info"}>
174+
<Panel header={header}>
188175
<Gap />
189176
{lines.map((line) => render_example_line(line))}
190177
<Gap />

src/packages/frontend/billing/payment-method.tsx

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

66
import { Rendered, useState } from "../app-framework";
7-
import { Alert, Button, ButtonToolbar, Row, Col } from "react-bootstrap";
8-
import { Icon, IconName} from "../components/icon";
7+
import {
8+
Alert,
9+
Button,
10+
ButtonToolbar,
11+
Row,
12+
Col,
13+
} from "@cocalc/frontend/antd-bootstrap";
14+
import { Icon, IconName } from "../components/icon";
915
import { Gap } from "../components/gap";
1016
import { brand_to_icon_name } from "./data";
1117

@@ -24,7 +30,7 @@ export const PaymentMethod: React.FC<Props> = (props) => {
2430

2531
function icon_name(): IconName {
2632
return brand_to_icon_name(
27-
props.source.brand != null ? props.source.brand.toLowerCase() : undefined
33+
props.source.brand != null ? props.source.brand.toLowerCase() : undefined,
2834
);
2935
}
3036

src/packages/frontend/billing/payment-methods.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@
44
*/
55

66
import { Rendered, useActions, useState } from "../app-framework";
7-
import { Button, Row, Col } from "../antd-bootstrap";
8-
const { Panel } = require("react-bootstrap"); // since the typescript declarations are our of sync with our crappy old version.
7+
import { Button, Row, Col, Panel } from "../antd-bootstrap";
98
import { Icon } from "../components/icon";
10-
119
import { Source } from "./types";
12-
1310
import { AddPaymentMethod } from "./add-payment-method";
1411
import { PaymentMethod } from "./payment-method";
1512
import { ErrorDisplay } from "../components/error-display";

src/packages/frontend/billing/plan-info.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,12 @@
55

66
import { PROJECT_UPGRADES } from "@cocalc/util/schema";
77
import { plural, capitalize } from "@cocalc/util/misc";
8-
98
import { Component, Rendered } from "../app-framework";
109
import { Tip } from "../components/tip";
1110
import { Icon } from "../components/icon";
1211
import { Gap } from "../components/gap";
1312
import { r_join } from "../components/r_join";
14-
import { Button } from "react-bootstrap";
15-
const { Panel } = require("react-bootstrap"); // since the typescript declarations are our of sync with our crappy old version.
16-
13+
import { Button, Panel } from "@cocalc/frontend/antd-bootstrap";
1714
import { PeriodName } from "./types";
1815

1916
interface Props {
@@ -63,7 +60,7 @@ export class PlanInfo extends Component<Props> {
6360
result.push(
6461
<Button key={i} bsStyle={this.props.selected ? "primary" : undefined}>
6562
{this.render_cost(prices[i], this.props.periods[i])}
66-
</Button>
63+
</Button>,
6764
);
6865
}
6966
return result;
@@ -122,7 +119,6 @@ export class PlanInfo extends Component<Props> {
122119
<Panel
123120
style={style}
124121
header={this.render_plan_name(plan_data)}
125-
bsStyle={this.props.selected ? "primary" : "info"}
126122
onClick={() =>
127123
this.props.on_click != null ? this.props.on_click() : undefined
128124
}
@@ -134,8 +130,8 @@ export class PlanInfo extends Component<Props> {
134130
this.render_plan_info_line(
135131
name,
136132
benefits[name] != null ? benefits[name] : 0,
137-
params[name]
138-
)
133+
params[name],
134+
),
139135
)}
140136
<Gap />
141137

src/packages/frontend/billing/project-quota-bounds-table.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
import { Component, Rendered } from "../app-framework";
77
const { HelpEmailLink } = require("../customize");
88
import { PROJECT_UPGRADES } from "@cocalc/util/schema";
9-
const { Panel } = require("react-bootstrap"); // since the typescript declarations are our of sync with our crappy old version.
10-
9+
import { Panel } from "@cocalc/frontend/antd-bootstrap";
1110
import { render_project_quota } from "./util";
1211

1312
export class ProjectQuotaBoundsTable extends Component {

src/packages/frontend/billing/project-quota-free-table.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ import { DEFAULT_QUOTAS, PROJECT_UPGRADES } from "@cocalc/util/schema";
1313
import { Tip } from "../components/tip";
1414
import { Icon } from "../components/icon";
1515
import { Gap } from "../components/gap";
16-
const { Panel } = require("react-bootstrap"); // since the typescript declarations are our of sync with our crappy old version.
17-
16+
import { Panel } from "@cocalc/frontend/antd-bootstrap";
1817
import { render_project_quota } from "./util";
1918

2019
export class ProjectQuotaFreeTable extends Component {
@@ -29,7 +28,7 @@ export class ProjectQuotaFreeTable extends Component {
2928

3029
public render(): Rendered {
3130
return (
32-
<Panel header={this.render_header()} bsStyle="info">
31+
<Panel header={this.render_header()}>
3332
<Gap />
3433
<div style={{ marginBottom: "5px", marginLeft: "10px" }}>
3534
<Tip

src/packages/frontend/billing/subscription-grid.tsx

Lines changed: 1 addition & 1 deletion
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 { Row, Col } from "react-bootstrap";
6+
import { Row, Col } from "@cocalc/frontend/antd-bootstrap";
77
import { Component, Rendered, redux } from "../app-framework";
88
import { keys, intersection } from "lodash";
99
import { PeriodName } from "./types";

src/packages/frontend/library/component.tsx

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

66
import { join } from "path";
7-
87
import { path_split, search_match, search_split } from "@cocalc/util/misc";
98
import { COLORS } from "@cocalc/util/theme";
109
import track from "@cocalc/frontend/user-tracking";
11-
12-
declare var $: any;
13-
1410
import {
1511
useActions,
1612
useMemo,
@@ -22,12 +18,13 @@ import {
2218
ReactDOM,
2319
Fragment,
2420
} from "../app-framework";
25-
2621
import { Col, Row, Button, ListGroup, ListGroupItem } from "react-bootstrap";
27-
2822
import { Markdown, Icon, Loading, SearchInput } from "../components";
2923
import { webapp_client } from "../webapp-client";
3024

25+
26+
declare var $: any;
27+
3128
// used for some styles
3229
const HEIGHT = "275px";
3330

0 commit comments

Comments
 (0)