From 28aca06208de91dc879694ae9e9b88b1c785314e Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Wed, 22 Sep 2021 03:25:12 -0400 Subject: [PATCH] convert work in progress to mui --- src/ui/WorkInProgressRoot.tsx | 431 ++++++++++++++++++---------------- 1 file changed, 224 insertions(+), 207 deletions(-) diff --git a/src/ui/WorkInProgressRoot.tsx b/src/ui/WorkInProgressRoot.tsx index fc3c16135..b64464c23 100644 --- a/src/ui/WorkInProgressRoot.tsx +++ b/src/ui/WorkInProgressRoot.tsx @@ -13,6 +13,10 @@ import { Companies } from "../Company/Companies"; import { Locations } from "../Locations/Locations"; import { LocationName } from "../Locations/data/LocationNames"; +import Typography from "@mui/material/Typography"; +import Grid from "@mui/material/Grid"; +import Button from "@mui/material/Button"; + import { createProgressBarText } from "../../utils/helpers/createProgressBarText"; const CYCLES_PER_SEC = 1000 / CONSTANTS.MilliPerCycle; @@ -40,49 +44,50 @@ export function WorkInProgressRoot(): React.ReactElement { player.stopFocusing(); } return ( -
-

- You are currently {player.currentWorkFactionDescription} for your faction {faction.name} -
- (Current Faction Reputation: {Reputation(faction.playerReputation)}).
- You have been doing this for {convertTimeMsToTimeElapsedString(player.timeWorked)} -
-
- You have earned:
-
- (){" "} -
-
- {Reputation(player.workRepGained)} ({ReputationRate(player.workRepGainRate * CYCLES_PER_SEC)}) reputation for - this faction
-
- {numeralWrapper.formatExp(player.workHackExpGained)} ( - {numeralWrapper.formatExp(player.workHackExpGainRate * CYCLES_PER_SEC)} / sec) hacking exp
-
- {numeralWrapper.formatExp(player.workStrExpGained)} ( - {numeralWrapper.formatExp(player.workStrExpGainRate * CYCLES_PER_SEC)} / sec) strength exp
- {numeralWrapper.formatExp(player.workDefExpGained)} ( - {numeralWrapper.formatExp(player.workDefExpGainRate * CYCLES_PER_SEC)} / sec) defense exp
- {numeralWrapper.formatExp(player.workDexExpGained)} ( - {numeralWrapper.formatExp(player.workDexExpGainRate * CYCLES_PER_SEC)} / sec) dexterity exp
- {numeralWrapper.formatExp(player.workAgiExpGained)} ( - {numeralWrapper.formatExp(player.workAgiExpGainRate * CYCLES_PER_SEC)} / sec) agility exp
-
- {numeralWrapper.formatExp(player.workChaExpGained)} ( - {numeralWrapper.formatExp(player.workChaExpGainRate * CYCLES_PER_SEC)} / sec) charisma exp
-
- You will automatically finish after working for 20 hours. You can cancel earlier if you wish. -
- There is no penalty for cancelling earlier. -

- - - -
+ + + + You are currently {player.currentWorkFactionDescription} for your faction {faction.name} +
+ (Current Faction Reputation: {Reputation(faction.playerReputation)}).
+ You have been doing this for {convertTimeMsToTimeElapsedString(player.timeWorked)} +
+
+ You have earned:
+
+ (){" "} +
+
+ {Reputation(player.workRepGained)} ({ReputationRate(player.workRepGainRate * CYCLES_PER_SEC)}) reputation + for this faction
+
+ {numeralWrapper.formatExp(player.workHackExpGained)} ( + {numeralWrapper.formatExp(player.workHackExpGainRate * CYCLES_PER_SEC)} / sec) hacking exp
+
+ {numeralWrapper.formatExp(player.workStrExpGained)} ( + {numeralWrapper.formatExp(player.workStrExpGainRate * CYCLES_PER_SEC)} / sec) strength exp
+ {numeralWrapper.formatExp(player.workDefExpGained)} ( + {numeralWrapper.formatExp(player.workDefExpGainRate * CYCLES_PER_SEC)} / sec) defense exp
+ {numeralWrapper.formatExp(player.workDexExpGained)} ( + {numeralWrapper.formatExp(player.workDexExpGainRate * CYCLES_PER_SEC)} / sec) dexterity exp
+ {numeralWrapper.formatExp(player.workAgiExpGained)} ( + {numeralWrapper.formatExp(player.workAgiExpGainRate * CYCLES_PER_SEC)} / sec) agility exp
+
+ {numeralWrapper.formatExp(player.workChaExpGained)} ( + {numeralWrapper.formatExp(player.workChaExpGainRate * CYCLES_PER_SEC)} / sec) charisma exp
+
+ You will automatically finish after working for 20 hours. You can cancel earlier if you wish. +
+ There is no penalty for cancelling earlier. +
+
+ + + + +
); } @@ -110,35 +115,36 @@ export function WorkInProgressRoot(): React.ReactElement { } return ( -
-

- You have been {className} for {convertTimeMsToTimeElapsedString(player.timeWorked)} -
-
- This has cost you:
- (){" "} -
-
- You have gained:
- {numeralWrapper.formatExp(player.workHackExpGained)} ( - {numeralWrapper.formatExp(player.workHackExpGainRate * CYCLES_PER_SEC)} / sec) hacking exp
- {numeralWrapper.formatExp(player.workStrExpGained)} ( - {numeralWrapper.formatExp(player.workStrExpGainRate * CYCLES_PER_SEC)} / sec) strength exp
- {numeralWrapper.formatExp(player.workDefExpGained)} ( - {numeralWrapper.formatExp(player.workDefExpGainRate * CYCLES_PER_SEC)} / sec) defense exp
- {numeralWrapper.formatExp(player.workDexExpGained)} ( - {numeralWrapper.formatExp(player.workDexExpGainRate * CYCLES_PER_SEC)} / sec) dexterity exp
- {numeralWrapper.formatExp(player.workAgiExpGained)} ( - {numeralWrapper.formatExp(player.workAgiExpGainRate * CYCLES_PER_SEC)} / sec) agility exp
- {numeralWrapper.formatExp(player.workChaExpGained)} ( - {numeralWrapper.formatExp(player.workChaExpGainRate * CYCLES_PER_SEC)} / sec) charisma exp
- You may cancel at any time -

- - -
+ + + + You have been {className} for {convertTimeMsToTimeElapsedString(player.timeWorked)} +
+
+ This has cost you:
+ (){" "} +
+
+ You have gained:
+ {numeralWrapper.formatExp(player.workHackExpGained)} ( + {numeralWrapper.formatExp(player.workHackExpGainRate * CYCLES_PER_SEC)} / sec) hacking exp
+ {numeralWrapper.formatExp(player.workStrExpGained)} ( + {numeralWrapper.formatExp(player.workStrExpGainRate * CYCLES_PER_SEC)} / sec) strength exp
+ {numeralWrapper.formatExp(player.workDefExpGained)} ( + {numeralWrapper.formatExp(player.workDefExpGainRate * CYCLES_PER_SEC)} / sec) defense exp
+ {numeralWrapper.formatExp(player.workDexExpGained)} ( + {numeralWrapper.formatExp(player.workDexExpGainRate * CYCLES_PER_SEC)} / sec) dexterity exp
+ {numeralWrapper.formatExp(player.workAgiExpGained)} ( + {numeralWrapper.formatExp(player.workAgiExpGainRate * CYCLES_PER_SEC)} / sec) agility exp
+ {numeralWrapper.formatExp(player.workChaExpGained)} ( + {numeralWrapper.formatExp(player.workChaExpGainRate * CYCLES_PER_SEC)} / sec) charisma exp
+ You may cancel at any time +
+
+ + + +
); } @@ -165,54 +171,55 @@ export function WorkInProgressRoot(): React.ReactElement { const penaltyString = penalty === 0.5 ? "half" : "three-quarters"; return ( -
-

- You are currently working as a {position} at {player.companyName} (Current Company Reputation:{" "} - {Reputation(companyRep)})
-
- You have been working for {convertTimeMsToTimeElapsedString(player.timeWorked)} -
-
- You have earned:
-
- (){" "} -
-
- {Reputation(player.workRepGained)} ({ReputationRate(player.workRepGainRate * CYCLES_PER_SEC)}) reputation for - this company
-
- {numeralWrapper.formatExp(player.workHackExpGained)} ( - {`${numeralWrapper.formatExp(player.workHackExpGainRate * CYCLES_PER_SEC)} / sec`} - ) hacking exp
-
- {numeralWrapper.formatExp(player.workStrExpGained)} ( - {`${numeralWrapper.formatExp(player.workStrExpGainRate * CYCLES_PER_SEC)} / sec`} - ) strength exp
- {numeralWrapper.formatExp(player.workDefExpGained)} ( - {`${numeralWrapper.formatExp(player.workDefExpGainRate * CYCLES_PER_SEC)} / sec`} - ) defense exp
- {numeralWrapper.formatExp(player.workDexExpGained)} ( - {`${numeralWrapper.formatExp(player.workDexExpGainRate * CYCLES_PER_SEC)} / sec`} - ) dexterity exp
- {numeralWrapper.formatExp(player.workAgiExpGained)} ( - {`${numeralWrapper.formatExp(player.workAgiExpGainRate * CYCLES_PER_SEC)} / sec`} - ) agility exp
-
- {numeralWrapper.formatExp(player.workChaExpGained)} ( - {`${numeralWrapper.formatExp(player.workChaExpGainRate * CYCLES_PER_SEC)} / sec`} - ) charisma exp
-
- You will automatically finish after working for 8 hours. You can cancel earlier if you wish, but you will only - gain {penaltyString} of the reputation you've earned so far. -

- - - -
+ + + + You are currently working as a {position} at {player.companyName} (Current Company Reputation:{" "} + {Reputation(companyRep)})
+
+ You have been working for {convertTimeMsToTimeElapsedString(player.timeWorked)} +
+
+ You have earned:
+
+ (){" "} +
+
+ {Reputation(player.workRepGained)} ({ReputationRate(player.workRepGainRate * CYCLES_PER_SEC)}) reputation + for this company
+
+ {numeralWrapper.formatExp(player.workHackExpGained)} ( + {`${numeralWrapper.formatExp(player.workHackExpGainRate * CYCLES_PER_SEC)} / sec`} + ) hacking exp
+
+ {numeralWrapper.formatExp(player.workStrExpGained)} ( + {`${numeralWrapper.formatExp(player.workStrExpGainRate * CYCLES_PER_SEC)} / sec`} + ) strength exp
+ {numeralWrapper.formatExp(player.workDefExpGained)} ( + {`${numeralWrapper.formatExp(player.workDefExpGainRate * CYCLES_PER_SEC)} / sec`} + ) defense exp
+ {numeralWrapper.formatExp(player.workDexExpGained)} ( + {`${numeralWrapper.formatExp(player.workDexExpGainRate * CYCLES_PER_SEC)} / sec`} + ) dexterity exp
+ {numeralWrapper.formatExp(player.workAgiExpGained)} ( + {`${numeralWrapper.formatExp(player.workAgiExpGainRate * CYCLES_PER_SEC)} / sec`} + ) agility exp
+
+ {numeralWrapper.formatExp(player.workChaExpGained)} ( + {`${numeralWrapper.formatExp(player.workChaExpGainRate * CYCLES_PER_SEC)} / sec`} + ) charisma exp
+
+ You will automatically finish after working for 8 hours. You can cancel earlier if you wish, but you will + only gain {penaltyString} of the reputation you've earned so far. +
+
+ + + + +
); } @@ -234,55 +241,56 @@ export function WorkInProgressRoot(): React.ReactElement { const position = player.jobs[player.companyName]; return ( -
-

- You are currently working as a {position} at {player.companyName} (Current Company Reputation:{" "} - {Reputation(companyRep)})
-
- You have been working for {convertTimeMsToTimeElapsedString(player.timeWorked)} -
-
- You have earned:
-
- (){" "} -
-
- {Reputation(player.workRepGained)} ( - {Reputation(`${numeralWrapper.formatExp(player.workRepGainRate * CYCLES_PER_SEC)} / sec`)} - ) reputation for this company
-
- {numeralWrapper.formatExp(player.workHackExpGained)} ( - {`${numeralWrapper.formatExp(player.workHackExpGainRate * CYCLES_PER_SEC)} / sec`} - ) hacking exp
-
- {numeralWrapper.formatExp(player.workStrExpGained)} ( - {`${numeralWrapper.formatExp(player.workStrExpGainRate * CYCLES_PER_SEC)} / sec`} - ) strength exp
- {numeralWrapper.formatExp(player.workDefExpGained)} ( - {`${numeralWrapper.formatExp(player.workDefExpGainRate * CYCLES_PER_SEC)} / sec`} - ) defense exp
- {numeralWrapper.formatExp(player.workDexExpGained)} ( - {`${numeralWrapper.formatExp(player.workDexExpGainRate * CYCLES_PER_SEC)} / sec`} - ) dexterity exp
- {numeralWrapper.formatExp(player.workAgiExpGained)} ( - {`${numeralWrapper.formatExp(player.workAgiExpGainRate * CYCLES_PER_SEC)} / sec`} - ) agility exp
-
- {numeralWrapper.formatExp(player.workChaExpGained)} ( - {`${numeralWrapper.formatExp(player.workChaExpGainRate * CYCLES_PER_SEC)} / sec`} - ) charisma exp
-
- You will automatically finish after working for 8 hours. You can cancel earlier if you wish, and there will be - no penalty because this is a part-time job. -

- - - -
+ + + + You are currently working as a {position} at {player.companyName} (Current Company Reputation:{" "} + {Reputation(companyRep)})
+
+ You have been working for {convertTimeMsToTimeElapsedString(player.timeWorked)} +
+
+ You have earned:
+
+ (){" "} +
+
+ {Reputation(player.workRepGained)} ( + {Reputation(`${numeralWrapper.formatExp(player.workRepGainRate * CYCLES_PER_SEC)} / sec`)} + ) reputation for this company
+
+ {numeralWrapper.formatExp(player.workHackExpGained)} ( + {`${numeralWrapper.formatExp(player.workHackExpGainRate * CYCLES_PER_SEC)} / sec`} + ) hacking exp
+
+ {numeralWrapper.formatExp(player.workStrExpGained)} ( + {`${numeralWrapper.formatExp(player.workStrExpGainRate * CYCLES_PER_SEC)} / sec`} + ) strength exp
+ {numeralWrapper.formatExp(player.workDefExpGained)} ( + {`${numeralWrapper.formatExp(player.workDefExpGainRate * CYCLES_PER_SEC)} / sec`} + ) defense exp
+ {numeralWrapper.formatExp(player.workDexExpGained)} ( + {`${numeralWrapper.formatExp(player.workDexExpGainRate * CYCLES_PER_SEC)} / sec`} + ) dexterity exp
+ {numeralWrapper.formatExp(player.workAgiExpGained)} ( + {`${numeralWrapper.formatExp(player.workAgiExpGainRate * CYCLES_PER_SEC)} / sec`} + ) agility exp
+
+ {numeralWrapper.formatExp(player.workChaExpGained)} ( + {`${numeralWrapper.formatExp(player.workChaExpGainRate * CYCLES_PER_SEC)} / sec`} + ) charisma exp
+
+ You will automatically finish after working for 8 hours. You can cancel earlier if you wish, and there will + be no penalty because this is a part-time job. +
+
+ + + + +
); } @@ -299,51 +307,60 @@ export function WorkInProgressRoot(): React.ReactElement { const progressBar = createProgressBarText({ progress: (numBars + 1) / 20, totalTicks: 20 }); return ( -
-

You are attempting to {player.crimeType}.

-
+ + + +

You are attempting to {player.crimeType}.

+
-

Time remaining: {convertTimeMsToTimeElapsedString(player.timeNeededToCompleteWork - player.timeWorked)}

+

+ Time remaining: {convertTimeMsToTimeElapsedString(player.timeNeededToCompleteWork - player.timeWorked)} +

-
-
{progressBar}
- - -
+
+
{progressBar}
+ + + + + + ); } if (player.createProgramName !== "") { return ( -
-

- You are currently working on coding {player.createProgramName}.
-
- You have been working for {convertTimeMsToTimeElapsedString(player.timeWorked)} -
-
- The program is {((player.timeWorkedCreateProgram / player.timeNeededToCompleteWork) * 100).toFixed(2)} - % complete.
- If you cancel, your work will be saved and you can come back to complete the program later. -

- -
+ + + + You are currently working on coding {player.createProgramName}.
+
+ You have been working for {convertTimeMsToTimeElapsedString(player.timeWorked)} +
+
+ The program is {((player.timeWorkedCreateProgram / player.timeNeededToCompleteWork) * 100).toFixed(2)} + % complete.
+ If you cancel, your work will be saved and you can come back to complete the program later. +
+
+ + + +
); }