From 2d463b60a077d69ff7cfc3753d542603ee16e3fc Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Mon, 13 Sep 2021 22:27:43 -0400 Subject: [PATCH] litn --- src/DevMenu.tsx | 32 +++------------ src/DevMenu/ui/Adjuster.tsx | 35 ++++++++++------- src/DevMenu/ui/Augmentations.tsx | 5 +-- src/DevMenu/ui/Bladeburner.tsx | 1 - src/DevMenu/ui/CodingContracts.tsx | 19 ++------- src/DevMenu/ui/Companies.tsx | 16 ++------ src/DevMenu/ui/Corporation.tsx | 2 +- src/DevMenu/ui/Factions.tsx | 4 +- src/DevMenu/ui/Gang.tsx | 1 - src/DevMenu/ui/General.tsx | 2 +- src/DevMenu/ui/Programs.tsx | 11 +----- src/DevMenu/ui/Servers.tsx | 18 ++------- src/DevMenu/ui/Sleeves.tsx | 8 +--- src/DevMenu/ui/SourceFiles.tsx | 3 +- src/DevMenu/ui/Stats.tsx | 2 +- src/DevMenu/ui/StockMarket.tsx | 14 ++----- src/DevMenu/ui/TimeSkip.tsx | 6 +-- src/Locations/ui/TravelAgencyLocation.tsx | 2 +- src/ui/React/Button.tsx | 47 ----------------------- src/ui/React/TextField.tsx | 19 --------- src/ui/React/Theme.tsx | 34 ++++++++++++++-- 21 files changed, 82 insertions(+), 199 deletions(-) delete mode 100644 src/ui/React/Button.tsx delete mode 100644 src/ui/React/TextField.tsx diff --git a/src/DevMenu.tsx b/src/DevMenu.tsx index b2f515198..73b5d1ebd 100644 --- a/src/DevMenu.tsx +++ b/src/DevMenu.tsx @@ -1,30 +1,8 @@ -import { AugmentationNames } from "./Augmentation/data/AugmentationNames"; -import { CodingContractTypes } from "./CodingContracts"; -import { generateContract, generateRandomContract, generateRandomContractOnHome } from "./CodingContractGenerator"; import { IPlayer } from "./PersonObjects/IPlayer"; import { Bladeburner } from "./Bladeburner/Bladeburner"; import { IEngine } from "./IEngine"; -import { saveObject } from "./SaveObject"; -import { dialogBoxCreate } from "../utils/DialogBox"; -import { Money } from "./ui/React/Money"; -import { TextField } from "./ui/React/TextField"; -import { Button } from "./ui/React/Button"; -import { Select } from "./ui/React/Select"; - -import React, { useState } from "react"; -import AddIcon from "@material-ui/icons/Add"; -import RemoveIcon from "@material-ui/icons/Remove"; -import IconButton from "@material-ui/core/IconButton"; -import ExposureZeroIcon from "@material-ui/icons/ExposureZero"; -import ButtonGroup from "@material-ui/core/ButtonGroup"; -import DoubleArrowIcon from "@material-ui/icons/DoubleArrow"; -import ReplyAllIcon from "@material-ui/icons/ReplyAll"; -import ReplyIcon from "@material-ui/icons/Reply"; -import ExpandMoreIcon from "@material-ui/icons/ExpandMore"; -import MenuItem from "@material-ui/core/MenuItem"; -import FormControl from "@material-ui/core/FormControl"; -import InputLabel from "@material-ui/core/InputLabel"; +import React from "react"; import { Theme } from "./ui/React/Theme"; import { General } from "./DevMenu/ui/General"; @@ -59,8 +37,8 @@ export function DevMenuRoot(props: IProps): React.ReactElement { - - + + {props.player.bladeburner instanceof Bladeburner && } @@ -68,9 +46,9 @@ export function DevMenuRoot(props: IProps): React.ReactElement { {props.player.hasCorporation() && } - + - {props.player.hasWseAccount && } + {props.player.hasWseAccount && } {props.player.sleeves.length > 0 && } diff --git a/src/DevMenu/ui/Adjuster.tsx b/src/DevMenu/ui/Adjuster.tsx index 657176633..1b9cd83ea 100644 --- a/src/DevMenu/ui/Adjuster.tsx +++ b/src/DevMenu/ui/Adjuster.tsx @@ -4,7 +4,8 @@ import RemoveIcon from "@material-ui/icons/Remove"; import IconButton from "@material-ui/core/IconButton"; import ExposureZeroIcon from "@material-ui/icons/ExposureZero"; import DoubleArrowIcon from "@material-ui/icons/DoubleArrow"; -import { TextField } from "../../ui/React/TextField"; +import TextField from "@material-ui/core/TextField"; +import Tooltip from "@material-ui/core/Tooltip"; interface IProps { label: string; @@ -35,22 +36,30 @@ export function Adjuster(props: IProps): React.ReactElement { InputProps={{ startAdornment: ( <> - - - - add(typeof value !== "string" ? value : 0)}> - - + + + + + + + add(typeof value !== "string" ? value : 0)}> + + + ), endAdornment: ( <> - subtract(typeof value !== "string" ? value : 0)}> - - - - - + + subtract(typeof value !== "string" ? value : 0)}> + + + + + + + + ), }} diff --git a/src/DevMenu/ui/Augmentations.tsx b/src/DevMenu/ui/Augmentations.tsx index 94fd032e6..248dcc385 100644 --- a/src/DevMenu/ui/Augmentations.tsx +++ b/src/DevMenu/ui/Augmentations.tsx @@ -5,8 +5,7 @@ import AccordionSummary from "@material-ui/core/AccordionSummary"; import AccordionDetails from "@material-ui/core/AccordionDetails"; import ExpandMoreIcon from "@material-ui/icons/ExpandMore"; -import { Button } from "../../ui/React/Button"; -import { Select } from "../../ui/React/Select"; +import Select from "@material-ui/core/Select"; import { IPlayer } from "../../PersonObjects/IPlayer"; import { AugmentationNames } from "../../Augmentation/data/AugmentationNames"; import MenuItem from "@material-ui/core/MenuItem"; @@ -14,8 +13,6 @@ import IconButton from "@material-ui/core/IconButton"; import ReplyAllIcon from "@material-ui/icons/ReplyAll"; import ReplyIcon from "@material-ui/icons/Reply"; -const bigNumber = 1e27; - interface IProps { player: IPlayer; } diff --git a/src/DevMenu/ui/Bladeburner.tsx b/src/DevMenu/ui/Bladeburner.tsx index 287dc9603..181d0edf0 100644 --- a/src/DevMenu/ui/Bladeburner.tsx +++ b/src/DevMenu/ui/Bladeburner.tsx @@ -5,7 +5,6 @@ import AccordionSummary from "@material-ui/core/AccordionSummary"; import AccordionDetails from "@material-ui/core/AccordionDetails"; import ExpandMoreIcon from "@material-ui/icons/ExpandMore"; -import { Button } from "../../ui/React/Button"; import { Adjuster } from "./Adjuster"; import { IPlayer } from "../../PersonObjects/IPlayer"; diff --git a/src/DevMenu/ui/CodingContracts.tsx b/src/DevMenu/ui/CodingContracts.tsx index 9944f2b43..152dd8ea1 100644 --- a/src/DevMenu/ui/CodingContracts.tsx +++ b/src/DevMenu/ui/CodingContracts.tsx @@ -5,24 +5,13 @@ import AccordionSummary from "@material-ui/core/AccordionSummary"; import AccordionDetails from "@material-ui/core/AccordionDetails"; import ExpandMoreIcon from "@material-ui/icons/ExpandMore"; -import { Button } from "../../ui/React/Button"; -import { Select } from "../../ui/React/Select"; -import { PlayerOwnedSourceFile } from "../../SourceFile/PlayerOwnedSourceFile"; -import { IPlayer } from "../../PersonObjects/IPlayer"; -import { generateContract, generateRandomContract, generateRandomContractOnHome } from "../../CodingContractGenerator"; -import ButtonGroup from "@material-ui/core/ButtonGroup"; +import Button from "@material-ui/core/Button"; +import Select from "@material-ui/core/Select"; import MenuItem from "@material-ui/core/MenuItem"; +import { generateContract, generateRandomContract, generateRandomContractOnHome } from "../../CodingContractGenerator"; import { CodingContractTypes } from "../../CodingContracts"; -// Update as additional BitNodes get implemented -const validSFN = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]; -const bigNumber = 1e27; - -interface IProps { - player: IPlayer; -} - -export function CodingContracts(props: IProps): React.ReactElement { +export function CodingContracts(): React.ReactElement { const [codingcontract, setCodingcontract] = useState("Find Largest Prime Factor"); function setCodingcontractDropdown(event: React.ChangeEvent<{ value: unknown }>): void { setCodingcontract(event.target.value as string); diff --git a/src/DevMenu/ui/Companies.tsx b/src/DevMenu/ui/Companies.tsx index eb698db63..dcb309f3c 100644 --- a/src/DevMenu/ui/Companies.tsx +++ b/src/DevMenu/ui/Companies.tsx @@ -5,25 +5,15 @@ import AccordionSummary from "@material-ui/core/AccordionSummary"; import AccordionDetails from "@material-ui/core/AccordionDetails"; import ExpandMoreIcon from "@material-ui/icons/ExpandMore"; -import { Button } from "../../ui/React/Button"; -import { Select } from "../../ui/React/Select"; -import { IPlayer } from "../../PersonObjects/IPlayer"; +import Button from "@material-ui/core/Button"; +import Select from "@material-ui/core/Select"; import { Companies as AllCompanies } from "../../Company/Companies"; -import FormControl from "@material-ui/core/FormControl"; import MenuItem from "@material-ui/core/MenuItem"; -import IconButton from "@material-ui/core/IconButton"; -import ReplyAllIcon from "@material-ui/icons/ReplyAll"; -import ReplyIcon from "@material-ui/icons/Reply"; -import InputLabel from "@material-ui/core/InputLabel"; import { Adjuster } from "./Adjuster"; const bigNumber = 1e12; -interface IProps { - player: IPlayer; -} - -export function Companies(props: IProps): React.ReactElement { +export function Companies(): React.ReactElement { const [company, setCompany] = useState("ECorp"); function setCompanyDropdown(event: React.ChangeEvent<{ value: unknown }>): void { setCompany(event.target.value as string); diff --git a/src/DevMenu/ui/Corporation.tsx b/src/DevMenu/ui/Corporation.tsx index 8505b395d..0772f8898 100644 --- a/src/DevMenu/ui/Corporation.tsx +++ b/src/DevMenu/ui/Corporation.tsx @@ -5,7 +5,7 @@ import AccordionSummary from "@material-ui/core/AccordionSummary"; import AccordionDetails from "@material-ui/core/AccordionDetails"; import ExpandMoreIcon from "@material-ui/icons/ExpandMore"; -import { Button } from "../../ui/React/Button"; +import Button from "@material-ui/core/Button"; import { Adjuster } from "./Adjuster"; import { IPlayer } from "../../PersonObjects/IPlayer"; diff --git a/src/DevMenu/ui/Factions.tsx b/src/DevMenu/ui/Factions.tsx index 1692eb28b..55b170c41 100644 --- a/src/DevMenu/ui/Factions.tsx +++ b/src/DevMenu/ui/Factions.tsx @@ -5,8 +5,8 @@ import AccordionSummary from "@material-ui/core/AccordionSummary"; import AccordionDetails from "@material-ui/core/AccordionDetails"; import ExpandMoreIcon from "@material-ui/icons/ExpandMore"; -import { Button } from "../../ui/React/Button"; -import { Select } from "../../ui/React/Select"; +import Button from "@material-ui/core/Button"; +import Select from "@material-ui/core/Select"; import { Adjuster } from "./Adjuster"; import { IPlayer } from "../../PersonObjects/IPlayer"; import { Factions as AllFaction } from "../../Faction/Factions"; diff --git a/src/DevMenu/ui/Gang.tsx b/src/DevMenu/ui/Gang.tsx index 8ad25fb7b..4b7654b9e 100644 --- a/src/DevMenu/ui/Gang.tsx +++ b/src/DevMenu/ui/Gang.tsx @@ -5,7 +5,6 @@ import AccordionSummary from "@material-ui/core/AccordionSummary"; import AccordionDetails from "@material-ui/core/AccordionDetails"; import ExpandMoreIcon from "@material-ui/icons/ExpandMore"; -import { Button } from "../../ui/React/Button"; import { Adjuster } from "./Adjuster"; import { IPlayer } from "../../PersonObjects/IPlayer"; diff --git a/src/DevMenu/ui/General.tsx b/src/DevMenu/ui/General.tsx index 210a16f96..9f67e145c 100644 --- a/src/DevMenu/ui/General.tsx +++ b/src/DevMenu/ui/General.tsx @@ -5,7 +5,7 @@ import AccordionSummary from "@material-ui/core/AccordionSummary"; import AccordionDetails from "@material-ui/core/AccordionDetails"; import ExpandMoreIcon from "@material-ui/icons/ExpandMore"; -import { Button } from "../../ui/React/Button"; +import Button from "@material-ui/core/Button"; import { Money } from "../../ui/React/Money"; import { IPlayer } from "../../PersonObjects/IPlayer"; import { hackWorldDaemon } from "../../RedPill"; diff --git a/src/DevMenu/ui/Programs.tsx b/src/DevMenu/ui/Programs.tsx index 85cd88406..20a937b76 100644 --- a/src/DevMenu/ui/Programs.tsx +++ b/src/DevMenu/ui/Programs.tsx @@ -5,18 +5,11 @@ import AccordionSummary from "@material-ui/core/AccordionSummary"; import AccordionDetails from "@material-ui/core/AccordionDetails"; import ExpandMoreIcon from "@material-ui/icons/ExpandMore"; -import { Button } from "../../ui/React/Button"; -import { Select } from "../../ui/React/Select"; +import Button from "@material-ui/core/Button"; +import Select from "@material-ui/core/Select"; import { IPlayer } from "../../PersonObjects/IPlayer"; import { Programs as AllPrograms } from "../../Programs/Programs"; -import FormControl from "@material-ui/core/FormControl"; import MenuItem from "@material-ui/core/MenuItem"; -import IconButton from "@material-ui/core/IconButton"; -import ReplyAllIcon from "@material-ui/icons/ReplyAll"; -import ReplyIcon from "@material-ui/icons/Reply"; -import InputLabel from "@material-ui/core/InputLabel"; - -const bigNumber = 1e12; interface IProps { player: IPlayer; diff --git a/src/DevMenu/ui/Servers.tsx b/src/DevMenu/ui/Servers.tsx index 050c6607f..e02ac248f 100644 --- a/src/DevMenu/ui/Servers.tsx +++ b/src/DevMenu/ui/Servers.tsx @@ -5,26 +5,14 @@ import AccordionSummary from "@material-ui/core/AccordionSummary"; import AccordionDetails from "@material-ui/core/AccordionDetails"; import ExpandMoreIcon from "@material-ui/icons/ExpandMore"; -import { Button } from "../../ui/React/Button"; -import { Select } from "../../ui/React/Select"; -import { IPlayer } from "../../PersonObjects/IPlayer"; +import Button from "@material-ui/core/Button"; +import Select from "@material-ui/core/Select"; import { AllServers } from "../../Server/AllServers"; import { HacknetServer } from "../../Hacknet/HacknetServer"; import { GetServerByHostname } from "../../Server/ServerHelpers"; -import FormControl from "@material-ui/core/FormControl"; import MenuItem from "@material-ui/core/MenuItem"; -import IconButton from "@material-ui/core/IconButton"; -import ReplyAllIcon from "@material-ui/icons/ReplyAll"; -import ReplyIcon from "@material-ui/icons/Reply"; -import InputLabel from "@material-ui/core/InputLabel"; -const bigNumber = 1e12; - -interface IProps { - player: IPlayer; -} - -export function Servers(props: IProps): React.ReactElement { +export function Servers(): React.ReactElement { const [server, setServer] = useState("home"); function setServerDropdown(event: React.ChangeEvent<{ value: unknown }>): void { setServer(event.target.value as string); diff --git a/src/DevMenu/ui/Sleeves.tsx b/src/DevMenu/ui/Sleeves.tsx index 6e58a05e3..a01f30521 100644 --- a/src/DevMenu/ui/Sleeves.tsx +++ b/src/DevMenu/ui/Sleeves.tsx @@ -5,14 +5,8 @@ import AccordionSummary from "@material-ui/core/AccordionSummary"; import AccordionDetails from "@material-ui/core/AccordionDetails"; import ExpandMoreIcon from "@material-ui/icons/ExpandMore"; -import { Button } from "../../ui/React/Button"; -import { PlayerOwnedSourceFile } from "../../SourceFile/PlayerOwnedSourceFile"; +import Button from "@material-ui/core/Button"; import { IPlayer } from "../../PersonObjects/IPlayer"; -import ButtonGroup from "@material-ui/core/ButtonGroup"; - -// Update as additional BitNodes get implemented -const validSFN = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]; -const bigNumber = 1e27; interface IProps { player: IPlayer; diff --git a/src/DevMenu/ui/SourceFiles.tsx b/src/DevMenu/ui/SourceFiles.tsx index 6254b7f65..f736ccaea 100644 --- a/src/DevMenu/ui/SourceFiles.tsx +++ b/src/DevMenu/ui/SourceFiles.tsx @@ -5,14 +5,13 @@ import AccordionSummary from "@material-ui/core/AccordionSummary"; import AccordionDetails from "@material-ui/core/AccordionDetails"; import ExpandMoreIcon from "@material-ui/icons/ExpandMore"; -import { Button } from "../../ui/React/Button"; +import Button from "@material-ui/core/Button"; import { PlayerOwnedSourceFile } from "../../SourceFile/PlayerOwnedSourceFile"; import { IPlayer } from "../../PersonObjects/IPlayer"; import ButtonGroup from "@material-ui/core/ButtonGroup"; // Update as additional BitNodes get implemented const validSFN = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]; -const bigNumber = 1e27; interface IProps { player: IPlayer; diff --git a/src/DevMenu/ui/Stats.tsx b/src/DevMenu/ui/Stats.tsx index d4adad16f..52cde8b5e 100644 --- a/src/DevMenu/ui/Stats.tsx +++ b/src/DevMenu/ui/Stats.tsx @@ -5,7 +5,7 @@ import AccordionSummary from "@material-ui/core/AccordionSummary"; import AccordionDetails from "@material-ui/core/AccordionDetails"; import ExpandMoreIcon from "@material-ui/icons/ExpandMore"; -import { Button } from "../../ui/React/Button"; +import Button from "@material-ui/core/Button"; import { Adjuster } from "./Adjuster"; import { IPlayer } from "../../PersonObjects/IPlayer"; diff --git a/src/DevMenu/ui/StockMarket.tsx b/src/DevMenu/ui/StockMarket.tsx index 6696ac71e..ba97166e2 100644 --- a/src/DevMenu/ui/StockMarket.tsx +++ b/src/DevMenu/ui/StockMarket.tsx @@ -5,22 +5,14 @@ import AccordionSummary from "@material-ui/core/AccordionSummary"; import AccordionDetails from "@material-ui/core/AccordionDetails"; import ExpandMoreIcon from "@material-ui/icons/ExpandMore"; -import { Button } from "../../ui/React/Button"; -import { TextField } from "../../ui/React/TextField"; +import Button from "@material-ui/core/Button"; +import TextField from "@material-ui/core/TextField"; import { Money } from "../../ui/React/Money"; -import { Adjuster } from "./Adjuster"; -import { IPlayer } from "../../PersonObjects/IPlayer"; import { dialogBoxCreate } from "../../../utils/DialogBox"; import { StockMarket as SM } from "../../StockMarket/StockMarket"; import { Stock } from "../../StockMarket/Stock"; -const bigNumber = 1e27; - -interface IProps { - player: IPlayer; -} - -export function StockMarket(props: IProps): React.ReactElement { +export function StockMarket(): React.ReactElement { const [stockPrice, setStockPrice] = useState(0); const [stockSymbol, setStockSymbol] = useState(""); diff --git a/src/DevMenu/ui/TimeSkip.tsx b/src/DevMenu/ui/TimeSkip.tsx index a8babbd84..d66b5f561 100644 --- a/src/DevMenu/ui/TimeSkip.tsx +++ b/src/DevMenu/ui/TimeSkip.tsx @@ -5,16 +5,12 @@ import AccordionSummary from "@material-ui/core/AccordionSummary"; import AccordionDetails from "@material-ui/core/AccordionDetails"; import ExpandMoreIcon from "@material-ui/icons/ExpandMore"; -import { Button } from "../../ui/React/Button"; -import { PlayerOwnedSourceFile } from "../../SourceFile/PlayerOwnedSourceFile"; +import Button from "@material-ui/core/Button"; import { IPlayer } from "../../PersonObjects/IPlayer"; -import ButtonGroup from "@material-ui/core/ButtonGroup"; import { saveObject } from "../../SaveObject"; import { IEngine } from "../../IEngine"; // Update as additional BitNodes get implemented -const validSFN = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]; -const bigNumber = 1e27; interface IProps { player: IPlayer; diff --git a/src/Locations/ui/TravelAgencyLocation.tsx b/src/Locations/ui/TravelAgencyLocation.tsx index 58a34db02..776304c08 100644 --- a/src/Locations/ui/TravelAgencyLocation.tsx +++ b/src/Locations/ui/TravelAgencyLocation.tsx @@ -61,7 +61,7 @@ function ListWorldMap(props: IProps): React.ReactElement { {Object.values(CityName) .filter((city: string) => city != props.p.city) .map((city: string) => { - const match = Object.entries(CityName).find(([key, value]) => value === city); + const match = Object.entries(CityName).find((entry) => entry[1] === city); if (match === undefined) throw new Error(`could not find key for city '${city}'`); return ( = (props: ButtonProps) => { - return ( - - ); -}; diff --git a/src/ui/React/TextField.tsx b/src/ui/React/TextField.tsx deleted file mode 100644 index 4f25c6eb5..000000000 --- a/src/ui/React/TextField.tsx +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Wrapper around material-ui's Button component that styles it with - * Bitburner's UI colors - */ - -import React from "react"; -import { TextField as MuiTF, TextFieldProps, makeStyles } from "@material-ui/core"; -import { colors } from "./Theme"; - -export const TextField: React.FC = (props: TextFieldProps) => { - return ( - - ); -}; diff --git a/src/ui/React/Theme.tsx b/src/ui/React/Theme.tsx index e1449280d..a08948ae5 100644 --- a/src/ui/React/Theme.tsx +++ b/src/ui/React/Theme.tsx @@ -1,7 +1,5 @@ import React from "react"; -import { createMuiTheme } from "@material-ui/core/styles"; - -import { ThemeProvider } from "@material-ui/core/styles"; +import { createMuiTheme, ThemeProvider } from "@material-ui/core/styles"; export const colors = { primarylight: "#0f0", @@ -41,7 +39,7 @@ export const theme = createMuiTheme({ borderBottomColor: "#fff", }, underline: { - "&:hover:before": { + "&:hover": { borderBottomColor: colors.primarydark, }, "&:before": { @@ -61,6 +59,20 @@ export const theme = createMuiTheme({ }, }, }, + MuiButton: { + root: { + backgroundColor: "#333", + border: "1px solid " + colors.well, + color: colors.primary, + margin: "5px", + padding: "3px 5px", + "&:hover": { + backgroundColor: "#000", + }, + + borderRadius: 0, + }, + }, MuiSelect: { icon: { color: colors.primary, @@ -86,6 +98,20 @@ export const theme = createMuiTheme({ backgroundColor: "#000", }, }, + MuiIconButton: { + root: { + color: colors.primary, + }, + }, + MuiTooltip: { + tooltip: { + fontSize: "1em", + color: colors.primary, + backgroundColor: colors.well, + borderRadius: 0, + border: "2px solid white", + }, + }, }, });