Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MISC: Add key binding feature #1830

Open
wants to merge 9 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Bladeburner/ui/Console.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Bladeburner } from "../Bladeburner";

import React, { useState, useRef, useEffect } from "react";
import { KEY } from "../../utils/helpers/keyCodes";
import { KEY } from "../../utils/KeyboardEventKey";

import { Box, List, ListItem, Paper, TextField, Typography } from "@mui/material";
import { Theme } from "@mui/material/styles";
Expand Down
2 changes: 1 addition & 1 deletion src/Corporation/ui/NewDivisionTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { useCorporation } from "./Context";
import { createDivision } from "../Actions";

import { ButtonWithTooltip } from "../../ui/Components/ButtonWithTooltip";
import { KEY } from "../../utils/helpers/keyCodes";
import { KEY } from "../../utils/KeyboardEventKey";
import { IndustryDescription } from "./IndustryDescription";
interface IProps {
setDivisionName: (name: string) => void;
Expand Down
2 changes: 1 addition & 1 deletion src/Corporation/ui/modals/BuybackSharesModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Typography from "@mui/material/Typography";
import { ButtonWithTooltip } from "../../../ui/Components/ButtonWithTooltip";
import { NumberInput } from "../../../ui/React/NumberInput";
import { buyBackShares } from "../../Actions";
import { KEY } from "../../../utils/helpers/keyCodes";
import { KEY } from "../../../utils/KeyboardEventKey";
import { buybackSharesFailureReason } from "../../helpers";

interface IProps {
Expand Down
2 changes: 1 addition & 1 deletion src/Corporation/ui/modals/GoPublicModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Typography from "@mui/material/Typography";
import { ButtonWithTooltip } from "../../../ui/Components/ButtonWithTooltip";
import { NumberInput } from "../../../ui/React/NumberInput";
import Box from "@mui/material/Box";
import { KEY } from "../../../utils/helpers/keyCodes";
import { KEY } from "../../../utils/KeyboardEventKey";
import { isPositiveInteger } from "../../../types";
import * as actions from "../../Actions";

Expand Down
2 changes: 1 addition & 1 deletion src/Corporation/ui/modals/IssueDividendsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useCorporation } from "../Context";
import Typography from "@mui/material/Typography";
import TextField from "@mui/material/TextField";
import Button from "@mui/material/Button";
import { KEY } from "../../../utils/helpers/keyCodes";
import { KEY } from "../../../utils/KeyboardEventKey";
interface IProps {
open: boolean;
onClose: () => void;
Expand Down
2 changes: 1 addition & 1 deletion src/Corporation/ui/modals/IssueNewSharesModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useCorporation } from "../Context";
import Typography from "@mui/material/Typography";
import { NumberInput } from "../../../ui/React/NumberInput";
import { ButtonWithTooltip } from "../../../ui/Components/ButtonWithTooltip";
import { KEY } from "../../../utils/helpers/keyCodes";
import { KEY } from "../../../utils/KeyboardEventKey";
import * as actions from "../../Actions";
import * as corpConstants from "../../data/Constants";
import { issueNewSharesFailureReason } from "../../helpers";
Expand Down
2 changes: 1 addition & 1 deletion src/Corporation/ui/modals/LimitMaterialProductionModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Modal } from "../../../ui/React/Modal";
import Typography from "@mui/material/Typography";
import Button from "@mui/material/Button";
import TextField from "@mui/material/TextField";
import { KEY } from "../../../utils/helpers/keyCodes";
import { KEY } from "../../../utils/KeyboardEventKey";
import { Material } from "../../Material";

interface IProps {
Expand Down
2 changes: 1 addition & 1 deletion src/Corporation/ui/modals/LimitProductProductionModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Modal } from "../../../ui/React/Modal";
import Typography from "@mui/material/Typography";
import Button from "@mui/material/Button";
import TextField from "@mui/material/TextField";
import { KEY } from "../../../utils/helpers/keyCodes";
import { KEY } from "../../../utils/KeyboardEventKey";

