From 4e8bb96f3fdb830673b1c9cf74e082bda0c06c56 Mon Sep 17 00:00:00 2001
From: Olivier Gagnon
Date: Fri, 1 Oct 2021 13:08:37 -0400
Subject: [PATCH] removing some of the classes
---
src/BitNode/ui/BitFlumeModal.tsx | 33 ++++++++++
src/BitNode/ui/BitFlumePopup.tsx | 30 ---------
src/BitNode/ui/BitverseRoot.tsx | 4 +-
src/Casino/Blackjack.tsx | 46 +++++--------
src/Casino/CardDeck/ReactCard.tsx | 12 ++--
src/CodingContracts.ts | 37 ++++-------
src/Corporation/ui/IndustryOverview.tsx | 4 +-
src/Corporation/ui/IndustryWarehouse.tsx | 12 ----
src/Corporation/ui/ThrowPartyModal.tsx | 2 +-
src/DevMenu/ui/General.tsx | 66 +++++++++----------
src/Faction/FactionHelpers.tsx | 10 +--
src/Faction/ui/DonateOption.tsx | 6 +-
src/Faction/ui/Info.tsx | 11 +++-
src/Faction/ui/InvitationModal.tsx | 40 +++++++++++
src/Faction/ui/InvitationPopup.tsx | 40 -----------
src/Faction/ui/PurchaseableAugmentation.tsx | 2 +-
src/Gang/ui/GangStats.tsx | 2 +-
src/Hacknet/ui/HacknetServerElem.tsx | 6 +-
src/Hacknet/ui/HacknetUpgradeElem.tsx | 2 +-
src/Hacknet/ui/HashUpgradeModal.tsx | 6 +-
src/Hacknet/ui/MultiplierButtons.tsx | 14 ++--
src/Hacknet/ui/PlayerInfo.tsx | 5 +-
src/Hacknet/ui/PurchaseButton.tsx | 10 +--
src/Infiltration/ui/BackwardGame.tsx | 9 +--
src/Infiltration/ui/BracketGame.tsx | 7 +-
src/Infiltration/ui/BribeGame.tsx | 15 +++--
src/Infiltration/ui/CheatCodeGame.tsx | 5 +-
src/Infiltration/ui/Countdown.tsx | 5 +-
src/Infiltration/ui/Cyberpunk2077Game.tsx | 7 +-
src/Infiltration/ui/Game.tsx | 5 +-
src/Infiltration/ui/Intro.tsx | 39 ++++++-----
src/Infiltration/ui/MinesweeperGame.tsx | 3 +-
src/Infiltration/ui/SlashGame.tsx | 5 +-
src/Infiltration/ui/Victory.tsx | 53 +++++++--------
src/Locations/ui/CompanyLocation.tsx | 22 ++++---
src/Locations/ui/SlumsLocation.tsx | 4 +-
src/Locations/ui/TechVendorLocation.tsx | 4 +-
src/Locations/ui/TravelAgencyRoot.tsx | 4 +-
.../Player/PlayerObjectGeneralMethods.tsx | 6 +-
src/PersonObjects/Sleeve/ui/SleeveElem.tsx | 2 +-
src/Programs/data/ProgramsMetadata.ts | 11 +---
src/ScriptEditor/ui/Root.tsx | 2 +-
src/StockMarket/ui/StockTickersConfig.tsx | 4 +-
src/Terminal/ui/TerminalRoot.tsx | 5 ++
src/engine.tsx | 6 +-
src/ui/GameRoot.tsx | 2 +
src/ui/React/Augmentation.tsx | 18 +++--
src/ui/React/CharacterOverview.tsx | 4 +-
src/ui/React/CinematicText.tsx | 4 +-
...tractPopup.tsx => CodingContractModal.tsx} | 66 +++++++++++++------
src/ui/React/Favor.tsx | 20 ++++--
src/ui/React/HashRate.tsx | 5 +-
src/ui/React/Hashes.tsx | 18 +++--
src/ui/React/Modal.tsx | 2 +
src/ui/React/Money.tsx | 21 +++++-
src/ui/React/Reputation.tsx | 18 ++++-
src/ui/React/ReputationRate.tsx | 5 +-
src/ui/WorkInProgressRoot.tsx | 25 +++----
58 files changed, 457 insertions(+), 374 deletions(-)
create mode 100644 src/BitNode/ui/BitFlumeModal.tsx
delete mode 100644 src/BitNode/ui/BitFlumePopup.tsx
create mode 100644 src/Faction/ui/InvitationModal.tsx
delete mode 100644 src/Faction/ui/InvitationPopup.tsx
rename src/ui/React/{CodingContractPopup.tsx => CodingContractModal.tsx} (53%)
diff --git a/src/BitNode/ui/BitFlumeModal.tsx b/src/BitNode/ui/BitFlumeModal.tsx
new file mode 100644
index 000000000..8fdd3e1fe
--- /dev/null
+++ b/src/BitNode/ui/BitFlumeModal.tsx
@@ -0,0 +1,33 @@
+import React, { useState, useEffect } from "react";
+import { Modal } from "../../ui/React/Modal";
+import { use } from "../../ui/Context";
+import { EventEmitter } from "../../utils/EventEmitter";
+import Typography from "@mui/material/Typography";
+import Button from "@mui/material/Button";
+
+export const BitFlumeEvent = new EventEmitter<[]>();
+
+export function BitFlumeModal(): React.ReactElement {
+ const router = use.Router();
+ const [open, setOpen] = useState(false);
+ function flume(): void {
+ router.toBitVerse(true, false);
+ setOpen(false);
+ }
+
+ useEffect(() => BitFlumeEvent.subscribe(() => setOpen(true)), []);
+
+ return (
+ setOpen(false)}>
+
+ WARNING: USING THIS PROGRAM WILL CAUSE YOU TO LOSE ALL OF YOUR PROGRESS ON THE CURRENT BITNODE.
+
+
+ Do you want to travel to the BitNode Nexus? This allows you to reset the current BitNode and select a new one.
+
+
+
+
+
+ );
+}
diff --git a/src/BitNode/ui/BitFlumePopup.tsx b/src/BitNode/ui/BitFlumePopup.tsx
deleted file mode 100644
index a915f356b..000000000
--- a/src/BitNode/ui/BitFlumePopup.tsx
+++ /dev/null
@@ -1,30 +0,0 @@
-import React from "react";
-import { IPlayer } from "../../PersonObjects/IPlayer";
-import { IRouter } from "../../ui/Router";
-import { removePopup } from "../../ui/React/createPopup";
-
-interface IProps {
- player: IPlayer;
- router: IRouter;
- popupId: string;
-}
-
-export function BitFlumePopup(props: IProps): React.ReactElement {
- function flume(): void {
- props.router.toBitVerse(true, false);
- removePopup(props.popupId);
- }
- return (
- <>
- WARNING: USING THIS PROGRAM WILL CAUSE YOU TO LOSE ALL OF YOUR PROGRESS ON THE CURRENT BITNODE.
-
-
- Do you want to travel to the BitNode Nexus? This allows you to reset the current BitNode and select a new one.
-
-
-
- >
- );
-}
diff --git a/src/BitNode/ui/BitverseRoot.tsx b/src/BitNode/ui/BitverseRoot.tsx
index b3abfe90c..bd7e7818a 100644
--- a/src/BitNode/ui/BitverseRoot.tsx
+++ b/src/BitNode/ui/BitverseRoot.tsx
@@ -150,7 +150,7 @@ export function BitverseRoot(props: IProps): React.ReactElement {
return (
// prettier-ignore
-
+ <>
O | O O | O O | O | | / __| \ | | O
@@ -203,7 +203,7 @@ export function BitverseRoot(props: IProps): React.ReactElement {
"> ",
"> (Enter a new BitNode using the image above)",
]} />
-
+ >
)}
{/* Main game part. Displays both if the game is in progress OR if there's a result so you can see
* the cards that led to that result. */}
{(gameInProgress || result !== Result.Pending) && (
-
+ <>
Player
@@ -396,28 +394,18 @@ export class Blackjack extends Game {
)}
-
+ <>
Industry: {division.type} (Corp Funds: )
@@ -218,7 +218,7 @@ function Text(): React.ReactElement {
Research
-
+ >
);
}
diff --git a/src/Corporation/ui/IndustryWarehouse.tsx b/src/Corporation/ui/IndustryWarehouse.tsx
index 01e87e433..119ef73de 100644
--- a/src/Corporation/ui/IndustryWarehouse.tsx
+++ b/src/Corporation/ui/IndustryWarehouse.tsx
@@ -56,18 +56,6 @@ function WarehouseRoot(props: IProps): React.ReactElement {
props.rerender();
}
- const ratioLines = [];
- for (const matName in division.reqMats) {
- if (division.reqMats.hasOwnProperty(matName)) {
- const text = [" *", division.reqMats[matName], matName].join(" ");
- ratioLines.push(
-
-
{text}
-
,
- );
- }
- }
-
// Current State:
let stateText;
switch (division.state) {
diff --git a/src/Corporation/ui/ThrowPartyModal.tsx b/src/Corporation/ui/ThrowPartyModal.tsx
index a29c1e6a2..32c93ac53 100644
--- a/src/Corporation/ui/ThrowPartyModal.tsx
+++ b/src/Corporation/ui/ThrowPartyModal.tsx
@@ -50,7 +50,7 @@ export function ThrowPartyModal(props: IProps): React.ReactElement {
}
function EffectText(): React.ReactElement {
- if (isNaN(cost) || cost < 0) return
Invalid value entered!
;
+ if (isNaN(cost) || cost < 0) return Invalid value entered!;
return (
Throwing this party will cost a total of
diff --git a/src/DevMenu/ui/General.tsx b/src/DevMenu/ui/General.tsx
index fd2a4d041..a7a21fd9d 100644
--- a/src/DevMenu/ui/General.tsx
+++ b/src/DevMenu/ui/General.tsx
@@ -48,40 +48,38 @@ export function General(props: IProps): React.ReactElement {
General
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
);
diff --git a/src/Faction/FactionHelpers.tsx b/src/Faction/FactionHelpers.tsx
index 4038df855..7d4440a7a 100644
--- a/src/Faction/FactionHelpers.tsx
+++ b/src/Faction/FactionHelpers.tsx
@@ -18,19 +18,13 @@ import {
import { SourceFileFlags } from "../SourceFile/SourceFileFlags";
import { dialogBoxCreate } from "../ui/React/DialogBox";
-import { createPopup } from "../ui/React/createPopup";
-import { InvitationPopup } from "./ui/InvitationPopup";
+import { InvitationEvent } from "./ui/InvitationModal";
export function inviteToFaction(faction: Faction): void {
Player.factionInvitations.push(faction.name);
faction.alreadyInvited = true;
if (!Settings.SuppressFactionInvites) {
- const popupId = "faction-invitation";
- createPopup(popupId, InvitationPopup, {
- player: Player,
- faction: faction,
- popupId: popupId,
- });
+ InvitationEvent.emit(faction);
}
}
diff --git a/src/Faction/ui/DonateOption.tsx b/src/Faction/ui/DonateOption.tsx
index db91f3463..092659845 100644
--- a/src/Faction/ui/DonateOption.tsx
+++ b/src/Faction/ui/DonateOption.tsx
@@ -57,7 +57,7 @@ export function DonateOption(props: IProps): React.ReactElement {
props.faction.playerReputation += repGain;
dialogBoxCreate(
<>
- You just donated to {fac.name} to gain {Reputation(repGain)} reputation.
+ You just donated to {fac.name} to gain reputation.
>,
);
props.rerender();
@@ -71,7 +71,7 @@ export function DonateOption(props: IProps): React.ReactElement {
}
return (
- This donation will result in {Reputation(repFromDonation(donateAmt, props.p))} reputation gain
+ This donation will result in reputation gain
);
}
@@ -81,7 +81,7 @@ export function DonateOption(props: IProps): React.ReactElement {
{props.disabled ? (
- Unlock donations at {Favor(props.favorToDonate)} favor with {props.faction.name}
+ Unlock donations at favor with {props.faction.name}
) : (
<>
diff --git a/src/Faction/ui/Info.tsx b/src/Faction/ui/Info.tsx
index 74016ec0d..71494d66e 100644
--- a/src/Faction/ui/Info.tsx
+++ b/src/Faction/ui/Info.tsx
@@ -54,7 +54,8 @@ export function Info(props: IProps): React.ReactElement {
title={
<>
- You will have {Favor(props.faction.favor + favorGain)} faction favor after installing an Augmentation.
+ You will have faction favor after installing an
+ Augmentation.
}
>
- Reputation: {Reputation(props.faction.playerReputation)}
+
+ Reputation:
+
@@ -83,7 +86,9 @@ export function Info(props: IProps): React.ReactElement {
>
}
>
- Faction Favor: {Favor(props.faction.favor)}
+
+ Faction Favor:
+
diff --git a/src/Faction/ui/InvitationModal.tsx b/src/Faction/ui/InvitationModal.tsx
new file mode 100644
index 000000000..8f784f02d
--- /dev/null
+++ b/src/Faction/ui/InvitationModal.tsx
@@ -0,0 +1,40 @@
+import React, { useState, useEffect } from "react";
+import { joinFaction } from "../FactionHelpers";
+import { Faction } from "../Faction";
+import { Modal } from "../../ui/React/Modal";
+import { use } from "../../ui/Context";
+import { EventEmitter } from "../../utils/EventEmitter";
+import Typography from "@mui/material/Typography";
+import Button from "@mui/material/Button";
+
+export const InvitationEvent = new EventEmitter<[Faction]>();
+
+export function InvitationModal(): React.ReactElement {
+ const [faction, setFaction] = useState(null);
+ const player = use.Player();
+ function join(): void {
+ if (faction === null) return;
+ //Remove from invited factions
+ const i = player.factionInvitations.findIndex((facName) => facName === faction.name);
+ if (i === -1) {
+ console.error("Could not find faction in Player.factionInvitations");
+ }
+ joinFaction(faction);
+ setFaction(null);
+ }
+
+ useEffect(() => InvitationEvent.subscribe((faction) => setFaction(faction)), []);
+
+ return (
+ setFaction(null)}>
+ You have received a faction invitation.
+
+ Would you like to join {(faction || { name: "" }).name}?
+
+ Warning: Joining this faction may prevent you from joining other factions during this run!
+
+
+
+
+ );
+}
diff --git a/src/Faction/ui/InvitationPopup.tsx b/src/Faction/ui/InvitationPopup.tsx
deleted file mode 100644
index 518b26f20..000000000
--- a/src/Faction/ui/InvitationPopup.tsx
+++ /dev/null
@@ -1,40 +0,0 @@
-import React from "react";
-import { joinFaction } from "../../Faction/FactionHelpers";
-import { Faction } from "../../Faction/Faction";
-import { IPlayer } from "../../PersonObjects/IPlayer";
-import { removePopup } from "../../ui/React/createPopup";
-
-interface IProps {
- player: IPlayer;
- faction: Faction;
- popupId: string;
-}
-
-export function InvitationPopup(props: IProps): React.ReactElement {
- function join(): void {
- //Remove from invited factions
- const i = props.player.factionInvitations.findIndex((facName) => facName === props.faction.name);
- if (i === -1) {
- console.error("Could not find faction in Player.factionInvitations");
- }
- joinFaction(props.faction);
- removePopup(props.popupId);
- }
-
- return (
- <>
-
You have received a faction invitation.
-
- Would you like to join {props.faction.name}?
-
- Warning: Joining this faction may prevent you from joining other factions during this run!
-
+ Enter the Code!
+ {code[index]}
diff --git a/src/Infiltration/ui/Countdown.tsx b/src/Infiltration/ui/Countdown.tsx
index 3f9fcfd2f..91878cd20 100644
--- a/src/Infiltration/ui/Countdown.tsx
+++ b/src/Infiltration/ui/Countdown.tsx
@@ -1,6 +1,7 @@
import React, { useState, useEffect } from "react";
import Grid from "@mui/material/Grid";
+import Typography from "@mui/material/Typography";
interface IProps {
onFinish: () => void;
}
@@ -19,8 +20,8 @@ export function Countdown(props: IProps): React.ReactElement {
<>
-
Get Ready!
-
{x}
+ Get Ready!
+ {x}
>
diff --git a/src/Infiltration/ui/Cyberpunk2077Game.tsx b/src/Infiltration/ui/Cyberpunk2077Game.tsx
index b4cdaee7d..4784bbe5b 100644
--- a/src/Infiltration/ui/Cyberpunk2077Game.tsx
+++ b/src/Infiltration/ui/Cyberpunk2077Game.tsx
@@ -5,6 +5,7 @@ import { KeyHandler } from "./KeyHandler";
import { GameTimer } from "./GameTimer";
import { interpolate } from "./Difficulty";
import { getArrow } from "../utils";
+import Typography from "@mui/material/Typography";
interface Difficulty {
[key: string]: number;
@@ -75,8 +76,8 @@ export function Cyberpunk2077Game(props: IMinigameProps): React.ReactElement {
-
Match the symbols!
-
+ Match the symbols!
+
Targets:{" "}
{answer.map((a, i) => {
if (i == index)
@@ -91,7 +92,7 @@ export function Cyberpunk2077Game(props: IMinigameProps): React.ReactElement {
);
})}
-
+
{grid.map((line, y) => (
diff --git a/src/Infiltration/ui/Game.tsx b/src/Infiltration/ui/Game.tsx
index 378d3f9e4..3a7080e74 100644
--- a/src/Infiltration/ui/Game.tsx
+++ b/src/Infiltration/ui/Game.tsx
@@ -11,6 +11,7 @@ import { Cyberpunk2077Game } from "./Cyberpunk2077Game";
import { MinesweeperGame } from "./MinesweeperGame";
import { WireCuttingGame } from "./WireCuttingGame";
import { Victory } from "./Victory";
+import Typography from "@mui/material/Typography";
interface IProps {
StartingDifficulty: number;
@@ -130,9 +131,9 @@ export function Game(props: IProps): React.ReactElement {
<>
-
+
Level: {level} / {props.MaxLevel}
-
+
diff --git a/src/Infiltration/ui/Intro.tsx b/src/Infiltration/ui/Intro.tsx
index 73ff8d6a0..cf004f65d 100644
--- a/src/Infiltration/ui/Intro.tsx
+++ b/src/Infiltration/ui/Intro.tsx
@@ -1,7 +1,8 @@
import React from "react";
-import { StdButton } from "../../ui/React/StdButton";
import { Location } from "../../Locations/Location";
import Grid from "@mui/material/Grid";
+import Typography from "@mui/material/Typography";
+import Button from "@mui/material/Button";
interface IProps {
Location: Location;
@@ -52,37 +53,45 @@ export function Intro(props: IProps): React.ReactElement {
<>
-
Infiltrating {props.Location.name}
+ Infiltrating {props.Location.name}
-
Maximum level: {props.MaxLevel}
+
+ Maximum level: {props.MaxLevel}
+
-
[{coloredArrow(props.Difficulty)}]
-
{` ^ ^ ^ ^`}
-
{` Trivial Normal Hard Impossible`}
+ [{coloredArrow(props.Difficulty)}]
+ {` ^ ^ ^ ^`}
+ {` Trivial Normal Hard Impossible`}
-
+
Infiltration is a series of short minigames that get progressively harder. You take damage for failing them.
Reaching the maximum level rewards you with intel you can trade for money or reputation.
-
+
-
The minigames you play are randomly selected. It might take you few tries to get used to them.
+
+ The minigames you play are randomly selected. It might take you few tries to get used to them.
+
-
No game require use of the mouse.
+ No game require use of the mouse.
-
Spacebar is the default action/confirm button.
+ Spacebar is the default action/confirm button.
-
Everything that uses arrow can also use WASD
+ Everything that uses arrow can also use WASD
-
Sometimes the rest of the keyboard is used.
+ Sometimes the rest of the keyboard is used.
-
+
-
+
>
diff --git a/src/Infiltration/ui/MinesweeperGame.tsx b/src/Infiltration/ui/MinesweeperGame.tsx
index 58cf19b67..d6a8cafa9 100644
--- a/src/Infiltration/ui/MinesweeperGame.tsx
+++ b/src/Infiltration/ui/MinesweeperGame.tsx
@@ -5,6 +5,7 @@ import { KeyHandler } from "./KeyHandler";
import { GameTimer } from "./GameTimer";
import { interpolate } from "./Difficulty";
import { getArrow } from "../utils";
+import Typography from "@mui/material/Typography";
interface Difficulty {
[key: string]: number;
@@ -81,7 +82,7 @@ export function MinesweeperGame(props: IMinigameProps): React.ReactElement {
-
{memoryPhase ? "Remember all the mines!" : "Mark all the mines!"}
+ {memoryPhase ? "Remember all the mines!" : "Mark all the mines!"}
{minefield.map((line, y) => (
diff --git a/src/Infiltration/ui/SlashGame.tsx b/src/Infiltration/ui/SlashGame.tsx
index 0db257ab0..75fa02565 100644
--- a/src/Infiltration/ui/SlashGame.tsx
+++ b/src/Infiltration/ui/SlashGame.tsx
@@ -4,6 +4,7 @@ import { IMinigameProps } from "./IMinigameProps";
import { KeyHandler } from "./KeyHandler";
import { GameTimer } from "./GameTimer";
import { interpolate } from "./Difficulty";
+import Typography from "@mui/material/Typography";
interface Difficulty {
[key: string]: number;
@@ -53,8 +54,8 @@ export function SlashGame(props: IMinigameProps): React.ReactElement {
-
Slash when his guard is down!
-
{guarding ? "!Guarding!" : "!ATTACKING!"}
+ Slash when his guard is down!
+ {guarding ? "!Guarding!" : "!ATTACKING!"}
diff --git a/src/Infiltration/ui/Victory.tsx b/src/Infiltration/ui/Victory.tsx
index 6ee057a57..342a82f38 100644
--- a/src/Infiltration/ui/Victory.tsx
+++ b/src/Infiltration/ui/Victory.tsx
@@ -1,11 +1,14 @@
import { Factions } from "../../Faction/Factions";
import React, { useState } from "react";
-import { StdButton } from "../../ui/React/StdButton";
import Grid from "@mui/material/Grid";
import { Money } from "../../ui/React/Money";
import { Reputation } from "../../ui/React/Reputation";
import { BitNodeMultipliers } from "../../BitNode/BitNodeMultipliers";
import { use } from "../../ui/Context";
+import Typography from "@mui/material/Typography";
+import Button from "@mui/material/Button";
+import MenuItem from "@mui/material/MenuItem";
+import Select, { SelectChangeEvent } from "@mui/material/Select";
interface IProps {
StartingDifficulty: number;
@@ -50,7 +53,7 @@ export function Victory(props: IProps): React.ReactElement {
quitInfiltration();
}
- function changeDropdown(event: React.ChangeEvent): void {
+ function changeDropdown(event: SelectChangeEvent): void {
setFaction(event.target.value);
}
@@ -58,46 +61,36 @@ export function Victory(props: IProps): React.ReactElement {
<>
-