mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-22 17:23:00 +02:00
TYPESAFETY: FactionName (#644)
This commit is contained in:
@@ -11,7 +11,7 @@ import { FactionName } from "@enums";
|
||||
interface IProps {
|
||||
open: boolean;
|
||||
onClose: () => void;
|
||||
facName: string;
|
||||
facName: FactionName;
|
||||
}
|
||||
|
||||
/** React Component for the popup used to create a new gang. */
|
||||
@@ -27,7 +27,7 @@ export function CreateGangModal(props: IProps): React.ReactElement {
|
||||
"is not as important.";
|
||||
|
||||
function isHacking(): boolean {
|
||||
return [FactionName.NiteSec as string, FactionName.TheBlackHand as string].includes(props.facName);
|
||||
return [FactionName.NiteSec, FactionName.TheBlackHand].includes(props.facName);
|
||||
}
|
||||
|
||||
function createGang(): void {
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import type { Faction } from "../Faction";
|
||||
|
||||
import React, { useEffect } from "react";
|
||||
import { Explore, Info, LastPage, LocalPolice, NewReleases, Report, SportsMma } from "@mui/icons-material";
|
||||
import { Box, Button, Container, Paper, Tooltip, Typography, useTheme } from "@mui/material";
|
||||
import React, { useEffect } from "react";
|
||||
import { Player } from "@player";
|
||||
import { Settings } from "../../Settings/Settings";
|
||||
import { formatFavor, formatReputation } from "../../ui/formatNumber";
|
||||
import { Router } from "../../ui/GameRoot";
|
||||
import { FactionName } from "@enums";
|
||||
import { Faction } from "../Faction";
|
||||
import { getFactionAugmentationsFiltered, joinFaction } from "../FactionHelpers";
|
||||
import { Factions } from "../Factions";
|
||||
import { useRerender } from "../../ui/React/hooks";
|
||||
@@ -59,7 +60,7 @@ const FactionElement = (props: FactionElementProps): React.ReactElement => {
|
||||
Router.toFaction(faction, true);
|
||||
}
|
||||
|
||||
function acceptInvitation(event: React.MouseEvent<HTMLButtonElement>, faction: string): void {
|
||||
function acceptInvitation(event: React.MouseEvent<HTMLButtonElement>, faction: FactionName): void {
|
||||
if (!event.isTrusted) return;
|
||||
joinFaction(Factions[faction]);
|
||||
props.rerender();
|
||||
|
||||
Reference in New Issue
Block a user