interface IProps {
open: boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/Corporation/ui/modals/MakeProductModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import TextField from "@mui/material/TextField";
import Button from "@mui/material/Button";
import MenuItem from "@mui/material/MenuItem";
import Select, { SelectChangeEvent } from "@mui/material/Select";
import { KEY } from "../../../utils/helpers/keyCodes";
import { KEY } from "../../../utils/KeyboardEventKey";
import { NumberInput } from "../../../ui/React/NumberInput";
import { CityName } from "@enums";
import { getRecordKeys } from "../../../Types/Record";
Expand Down
2 changes: 1 addition & 1 deletion src/Corporation/ui/modals/PurchaseMaterialModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { useCorporation, useDivision } from "../Context";
import Typography from "@mui/material/Typography";
import TextField from "@mui/material/TextField";
import Button from "@mui/material/Button";
import { KEY } from "../../../utils/helpers/keyCodes";
import { KEY } from "../../../utils/KeyboardEventKey";

interface IBulkPurchaseTextProps {
warehouse: Warehouse;
Expand Down
2 changes: 1 addition & 1 deletion src/Corporation/ui/modals/SellMaterialModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Modal } from "../../../ui/React/Modal";
import { dialogBoxCreate } from "../../../ui/React/DialogBox";

import * as actions from "../../Actions";
import { KEY } from "../../../utils/helpers/keyCodes";
import { KEY } from "../../../utils/KeyboardEventKey";

interface IProps {
open: boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/Corporation/ui/modals/SellProductModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Modal } from "../../../ui/React/Modal";
import { dialogBoxCreate } from "../../../ui/React/DialogBox";

import * as actions from "../../Actions";
import { KEY } from "../../../utils/helpers/keyCodes";
import { KEY } from "../../../utils/KeyboardEventKey";

interface IProps {
open: boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/Corporation/ui/modals/SellSharesModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as corpConstants from "../../data/Constants";
import Typography from "@mui/material/Typography";
import { ButtonWithTooltip } from "../../../ui/Components/ButtonWithTooltip";
import { sellShares } from "../../Actions";
import { KEY } from "../../../utils/helpers/keyCodes";
import { KEY } from "../../../utils/KeyboardEventKey";
import { NumberInput } from "../../../ui/React/NumberInput";
import { sellSharesFailureReason } from "../../helpers";

Expand Down
2 changes: 1 addition & 1 deletion src/Corporation/ui/modals/ThrowPartyModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Typography from "@mui/material/Typography";
import Button from "@mui/material/Button";
import TextField from "@mui/material/TextField";
import Box from "@mui/material/Box";
import { KEY } from "../../../utils/helpers/keyCodes";
import { KEY } from "../../../utils/KeyboardEventKey";

interface IProps {
open: boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/Faction/ui/CreateGangModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Page } from "../../ui/Router";
import { Player } from "@player";
import Typography from "@mui/material/Typography";
import Button from "@mui/material/Button";
import { KEY } from "../../utils/helpers/keyCodes";
import { KEY } from "../../utils/KeyboardEventKey";
import { FactionName } from "@enums";

interface IProps {
Expand Down
13 changes: 12 additions & 1 deletion src/GameOptions/ui/GameOptionsRoot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { MiscPage } from "./MiscPage";
import { NumericDisplayPage } from "./NumericDisplayOptions";
import { RemoteAPIPage } from "./RemoteAPIPage";
import { SystemPage } from "./SystemPage";
import { KeyBindingPage } from "./KeyBindingPage";

interface IProps {
save: () => void;
Expand All @@ -15,14 +16,24 @@ interface IProps {
softReset: () => void;
reactivateTutorial: () => void;
}
export type OptionsTabName = "System" | "Interface" | "Numeric Display" | "Gameplay" | "Misc" | "Remote API";

export type OptionsTabName =
| "System"
| "Interface"
| "Numeric Display"
| "Gameplay"
| "Misc"
| "Remote API"
| "Key Binding";

const tabs: Record<OptionsTabName, React.ReactNode> = {
System: <SystemPage />,
Interface: <InterfacePage />,
"Numeric Display": <NumericDisplayPage />,
Gameplay: <GameplayPage />,
Misc: <MiscPage />,
"Remote API": <RemoteAPIPage />,
"Key Binding": <KeyBindingPage />,
};

export function GameOptionsRoot(props: IProps): React.ReactElement {
Expand Down
1 change: 1 addition & 0 deletions src/GameOptions/ui/GameOptionsSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export const GameOptionsSidebar = (props: IProps): React.ReactElement => {
<SideBarTab sideBarProps={props} tabName="Numeric Display" />
<SideBarTab sideBarProps={props} tabName="Misc" />
<SideBarTab sideBarProps={props} tabName="Remote API" />
<SideBarTab sideBarProps={props} tabName="Key Binding" />
</List>
</Paper>
<Box
Expand Down
Loading