mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-19 06:03:50 +01:00
fix settings unfocusing on every key stroke
This commit is contained in:
parent
fb372bef54
commit
3fe6a6e19d
@ -1,9 +1,8 @@
|
|||||||
import { List, ListItem, Paper, Typography } from "@mui/material";
|
import { List, Paper, Typography } from "@mui/material";
|
||||||
import { uniqueId } from "lodash";
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
children: React.ReactElement | (React.ReactElement | null)[];
|
children: React.ReactNode;
|
||||||
title: string;
|
title: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -11,19 +10,7 @@ export const GameOptionsPage = (props: IProps): React.ReactElement => {
|
|||||||
return (
|
return (
|
||||||
<Paper sx={{ height: "fit-content", p: 1 }}>
|
<Paper sx={{ height: "fit-content", p: 1 }}>
|
||||||
<Typography variant="h6">{props.title}</Typography>
|
<Typography variant="h6">{props.title}</Typography>
|
||||||
{(props.children as any)?.length > 1 ? (
|
{props.children}
|
||||||
<List disablePadding dense>
|
|
||||||
{(props.children as React.ReactElement[])
|
|
||||||
.filter((c) => c)
|
|
||||||
.map((c, i) => (
|
|
||||||
<ListItem key={uniqueId(String(i))} sx={{ px: 0, display: "block" }}>
|
|
||||||
{c}
|
|
||||||
</ListItem>
|
|
||||||
))}
|
|
||||||
</List>
|
|
||||||
) : (
|
|
||||||
props.children
|
|
||||||
)}
|
|
||||||
</Paper>
|
</Paper>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -28,7 +28,7 @@ export function GameOptionsRoot(props: IProps): React.ReactElement {
|
|||||||
<Box sx={{ display: "grid", gridTemplateColumns: "1fr 3fr", gap: 1 }}>
|
<Box sx={{ display: "grid", gridTemplateColumns: "1fr 3fr", gap: 1 }}>
|
||||||
<GameOptionsSidebar
|
<GameOptionsSidebar
|
||||||
tab={currentTab}
|
tab={currentTab}
|
||||||
setTab={(tab: GameOptionsTab) => setCurrentTab(tab)}
|
setTab={setCurrentTab}
|
||||||
player={props.player}
|
player={props.player}
|
||||||
router={props.router}
|
router={props.router}
|
||||||
save={props.save}
|
save={props.save}
|
||||||
|
@ -58,6 +58,7 @@ export const InterfacePage = (): React.ReactElement => {
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
<TextField
|
<TextField
|
||||||
|
key={"timestampFormat"}
|
||||||
InputProps={{
|
InputProps={{
|
||||||
startAdornment: (
|
startAdornment: (
|
||||||
<Typography
|
<Typography
|
||||||
|
@ -18,6 +18,7 @@ export const MiscPage = (): React.ReactElement => {
|
|||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
<br />
|
||||||
<OptionSwitch
|
<OptionSwitch
|
||||||
checked={Settings.EnableBashHotkeys}
|
checked={Settings.EnableBashHotkeys}
|
||||||
onChange={(newValue) => (Settings.EnableBashHotkeys = newValue)}
|
onChange={(newValue) => (Settings.EnableBashHotkeys = newValue)}
|
||||||
|
@ -34,6 +34,7 @@ export const RemoteAPIPage = (): React.ReactElement => {
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
<TextField
|
<TextField
|
||||||
|
key={"remoteAPIPort"}
|
||||||
InputProps={{
|
InputProps={{
|
||||||
startAdornment: (
|
startAdornment: (
|
||||||
<Typography color={remoteFileApiPort > 0 && remoteFileApiPort <= 65535 ? "success" : "error"}>
|
<Typography color={remoteFileApiPort > 0 && remoteFileApiPort <= 65535 ? "success" : "error"}>
|
||||||
|
@ -18,6 +18,7 @@ export function OptionSwitch({ checked, onChange, text, tooltip }: IProps): Reac
|
|||||||
useEffect(() => onChange(value), [value]);
|
useEffect(() => onChange(value), [value]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
control={<Switch checked={value} onChange={handleSwitchChange} />}
|
control={<Switch checked={value} onChange={handleSwitchChange} />}
|
||||||
label={
|
label={
|
||||||
@ -26,5 +27,7 @@ export function OptionSwitch({ checked, onChange, text, tooltip }: IProps): Reac
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
<br />
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user