This commit is contained in:
Snarling 2022-04-18 07:41:09 -04:00
parent 0fda1ecabf
commit 02ccda197c

@ -4,7 +4,7 @@ import { Theme } from "@mui/material/styles";
import makeStyles from "@mui/styles/makeStyles";
import createStyles from "@mui/styles/createStyles";
import TextField from "@mui/material/TextField";
import Tooltip from "@mui/material/Tooltip";
import Popper from "@mui/material/Popper";
import { KEY } from "../../utils/helpers/keyCodes";
import { ITerminal } from "../ITerminal";
@ -376,22 +376,6 @@ export function TerminalInput({ terminal, router, player }: IProps): React.React
return (
<>
<Tooltip
title={
possibilities.length > 0 ? (
<>
<Typography classes={{ root: classes.preformatted }} color={"primary"} paragraph={false}>
Possible autocomplete candidate:
</Typography>
<Typography classes={{ root: classes.preformatted }} color={"primary"} paragraph={false}>
{possibilities.join(" ")}
</Typography>
</>
) : (
""
)
}
>
<TextField
fullWidth
color={terminal.action === null ? "primary" : "secondary"}
@ -412,10 +396,18 @@ export function TerminalInput({ terminal, router, player }: IProps): React.React
</Typography>
),
spellCheck: false,
onBlur: ()=>setPossibilities([]),
onKeyDown: onKeyDown,
}}
></TextField>
</Tooltip>
<Popper open={possibilities.length > 0} anchorEl={terminalInput.current} placement={"top-end"}>
<Typography classes={{ root: classes.preformatted }} color={"primary"} paragraph={false}>
Possible autocomplete candidate:
</Typography>
<Typography classes={{ root: classes.preformatted }} color={"primary"} paragraph={false}>
{possibilities.join(" ")}
</Typography>
</Popper>
</>
);
}