From cd320c307d09873580a05824a2ab792597a41e06 Mon Sep 17 00:00:00 2001
From: catloversg <152669316+catloversg@users.noreply.github.com>
Date: Fri, 25 Jul 2025 12:43:26 +0700
Subject: [PATCH] UI: Add tooltip for reputation/favor in page of faction's
augmentation list (#2268)
---
src/Faction/ui/AugmentationsPage.tsx | 15 +++---
src/Faction/ui/Info.tsx | 74 ++--------------------------
src/ui/React/FavorInfo.tsx | 32 ++++++++++++
src/ui/React/ReputationInfo.tsx | 41 +++++++++++++++
4 files changed, 85 insertions(+), 77 deletions(-)
create mode 100644 src/ui/React/FavorInfo.tsx
create mode 100644 src/ui/React/ReputationInfo.tsx
diff --git a/src/Faction/ui/AugmentationsPage.tsx b/src/Faction/ui/AugmentationsPage.tsx
index d8de2777b..b9201b156 100644
--- a/src/Faction/ui/AugmentationsPage.tsx
+++ b/src/Faction/ui/AugmentationsPage.tsx
@@ -10,13 +10,13 @@ import { PurchaseAugmentationsOrderSetting } from "../../Settings/SettingEnums";
import { Settings } from "../../Settings/Settings";
import { Player } from "@player";
import { formatBigNumber } from "../../ui/formatNumber";
-import { Favor } from "../../ui/React/Favor";
-import { Reputation } from "../../ui/React/Reputation";
import { Router } from "../../ui/GameRoot";
import { Faction } from "../Faction";
import { getFactionAugmentationsFiltered, hasAugmentationPrereqs, purchaseAugmentation } from "../FactionHelpers";
import { CONSTANTS } from "../../Constants";
import { useRerender } from "../../ui/React/hooks";
+import { ReputationInfo } from "../../ui/React/ReputationInfo";
+import { FavorInfo } from "../../ui/React/FavorInfo";
/** Root React Component for displaying a faction's "Purchase Augmentations" page */
export function AugmentationsPage({ faction }: { faction: Faction }): React.ReactElement {
@@ -202,12 +202,11 @@ export function AugmentationsPage({ faction }: { faction: Faction }): React.Reac
my: 1,
}}
>
- <>{multiplierComponent}>
-
- Reputation:
-
- Favor:
-
+ {multiplierComponent}
+
+
+
+
diff --git a/src/Faction/ui/Info.tsx b/src/Faction/ui/Info.tsx
index 50cea9617..8ab9220e6 100644
--- a/src/Faction/ui/Info.tsx
+++ b/src/Faction/ui/Info.tsx
@@ -7,39 +7,17 @@ import React from "react";
import { Faction } from "../Faction";
import { FactionInfo } from "../FactionInfo";
-import { Reputation } from "../../ui/React/Reputation";
-import { Favor } from "../../ui/React/Favor";
-import { MathJax } from "better-react-mathjax";
-
-import { makeStyles } from "tss-react/mui";
import Typography from "@mui/material/Typography";
-import Tooltip from "@mui/material/Tooltip";
-import Box from "@mui/material/Box";
-import InfoIcon from "@mui/icons-material/Info";
import { useCycleRerender } from "../../ui/React/hooks";
-import { addRepToFavor } from "../formulas/favor";
import { knowAboutBitverse } from "../../BitNode/BitNodeUtils";
+import { ReputationInfo } from "../../ui/React/ReputationInfo";
+import { FavorInfo } from "../../ui/React/FavorInfo";
interface IProps {
faction: Faction;
factionInfo: FactionInfo;
}
-const useStyles = makeStyles()({
- noformat: {
- whiteSpace: "pre-wrap",
- },
- repFavorRow: {
- display: "flex",
- alignItems: "center",
- whiteSpace: "pre-wrap",
- },
- infoIcon: {
- fontSize: "1.1em",
- marginLeft: "10px",
- },
-});
-
function DefaultAssignment(): React.ReactElement {
return (
@@ -55,13 +33,12 @@ function DefaultAssignment(): React.ReactElement {
export function Info(props: IProps): React.ReactElement {
useCycleRerender();
- const { classes } = useStyles();
const Assignment = props.factionInfo.assignment ?? DefaultAssignment;
return (
<>
- {props.factionInfo.infoText}
+ {props.factionInfo.infoText}
{props.factionInfo.enemies.length > 0 && (
@@ -69,50 +46,9 @@ export function Info(props: IProps): React.ReactElement {
)}
-------------------------
-
-
-
- You will have {" "}
- faction favor after installing an Augmentation.
-
- {"\\(\\huge{r = \\text{total faction reputation}}\\)"}
- {"\\(\\huge{favor=\\log_{1.02}\\left(1+\\frac{r}{25000}\\right)}\\)"}
- >
- }
- >
-
- Reputation:
-
-
-
-
-
+
-------------------------
-
-
-
-
- Faction favor increases the rate at which you earn reputation for this faction by 1% per favor. Faction
- favor is gained whenever you install an Augmentation. The amount of favor you gain depends on the total
- amount of reputation you earned with this faction across all resets.
-
-
- {"\\(\\huge{r = reputation}\\)"}
- {"\\(\\huge{\\Delta r = \\Delta r \\times \\frac{100+favor}{100}}\\)"}
- >
- }
- >
-
- Faction Favor:
-
-
-
-
-
+
-------------------------
>
diff --git a/src/ui/React/FavorInfo.tsx b/src/ui/React/FavorInfo.tsx
new file mode 100644
index 000000000..44964db4c
--- /dev/null
+++ b/src/ui/React/FavorInfo.tsx
@@ -0,0 +1,32 @@
+import React from "react";
+import { MathJax } from "better-react-mathjax";
+
+import InfoIcon from "@mui/icons-material/Info";
+import Tooltip from "@mui/material/Tooltip";
+import Typography from "@mui/material/Typography";
+
+import { Favor } from "../../ui/React/Favor";
+
+export function FavorInfo({ favor, boldLabel }: { favor: number; boldLabel?: boolean }): React.ReactElement {
+ return (
+
+
+ Faction favor increases the rate at which you earn reputation for this faction by 1% per favor. Faction
+ favor is gained whenever you install an Augmentation. The amount of favor you gain depends on the total
+ amount of reputation you earned with this faction across all resets.
+
+ {"\\(\\huge{r = reputation}\\)"}
+ {"\\(\\huge{\\Delta r = \\Delta r \\times \\frac{100+favor}{100}}\\)"}
+ >
+ }
+ >
+
+ Favor:
+
+
+
+
+ );
+}
diff --git a/src/ui/React/ReputationInfo.tsx b/src/ui/React/ReputationInfo.tsx
new file mode 100644
index 000000000..b669b9fea
--- /dev/null
+++ b/src/ui/React/ReputationInfo.tsx
@@ -0,0 +1,41 @@
+import React from "react";
+import { MathJax } from "better-react-mathjax";
+
+import InfoIcon from "@mui/icons-material/Info";
+import Tooltip from "@mui/material/Tooltip";
+import Typography from "@mui/material/Typography";
+
+import { addRepToFavor } from "../../Faction/formulas/favor";
+import { Favor } from "../../ui/React/Favor";
+import { Reputation } from "./Reputation";
+
+export function ReputationInfo({
+ favor,
+ playerReputation,
+ boldLabel,
+}: {
+ favor: number;
+ playerReputation: number;
+ boldLabel?: boolean;
+}): React.ReactElement {
+ return (
+
+
+ You will have faction favor after installing an
+ Augmentation.
+
+ {"\\(\\huge{r = \\text{total faction reputation}}\\)"}
+ {"\\(\\huge{favor=\\log_{1.02}\\left(1+\\frac{r}{25000}\\right)}\\)"}
+ >
+ }
+ >
+
+ Reputation:
+
+
+
+
+ );
+}