Fix cashroot not displaying properly

This commit is contained in:
Olivier Gagnon 2021-05-02 00:07:04 -04:00
parent d126b6d8c5
commit 56ce83cce5
4 changed files with 30 additions and 6 deletions

@ -9,7 +9,7 @@ import { Factions } from "../Faction/Factions";
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../../utils/JSONReviver";
interface IConstructorParams {
info: string;
info: string | JSX.Element;
isSpecial?: boolean;
moneyCost: number;
name: string;
@ -57,7 +57,7 @@ export class Augmentation {
baseRepRequirement = 0;
// Description of what this Aug is and what it does
info = "";
info: string | JSX.Element;
// Any Augmentation not immediately available in BitNode-1 is special (e.g. Bladeburner augs)
isSpecial = false;

@ -368,5 +368,10 @@ function updateAugDescription(elems: IResleeveUIElems): void {
return;
}
elems.augDescription.innerHTML = aug.info;
let innerHTML = aug.info;
if(typeof innerHTML !== 'string') {
innerHTML = renderToStaticMarkup(innerHTML);
}
elems.augDescription.innerHTML = innerHTML;
}

@ -55,10 +55,15 @@ export function createSleevePurchaseAugsPopup(sleeve: Sleeve, p: IPlayer): void
continue;
}
let tooltip = aug.info;
if(typeof tooltip !== 'string') {
tooltip = renderToStaticMarkup(tooltip);
}
ownedAugsDiv.appendChild(createElement("div", {
class: "gang-owned-upgrade", // Reusing a class from the Gang UI
innerText: ownedAug,
tooltip: aug.info,
tooltip: tooltip,
}))
}
popupElems.push(ownedAugsDiv);
@ -83,13 +88,18 @@ export function createSleevePurchaseAugsPopup(sleeve: Sleeve, p: IPlayer): void
class: "cmpy-mgmt-upgrade-div", // We'll reuse this CSS class
});
let info = aug.info;
if(typeof info !== 'string') {
info = renderToStaticMarkup(info);
}
div.appendChild(createElement("p", {
fontSize: "12px",
innerHTML:
[
`<h2>${aug.name}</h2><br>`,
`Cost: ${renderToStaticMarkup(Money(aug.startingCost))}<br><br>`,
`${aug.info}`,
`${info}`,
].join(" "),
padding: "2px",
clickListener: () => {

@ -24,10 +24,19 @@ export function AugmentationAccordion(props: IProps): React.ReactElement {
}
}
if(typeof props.aug.info === 'string') {
return (
<Accordion
headerContent={<>{displayName}</>}
panelContent={<p dangerouslySetInnerHTML={{__html: props.aug.info}}></p>}
/>
)
}
return (
<Accordion
headerContent={<>{displayName}</>}
panelContent={<p dangerouslySetInnerHTML={{__html: props.aug.info}}></p>}
panelContent={<p>{props.aug.info}</p>}
/>
)
}