From e05617d9d3104de63f34c1c41a0a25b8e466f53b Mon Sep 17 00:00:00 2001 From: borisflagell Date: Wed, 20 Apr 2022 23:03:25 +0200 Subject: [PATCH] UI FIX #3415 fixes #3415 --- src/Faction/ui/FactionRoot.tsx | 32 +++++++++++++++---- src/PersonObjects/IPlayer.ts | 1 + src/PersonObjects/Player/PlayerObject.ts | 2 ++ .../Player/PlayerObjectGangMethods.ts | 7 ++++ 4 files changed, 35 insertions(+), 7 deletions(-) diff --git a/src/Faction/ui/FactionRoot.tsx b/src/Faction/ui/FactionRoot.tsx index 151d58687..836a9ae51 100644 --- a/src/Faction/ui/FactionRoot.tsx +++ b/src/Faction/ui/FactionRoot.tsx @@ -18,8 +18,7 @@ import { Faction } from "../Faction"; import { use } from "../../ui/Context"; import { CreateGangModal } from "./CreateGangModal"; -import Typography from "@mui/material/Typography"; -import Button from "@mui/material/Button"; +import { Box, Paper, Typography, Button, Tooltip } from "@mui/material"; import { CovenantPurchasesRoot } from "../../PersonObjects/Sleeve/ui/CovenantPurchasesRoot"; import { FactionNames } from "../data/FactionNames"; import { GangConstants } from "../../Gang/data/Constants"; @@ -105,12 +104,17 @@ function MainPage({ faction, rerender, onAugmentations }: IMainProps): React.Rea const canPurchaseSleeves = faction.name === FactionNames.TheCovenant && player.bitNodeN === 10; - let canAccessGang = player.canAccessGang() && GangConstants.Names.includes(faction.name); + // Note : For future-proofing sake, an assumption is made that player is intended to retain access to his gang if his karma were to somehow increases. + let isManageGangVisible = GangConstants.Names.includes(faction.name) && player.isAwareOfGang(); + // karma threshold is only checked at that point, via canAccessGang(). No further check is made. + let isManageGangClickable = player.canAccessGang(); if (player.inGang()) { if (player.getGangName() !== faction.name) { - canAccessGang = false; + isManageGangVisible = false; } else if (player.getGangName() === faction.name) { - canAccessGang = true; + isManageGangVisible = true; + // The following line will enable the button, without checking for karma threshold. + isManageGangClickable = true; } } @@ -121,9 +125,23 @@ function MainPage({ faction, rerender, onAugmentations }: IMainProps): React.Rea {faction.name} - {canAccessGang && ( + {isManageGangVisible && ( <> -