From ef17f0d617a8eafb6b497a28979d26b4cb835bf1 Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Sat, 25 Sep 2021 13:31:42 -0400 Subject: [PATCH] ui --- index.html | 36 +++++++++++++--------- src/Augmentation/ui/AugmentationsRoot.tsx | 11 +++++-- src/Faction/ui/FactionsRoot.tsx | 2 +- src/Faction/ui/Info.tsx | 2 +- src/Hacknet/ui/HacknetRoot.tsx | 2 +- src/Programs/ui/ProgramsRoot.tsx | 4 +-- src/index.html | 1 + src/ui/ActiveScripts/ActiveScriptsRoot.tsx | 2 +- src/ui/CharacterStats.tsx | 2 +- 9 files changed, 38 insertions(+), 24 deletions(-) diff --git a/index.html b/index.html index 019f7d0c1..20ba0e31e 100644 --- a/index.html +++ b/index.html @@ -1,18 +1,18 @@ - + Bitburner - - - - - - - - - - + + + + + + + + + + - + - - + + + + +
@@ -47,8 +50,11 @@
+ - + + + diff --git a/src/Augmentation/ui/AugmentationsRoot.tsx b/src/Augmentation/ui/AugmentationsRoot.tsx index 656e5a5b0..bb6365c3a 100644 --- a/src/Augmentation/ui/AugmentationsRoot.tsx +++ b/src/Augmentation/ui/AugmentationsRoot.tsx @@ -2,7 +2,7 @@ * Root React component for the Augmentations UI page that display all of your * owned and purchased Augmentations and Source-Files. */ -import React, { useState } from "react"; +import React, { useState, useEffect } from "react"; import { InstalledAugmentations } from "./InstalledAugmentations"; import { PlayerMultipliers } from "./PlayerMultipliers"; @@ -23,10 +23,17 @@ interface IProps { export function AugmentationsRoot(props: IProps): React.ReactElement { const setRerender = useState(false)[1]; + function rerender(): void { + setRerender((o) => !o); + } + useEffect(() => { + const id = setInterval(rerender, 200); + return () => clearInterval(id); + }, []); function doExport(): void { props.exportGameFn(); - setRerender((o) => !o); + rerender(); } function exportBonusStr(): string { diff --git a/src/Faction/ui/FactionsRoot.tsx b/src/Faction/ui/FactionsRoot.tsx index f668b47d7..312352c88 100644 --- a/src/Faction/ui/FactionsRoot.tsx +++ b/src/Faction/ui/FactionsRoot.tsx @@ -24,7 +24,7 @@ export function FactionsRoot(props: IProps): React.ReactElement { setRerender((old) => !old); } useEffect(() => { - const id = setInterval(rerender, 1000); + const id = setInterval(rerender, 200); return () => clearInterval(id); }, []); function openFaction(faction: Faction): void { diff --git a/src/Faction/ui/Info.tsx b/src/Faction/ui/Info.tsx index 7430241c6..74016ec0d 100644 --- a/src/Faction/ui/Info.tsx +++ b/src/Faction/ui/Info.tsx @@ -38,7 +38,7 @@ export function Info(props: IProps): React.ReactElement { } useEffect(() => { - const id = setInterval(rerender, 1000); + const id = setInterval(rerender, 200); return () => clearInterval(id); }, []); diff --git a/src/Hacknet/ui/HacknetRoot.tsx b/src/Hacknet/ui/HacknetRoot.tsx index 7491f75f9..e2ef7ec90 100644 --- a/src/Hacknet/ui/HacknetRoot.tsx +++ b/src/Hacknet/ui/HacknetRoot.tsx @@ -42,7 +42,7 @@ export function HacknetRoot(props: IProps): React.ReactElement { const [purchaseMultiplier, setPurchaseMultiplier] = useState(PurchaseMultipliers.x1); useEffect(() => { - const id = setInterval(rerender, 1000); + const id = setInterval(rerender, 200); return () => clearInterval(id); }, []); diff --git a/src/Programs/ui/ProgramsRoot.tsx b/src/Programs/ui/ProgramsRoot.tsx index d2a2bfea3..6104d1593 100644 --- a/src/Programs/ui/ProgramsRoot.tsx +++ b/src/Programs/ui/ProgramsRoot.tsx @@ -14,7 +14,7 @@ export function ProgramsRoot(): React.ReactElement { } useEffect(() => { - const id = setInterval(rerender, 1000); + const id = setInterval(rerender, 200); return () => clearInterval(id); }, []); @@ -33,7 +33,7 @@ export function ProgramsRoot(): React.ReactElement { return ( - +