remove some createElement

This commit is contained in:
Olivier Gagnon 2021-09-09 13:00:06 -04:00
parent 3df298e91e
commit 0a210555e9
3 changed files with 15 additions and 37 deletions

@ -137,16 +137,4 @@ export function IssueNewSharesPopup(props: IProps): React.ReactElement {
</button> </button>
</> </>
); );
// let issueBtn, newSharesInput;
// const dynamicText = createElement("p", {
// display: "block",
// });
// function updateDynamicText(corp) {
// }
// createPopup(popupId, [descText, dynamicText, newSharesInput, issueBtn, cancelBtn]);
// newSharesInput.focus();
} }

@ -15,6 +15,8 @@ interface IProps {
// Create the Research Tree UI for this Industry // Create the Research Tree UI for this Industry
export function ResearchPopup(props: IProps): React.ReactElement { export function ResearchPopup(props: IProps): React.ReactElement {
const researchTree = IndustryResearchTrees[props.industry.type];
if (researchTree === undefined) return <></>;
useEffect(() => { useEffect(() => {
{ {
const boxContent = document.getElementById(`${props.popupId}-content`); const boxContent = document.getElementById(`${props.popupId}-content`);
@ -22,8 +24,6 @@ export function ResearchPopup(props: IProps): React.ReactElement {
boxContent.style.minHeight = "80vh"; boxContent.style.minHeight = "80vh";
} }
} }
const researchTree = IndustryResearchTrees[props.industry.type];
if (researchTree === undefined) return;
// Get the tree's markup (i.e. config) for Treant // Get the tree's markup (i.e. config) for Treant
const markup = researchTree.createTreantMarkup(); const markup = researchTree.createTreantMarkup();
@ -80,33 +80,23 @@ export function ResearchPopup(props: IProps): React.ReactElement {
} }
}); });
} }
const boxContent = document.getElementById(`${props.popupId}-content`);
if (boxContent != null) {
// Add information about multipliers from research at the bottom of the popup
//appendLineBreaks(boxContent, 2);
boxContent.appendChild(
createElement("pre", {
display: "block",
innerText:
`Multipliers from research:\n` +
` * Advertising Multiplier: x${researchTree.getAdvertisingMultiplier()}\n` +
` * Employee Charisma Multiplier: x${researchTree.getEmployeeChaMultiplier()}\n` +
` * Employee Creativity Multiplier: x${researchTree.getEmployeeCreMultiplier()}\n` +
` * Employee Efficiency Multiplier: x${researchTree.getEmployeeEffMultiplier()}\n` +
` * Employee Intelligence Multiplier: x${researchTree.getEmployeeIntMultiplier()}\n` +
` * Production Multiplier: x${researchTree.getProductionMultiplier()}\n` +
` * Sales Multiplier: x${researchTree.getSalesMultiplier()}\n` +
` * Scientific Research Multiplier: x${researchTree.getScientificResearchMultiplier()}\n` +
` * Storage Multiplier: x${researchTree.getStorageMultiplier()}`,
}),
);
}
}); });
return ( return (
<div id={props.popupId}> <div id={props.popupId}>
<div id={props.popupId + "outer-box"}></div> <div id={props.popupId + "outer-box"}></div>
<div>
Multipliers from research:
<br />* Advertising Multiplier: x{researchTree.getAdvertisingMultiplier()}
<br />* Employee Charisma Multiplier: x{researchTree.getEmployeeChaMultiplier()}
<br />* Employee Creativity Multiplier: x{researchTree.getEmployeeCreMultiplier()}
<br />* Employee Efficiency Multiplier: x{researchTree.getEmployeeEffMultiplier()}
<br />* Employee Intelligence Multiplier: x{researchTree.getEmployeeIntMultiplier()}
<br />* Production Multiplier: x{researchTree.getProductionMultiplier()}
<br />* Sales Multiplier: x{researchTree.getSalesMultiplier()}
<br />* Scientific Research Multiplier: x{researchTree.getScientificResearchMultiplier()}
<br />* Storage Multiplier: x{researchTree.getStorageMultiplier()}
</div>
</div> </div>
); );
} }

@ -5,7 +5,7 @@ import { IEngine } from "../IEngine";
import * as React from "react"; import * as React from "react";
import * as ReactDOM from "react-dom"; import * as ReactDOM from "react-dom";
let container: HTMLElement = document.createElement("div"); let container: HTMLElement;
(function () { (function () {
function setContainer(): void { function setContainer(): void {