mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-10 01:33:54 +01:00
Simplify conditionals
This commit is contained in:
parent
d4f3128829
commit
762acfb7b5
@ -116,11 +116,23 @@ export function MinesweeperGame(props: IMinigameProps): React.ReactElement {
|
||||
}}
|
||||
>
|
||||
{flatGrid.map((item) => {
|
||||
const color = item.current
|
||||
? Settings.theme.infolight
|
||||
: item.marked
|
||||
? Settings.theme.warning
|
||||
: Settings.theme.error;
|
||||
let color: string;
|
||||
let icon: React.ReactElement;
|
||||
|
||||
if (item.marked) {
|
||||
color = Settings.theme.warning;
|
||||
icon = <Flag />;
|
||||
} else if (item.current) {
|
||||
color = Settings.theme.infolight;
|
||||
icon = <Close />;
|
||||
} else if (item.flagged) {
|
||||
color = Settings.theme.error;
|
||||
icon = <Report />;
|
||||
} else {
|
||||
color = Settings.theme.primary;
|
||||
icon = <></>;
|
||||
}
|
||||
|
||||
return (
|
||||
<Typography
|
||||
key={`${item}${uniqueId()}`}
|
||||
@ -134,7 +146,7 @@ export function MinesweeperGame(props: IMinigameProps): React.ReactElement {
|
||||
justifyContent: "center",
|
||||
}}
|
||||
>
|
||||
{item.current ? <Close /> : item.flagged ? <Report /> : item.marked ? <Flag /> : <></>}
|
||||
{icon}
|
||||
</Typography>
|
||||
);
|
||||
})}
|
||||
|
Loading…
Reference in New Issue
Block a user