Skip to content

Commit 3b002ce

Browse files
committed
Small modal spacing tweaks and control scheme deletion fix
1 parent a6e0219 commit 3b002ce

File tree

6 files changed

+43
-24
lines changed

6 files changed

+43
-24
lines changed

Diff for: fission/src/ui/components/Modal.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const Modal: React.FC<ModalProps> = ({
5656
<div
5757
id={modalId}
5858
key={modalId}
59-
className={`${className} flex flex-col absolute max-w-[98vw] max-h-[90vh] w-fit h-fit left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 bg-background text-main-text m-auto border-5 rounded-2xl shadow-sm shadow-slate-800`}
59+
className={`${className} flex flex-col absolute max-w-[50vw] max-h-[95vh] w-fit h-fit left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 bg-background text-main-text m-auto border-5 rounded-2xl shadow-sm shadow-slate-800`}
6060
>
6161
{name && (
6262
<div id="header" className="flex items-center gap-8 h-16">
@@ -78,7 +78,7 @@ const Modal: React.FC<ModalProps> = ({
7878
id="content"
7979
className={`${contentClassName || ""} ${
8080
!contentClassName?.includes("mx") ? "mx-[2rem]" : ""
81-
} flex flex-col gap-4 max-h-75vh p-4`}
81+
} flex flex-col gap-4 max-h-[75vh]`}
8282
>
8383
{children}
8484
</div>

Diff for: fission/src/ui/components/StyledComponents.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import Label, { LabelSize } from "./Label"
33
import Button, { ButtonProps, ButtonSize } from "./Button"
44
import { IoCheckmark, IoPencil, IoPeople, IoTrashBin } from "react-icons/io5"
55
import { HiDownload } from "react-icons/hi"
6-
import { AiOutlinePlus } from "react-icons/ai"
76
import { BiRefresh } from "react-icons/bi"
87
import { AiFillWarning } from "react-icons/ai"
98
import { BsCodeSquare } from "react-icons/bs"
@@ -58,7 +57,8 @@ export class SynthesisIcons {
5857
/** Large icons: used for icon buttons */
5958
public static DeleteLarge = (<IoTrashBin size={"1.25rem"} />)
6059
public static DownloadLarge = (<HiDownload size={"1.25rem"} />)
61-
public static AddLarge = (<AiOutlinePlus size={"1.25rem"} />)
60+
public static AddLarge = (<FaPlus size={"1.25rem"} />)
61+
public static GearLarge = (<FaGear size={"1.25rem"} />)
6262
public static RefreshLarge = (<BiRefresh size={"1.25rem"} />)
6363
public static SelectLarge = (<IoCheckmark size={"1.25rem"} />)
6464
public static EditLarge = (<IoPencil size={"1.25rem"} />)

Diff for: fission/src/ui/modals/configuring/SettingsModal.tsx

+27-16
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,38 @@
11
import React, { useState } from "react"
22
import Modal, { ModalPropsImpl } from "@/components/Modal"
3-
import { FaGear } from "react-icons/fa6"
43
import Label, { LabelSize } from "@/components/Label"
54
import Dropdown from "@/components/Dropdown"
6-
import Slider from "@/components/Slider"
75
import Checkbox from "@/components/Checkbox"
86
import PreferencesSystem from "@/systems/preferences/PreferencesSystem"
97
import { SceneOverlayEvent, SceneOverlayEventKey } from "@/ui/components/SceneOverlayEvents"
108
import { QualitySetting } from "@/systems/preferences/PreferenceTypes"
119
import { Box } from "@mui/material"
12-
import { Spacer } from "@/ui/components/StyledComponents"
10+
import { Spacer, SynthesisIcons } from "@/ui/components/StyledComponents"
1311
import World from "@/systems/World"
1412

1513
const SettingsModal: React.FC<ModalPropsImpl> = ({ modalId }) => {
1614
const [qualitySettings, setQualitySettings] = useState<string>(
1715
PreferencesSystem.getGlobalPreference<string>("QualitySettings")
1816
)
19-
const [zoomSensitivity, setZoomSensitivity] = useState<number>(
17+
18+
// Disabled until camera settings are implemented
19+
/* const [zoomSensitivity, setZoomSensitivity] = useState<number>(
2020
PreferencesSystem.getGlobalPreference<number>("ZoomSensitivity")
2121
)
2222
const [pitchSensitivity, setPitchSensitivity] = useState<number>(
2323
PreferencesSystem.getGlobalPreference<number>("PitchSensitivity")
2424
)
2525
const [yawSensitivity, setYawSensitivity] = useState<number>(
2626
PreferencesSystem.getGlobalPreference<number>("YawSensitivity")
27-
)
27+
) */
28+
2829
const [reportAnalytics, setReportAnalytics] = useState<boolean>(
2930
PreferencesSystem.getGlobalPreference<boolean>("ReportAnalytics")
3031
)
31-
const [useMetric, setUseMetric] = useState<boolean>(PreferencesSystem.getGlobalPreference<boolean>("UseMetric"))
32+
33+
// Disabled until use metric is implemented
34+
// const [useMetric, setUseMetric] = useState<boolean>(PreferencesSystem.getGlobalPreference<boolean>("UseMetric"))
35+
3236
const [renderScoringZones, setRenderScoringZones] = useState<boolean>(
3337
PreferencesSystem.getGlobalPreference<boolean>("RenderScoringZones")
3438
)
@@ -44,29 +48,32 @@ const SettingsModal: React.FC<ModalPropsImpl> = ({ modalId }) => {
4448

4549
const saveSettings = () => {
4650
PreferencesSystem.setGlobalPreference<string>("QualitySettings", qualitySettings)
47-
PreferencesSystem.setGlobalPreference<number>("ZoomSensitivity", zoomSensitivity)
48-
PreferencesSystem.setGlobalPreference<number>("PitchSensitivity", pitchSensitivity)
49-
PreferencesSystem.setGlobalPreference<number>("YawSensitivity", yawSensitivity)
51+
5052
PreferencesSystem.setGlobalPreference<boolean>("ReportAnalytics", reportAnalytics)
51-
PreferencesSystem.setGlobalPreference<boolean>("UseMetric", useMetric)
5253
PreferencesSystem.setGlobalPreference<boolean>("RenderScoringZones", renderScoringZones)
5354
PreferencesSystem.setGlobalPreference<boolean>("RenderSceneTags", renderSceneTags)
5455
PreferencesSystem.setGlobalPreference<boolean>("RenderScoreboard", renderScoreboard)
5556
PreferencesSystem.setGlobalPreference<boolean>("SubsystemGravity", subsystemGravity)
5657

58+
// Disabled until these settings are implemented
59+
/* PreferencesSystem.setGlobalPreference<number>("ZoomSensitivity", zoomSensitivity)
60+
PreferencesSystem.setGlobalPreference<number>("PitchSensitivity", pitchSensitivity)
61+
PreferencesSystem.setGlobalPreference<number>("YawSensitivity", yawSensitivity)
62+
PreferencesSystem.setGlobalPreference<boolean>("UseMetric", useMetric) */
63+
5764
PreferencesSystem.savePreferences()
5865
}
5966

6067
return (
6168
<Modal
6269
name="Settings"
63-
icon={<FaGear />}
70+
icon={SynthesisIcons.GearLarge}
6471
modalId={modalId}
6572
onAccept={() => {
6673
saveSettings()
6774
}}
6875
>
69-
<div className="flex overflow-y-auto flex-col gap-2 bg-background-secondary rounded-md p-2 max-h-[60vh]">
76+
<div className="flex overflow-y-auto flex-col gap-2 bg-background-secondary rounded-md p-2 max-h-[60vh] min-w-[350px]">
7077
<Label size={LabelSize.Medium}>Screen Settings</Label>
7178
<Dropdown
7279
label="Quality Settings"
@@ -77,7 +84,9 @@ const SettingsModal: React.FC<ModalPropsImpl> = ({ modalId }) => {
7784
World.SceneRenderer.ChangeLighting(selected)
7885
}}
7986
/>
80-
{Spacer(5)}
87+
88+
{/* Disabled until these settings are implemented */}
89+
{/* {Spacer(5)}
8190
<Label size={LabelSize.Medium}>Camera Settings</Label>
8291
<Slider
8392
min={1}
@@ -106,7 +115,7 @@ const SettingsModal: React.FC<ModalPropsImpl> = ({ modalId }) => {
106115
format={{ maximumFractionDigits: 2 }}
107116
onChange={(_, value) => setYawSensitivity(value as number)}
108117
tooltipText="Moving the camera left and right."
109-
/>
118+
/>*/}
110119
{Spacer(20)}
111120
<Label size={LabelSize.Medium}>Preferences</Label>
112121
<Box display="flex" flexDirection={"column"}>
@@ -118,13 +127,15 @@ const SettingsModal: React.FC<ModalPropsImpl> = ({ modalId }) => {
118127
}}
119128
tooltipText="Record user data such as what robots are spawned and how they are configured. No personal data will be collected."
120129
/>
121-
<Checkbox
130+
{/* Disabled until this settings is implemented */}
131+
{/* <Checkbox
122132
label="Use Metric"
123133
defaultState={PreferencesSystem.getGlobalPreference<boolean>("UseMetric")}
124134
onClick={checked => {
125135
setUseMetric(checked)
126136
}}
127-
/>
137+
tooltipText="Metric measurements. (ex: meters instead of feet)"
138+
/> */}
128139
<Checkbox
129140
label="Realistic Subsystem Gravity"
130141
defaultState={PreferencesSystem.getGlobalPreference<boolean>("SubsystemGravity")}

Diff for: fission/src/ui/modals/configuring/theme-editor/NewInputSchemeModal.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const NewInputSchemeModal: React.FC<ModalPropsImpl> = ({ modalId }) => {
1616
return (
1717
<Modal
1818
name="New Input Scheme"
19-
icon={SynthesisIcons.Add}
19+
icon={SynthesisIcons.AddLarge}
2020
modalId={modalId}
2121
onAccept={() => {
2222
const scheme = DefaultInputs.newBlankScheme

Diff for: fission/src/ui/panels/configuring/ChooseInputSchemePanel.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ const ChooseInputSchemePanel: React.FC<PanelPropsImpl> = ({ panelId }) => {
7373
sidePadding={8}
7474
acceptEnabled={false}
7575
icon={SynthesisIcons.Gamepad}
76-
cancelEnabled={selectedBrainIndexGlobal != undefined}
7776
cancelName="Close"
7877
>
7978
{/** A scroll view with buttons to select default and custom input schemes */}

Diff for: fission/src/ui/panels/configuring/assembly-config/interfaces/inputs/ConfigureInputsInterface.tsx

+11-2
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,19 @@ const ConfigureInputsInterface = () => {
7777
// Fetch current custom schemes
7878
InputSchemeManager.saveSchemes()
7979
InputSchemeManager.resetDefaultSchemes()
80-
const schemes = PreferencesSystem.getGlobalPreference<InputScheme[]>("InputSchemes")
8180

82-
// Find and remove this input scheme
81+
// Find the scheme to remove in preferences
82+
const schemes = PreferencesSystem.getGlobalPreference<InputScheme[]>("InputSchemes")
8383
const index = schemes.indexOf(val.scheme)
84+
85+
// If currently bound to a robot, remove the binding
86+
for (const [key, value] of InputSystem.brainIndexSchemeMap.entries()) {
87+
if (value == schemes[index]) {
88+
InputSystem.brainIndexSchemeMap.delete(key)
89+
}
90+
}
91+
92+
// Find and remove this input scheme from preferences
8493
schemes.splice(index, 1)
8594

8695
// Save to preferences

0 commit comments

Comments
 (0)