TYPESAFETY: FactionName (#644)

This commit is contained in:
Snarling
2023-06-25 22:53:35 -04:00
committed by GitHub
parent 1de676972f
commit 9a0a843ffc
31 changed files with 295 additions and 751 deletions
+2 -2
View File
@@ -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 {
+4 -3
View File
@@ -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();