Rename enum

This commit is contained in:
nickofolas 2022-04-17 15:09:47 -05:00
parent f222dc5277
commit 4073050333
4 changed files with 18 additions and 18 deletions

@ -1,4 +1,4 @@
export enum GameOptionsTabs { export enum GameOptionsTab {
SYSTEM, SYSTEM,
INTERFACE, INTERFACE,
GAMEPLAY, GAMEPLAY,

@ -4,12 +4,12 @@ import { IPlayer } from "../../PersonObjects/IPlayer";
import { Settings } from "../../Settings/Settings"; import { Settings } from "../../Settings/Settings";
import { OptionSwitch } from "../../ui/React/OptionSwitch"; import { OptionSwitch } from "../../ui/React/OptionSwitch";
import { formatTime } from "../../utils/helpers/formatTime"; import { formatTime } from "../../utils/helpers/formatTime";
import { GameOptionsTabs } from "../GameOptionsTabs"; import { GameOptionsTab } from "../GameOptionsTab";
import { GameOptionsPage } from "./GameOptionsPage"; import { GameOptionsPage } from "./GameOptionsPage";
import { OptionsSlider } from "./OptionsSlider"; import { OptionsSlider } from "./OptionsSlider";
interface IProps { interface IProps {
currentTab: GameOptionsTabs; currentTab: GameOptionsTab;
player: IPlayer; player: IPlayer;
} }
@ -64,7 +64,7 @@ export const CurrentOptionsPage = (props: IProps): React.ReactElement => {
} }
const pages = { const pages = {
[GameOptionsTabs.SYSTEM]: ( [GameOptionsTab.SYSTEM]: (
<GameOptionsPage title="System" noList> <GameOptionsPage title="System" noList>
<OptionsSlider <OptionsSlider
label=".script exec time (ms)" label=".script exec time (ms)"
@ -149,7 +149,7 @@ export const CurrentOptionsPage = (props: IProps): React.ReactElement => {
/> />
</GameOptionsPage> </GameOptionsPage>
), ),
[GameOptionsTabs.INTERFACE]: ( [GameOptionsTab.INTERFACE]: (
<GameOptionsPage title="Interface"> <GameOptionsPage title="Interface">
<OptionSwitch <OptionSwitch
checked={Settings.DisableASCIIArt} checked={Settings.DisableASCIIArt}
@ -232,7 +232,7 @@ export const CurrentOptionsPage = (props: IProps): React.ReactElement => {
</> </>
</GameOptionsPage> </GameOptionsPage>
), ),
[GameOptionsTabs.GAMEPLAY]: ( [GameOptionsTab.GAMEPLAY]: (
<GameOptionsPage title="Gameplay"> <GameOptionsPage title="Gameplay">
<OptionSwitch <OptionSwitch
checked={Settings.SuppressMessages} checked={Settings.SuppressMessages}
@ -312,7 +312,7 @@ export const CurrentOptionsPage = (props: IProps): React.ReactElement => {
)} )}
</GameOptionsPage> </GameOptionsPage>
), ),
[GameOptionsTabs.MISC]: ( [GameOptionsTab.MISC]: (
<GameOptionsPage title="Misc"> <GameOptionsPage title="Misc">
<OptionSwitch <OptionSwitch
checked={Settings.DisableHotkeys} checked={Settings.DisableHotkeys}

@ -2,7 +2,7 @@ import { Box, Container, Typography } from "@mui/material";
import React, { useState } from "react"; import React, { useState } from "react";
import { IPlayer } from "../../PersonObjects/IPlayer"; import { IPlayer } from "../../PersonObjects/IPlayer";
import { IRouter } from "../../ui/Router"; import { IRouter } from "../../ui/Router";
import { GameOptionsTabs } from "../GameOptionsTabs"; import { GameOptionsTab } from "../GameOptionsTab";
import { CurrentOptionsPage } from "./CurrentOptionsPage"; import { CurrentOptionsPage } from "./CurrentOptionsPage";
import { GameOptionsSidebar } from "./GameOptionsSidebar"; import { GameOptionsSidebar } from "./GameOptionsSidebar";
@ -16,7 +16,7 @@ interface IProps {
} }
export function GameOptionsRoot(props: IProps): React.ReactElement { export function GameOptionsRoot(props: IProps): React.ReactElement {
const [currentTab, setCurrentTab] = useState(GameOptionsTabs.SYSTEM); const [currentTab, setCurrentTab] = useState(GameOptionsTab.SYSTEM);
return ( return (
<Container disableGutters maxWidth="lg" sx={{ mx: 0 }}> <Container disableGutters maxWidth="lg" sx={{ mx: 0 }}>
@ -24,7 +24,7 @@ export function GameOptionsRoot(props: IProps): React.ReactElement {
<Box sx={{ display: "grid", gridTemplateColumns: "1fr 3fr", gap: 1 }}> <Box sx={{ display: "grid", gridTemplateColumns: "1fr 3fr", gap: 1 }}>
<GameOptionsSidebar <GameOptionsSidebar
tab={currentTab} tab={currentTab}
setTab={(tab: GameOptionsTabs) => setCurrentTab(tab)} setTab={(tab: GameOptionsTab) => setCurrentTab(tab)}
player={props.player} player={props.player}
router={props.router} router={props.router}
save={props.save} save={props.save}

@ -25,11 +25,11 @@ import { SnackbarEvents, ToastVariant } from "../../ui/React/Snackbar";
import { SoftResetButton } from "../../ui/React/SoftResetButton"; import { SoftResetButton } from "../../ui/React/SoftResetButton";
import { IRouter } from "../../ui/Router"; import { IRouter } from "../../ui/Router";
import { convertTimeMsToTimeElapsedString } from "../../utils/StringHelperFunctions"; import { convertTimeMsToTimeElapsedString } from "../../utils/StringHelperFunctions";
import { GameOptionsTabs } from "../GameOptionsTabs"; import { GameOptionsTab } from "../GameOptionsTab";
interface IProps { interface IProps {
tab: GameOptionsTabs; tab: GameOptionsTab;
setTab: (tab: GameOptionsTabs) => void; setTab: (tab: GameOptionsTab) => void;
player: IPlayer; player: IPlayer;
router: IRouter; router: IRouter;
save: () => void; save: () => void;
@ -40,7 +40,7 @@ interface IProps {
interface ITabProps { interface ITabProps {
sideBarProps: IProps; sideBarProps: IProps;
tab: GameOptionsTabs; tab: GameOptionsTab;
tabName: string; tabName: string;
} }
@ -104,10 +104,10 @@ export const GameOptionsSidebar = (props: IProps): React.ReactElement => {
<Box> <Box>
<Paper sx={{ height: "fit-content", mb: 1 }}> <Paper sx={{ height: "fit-content", mb: 1 }}>
<List> <List>
<SideBarTab sideBarProps={props} tab={GameOptionsTabs.SYSTEM} tabName="System" /> <SideBarTab sideBarProps={props} tab={GameOptionsTab.SYSTEM} tabName="System" />
<SideBarTab sideBarProps={props} tab={GameOptionsTabs.GAMEPLAY} tabName="Gameplay" /> <SideBarTab sideBarProps={props} tab={GameOptionsTab.GAMEPLAY} tabName="Gameplay" />
<SideBarTab sideBarProps={props} tab={GameOptionsTabs.INTERFACE} tabName="Interface" /> <SideBarTab sideBarProps={props} tab={GameOptionsTab.INTERFACE} tabName="Interface" />
<SideBarTab sideBarProps={props} tab={GameOptionsTabs.MISC} tabName="Misc" /> <SideBarTab sideBarProps={props} tab={GameOptionsTab.MISC} tabName="Misc" />
</List> </List>
</Paper> </Paper>
<Box <Box