Skip to content

Commit 9888aed

Browse files
committed
eliminate all use of InputGroup from react-bootstrap
1 parent 8a58ef4 commit 9888aed

File tree

2 files changed

+12
-23
lines changed

2 files changed

+12
-23
lines changed

src/packages/frontend/antd-bootstrap.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ export {
2020
Form,
2121
FormControl,
2222
FormGroup,
23-
InputGroup,
2423
ListGroup,
2524
ListGroupItem,
2625
} from "react-bootstrap";

src/packages/frontend/components/upgrade-adjustor.tsx

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,11 @@ javascript object in the same format as quota_params cancel_upgrading takes no
1010
arguments and is called when the cancel button is hit.
1111
*/
1212

13-
import { Button as AntdButton, Checkbox, Alert } from "antd";
14-
13+
import { Button as AntdButton, Checkbox, Alert, InputNumber } from "antd";
1514
import {
1615
Button,
1716
ButtonToolbar,
1817
Col,
19-
FormControl,
20-
FormGroup,
21-
InputGroup,
2218
Row,
2319
} from "@cocalc/frontend/antd-bootstrap";
2420
import {
@@ -123,7 +119,7 @@ export const UpgradeAdjustor: React.FC<Props> = (props) => {
123119
// how much unused upgrade you have remaining
124120
const user_remaining = map_diff(
125121
props.upgrades_you_can_use as any,
126-
user_upgrades as any
122+
user_upgrades as any,
127123
);
128124
// the overall limits are capped by the maximum per project
129125
const proj_maximum = PROJECT_UPGRADES.max_per_project;
@@ -210,7 +206,7 @@ export const UpgradeAdjustor: React.FC<Props> = (props) => {
210206
current: number,
211207
limit: number,
212208
total: number,
213-
proj_remainder: number
209+
proj_remainder: number,
214210
) {
215211
let label, reason, reasons, show_remaining, val;
216212
if (data == null) {
@@ -338,19 +334,13 @@ export const UpgradeAdjustor: React.FC<Props> = (props) => {
338334
{remaining_note}
339335
</Col>
340336
<Col sm={5}>
341-
<FormGroup>
342-
<InputGroup>
343-
<FormControl
344-
type={"text"}
345-
value={val_state}
346-
style={style}
347-
onChange={(e) => set_state(name, (e.target as any).value)}
348-
/>
349-
<InputGroup.Addon>
350-
{render_addon(name, display_unit, limit)}
351-
</InputGroup.Addon>
352-
</InputGroup>
353-
</FormGroup>
337+
<InputNumber
338+
addonAfter={render_addon(name, display_unit, limit)}
339+
value={val}
340+
style={style}
341+
min={0}
342+
onChange={(value) => set_state(name, value)}
343+
/>
354344
{label}
355345
</Col>
356346
</Row>
@@ -372,7 +362,7 @@ export const UpgradeAdjustor: React.FC<Props> = (props) => {
372362
const current_val = round2((current[name] ?? 0) * factor);
373363
const remaining_val = Math.max(
374364
round2((remaining[name] ?? 0) * factor),
375-
0
365+
0,
376366
); // everything is now in display units
377367

378368
if (data.input_type === "checkbox") {
@@ -514,7 +504,7 @@ export const UpgradeAdjustor: React.FC<Props> = (props) => {
514504
current[name] ?? 0,
515505
limits[name] ?? 0,
516506
totals[name] ?? 0,
517-
proj_remainder[name] ?? 0
507+
proj_remainder[name] ?? 0,
518508
);
519509
})}
520510
<UpgradeRestartWarning style={{ marginTop: "15px" }} />

0 commit comments

Comments
 (0)