CODEBASE: Generate display data for math notation at built time and remove runtime mathjax dependency (#2447)

This commit is contained in:
catloversg
2026-01-18 05:41:24 +07:00
committed by GitHub
parent be16b2a375
commit c8e3eb2050
25 changed files with 910 additions and 584 deletions
+3 -2
View File
@@ -6,7 +6,8 @@ import Typography from "@mui/material/Typography";
import { Player } from "@player";
import { Money } from "../../ui/React/Money";
import { MathJax } from "better-react-mathjax";
import MathNotation from "../../Documentation/data/MathNotation.json";
import { MathNotationOutput } from "../../Documentation/ui/MathNotationOutput";
interface IProps {
rerender: () => void;
@@ -32,7 +33,7 @@ export function CoresButton(props: IProps): React.ReactElement {
}
return (
<Tooltip title={<MathJax>{`\\(\\large{cost = 10^9 \\cdot 7.5 ^{\\text{cores}}}\\)`}</MathJax>}>
<Tooltip title={<MathNotationOutput notation={MathNotation.CoreCost} />}>
<span>
<br />
<Typography>
+6 -4
View File
@@ -9,9 +9,10 @@ import { purchaseRamForHomeComputer } from "../../Server/ServerPurchases";
import { Money } from "../../ui/React/Money";
import { formatRam } from "../../ui/formatNumber";
import { MathJax } from "better-react-mathjax";
import { currentNodeMults } from "../../BitNode/BitNodeMultipliers";
import { ServerConstants } from "../../Server/data/Constants";
import MathNotation from "../../Documentation/data/MathNotation.json";
import { MathNotationOutput } from "../../Documentation/ui/MathNotationOutput";
interface IProps {
rerender: () => void;
@@ -30,12 +31,13 @@ export function RamButton(props: IProps): React.ReactElement {
props.rerender();
}
const bnMult = currentNodeMults.HomeComputerRamCost === 1 ? "" : `\\cdot ${currentNodeMults.HomeComputerRamCost}`;
return (
<Tooltip
title={
<MathJax>{`\\(\\large{cost = ram \\cdot 3.2 \\cdot 10^4 \\cdot 1.58^{log_2{(ram)}}} ${bnMult}\\)`}</MathJax>
<>
<Typography>HomeRamCostMult = {currentNodeMults.HomeComputerRamCost}</Typography>
<MathNotationOutput notation={MathNotation.HomeRAMCost} />
</>
}
>
<span>