Skip to content

Commit f9d0900

Browse files
chore: formatting
1 parent cde88ab commit f9d0900

File tree

4 files changed

+59
-27
lines changed

4 files changed

+59
-27
lines changed

fission/src/ui/modals/DevtoolZoneRemovalModal.tsx

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,18 @@ const DevtoolZoneRemovalModal: React.FC<DevtoolZoneRemovalModalProps> = ({
3535
await onPermanentRemoval()
3636
const actionText = actionType === "modification" ? "modified" : "removed"
3737
const actionCapitalized = actionType === "modification" ? "Modified" : "Removed"
38-
globalAddToast?.("info", `Zone ${actionCapitalized}`, `${zoneName} has been permanently ${actionText} in the field file.`)
38+
globalAddToast?.(
39+
"info",
40+
`Zone ${actionCapitalized}`,
41+
`${zoneName} has been permanently ${actionText} in the field file.`
42+
)
3943
} catch (error) {
4044
const actionText = actionType === "modification" ? "modify" : "remove"
41-
globalAddToast?.("error", `${actionType === "modification" ? "Modification" : "Removal"} Failed`, `Failed to permanently ${actionText} zone in the field file cache.`)
45+
globalAddToast?.(
46+
"error",
47+
`${actionType === "modification" ? "Modification" : "Removal"} Failed`,
48+
`Failed to permanently ${actionText} zone in the field file cache.`
49+
)
4250
console.error(`Failed to ${actionText} zone in field file:`, error)
4351
} finally {
4452
setIsRemoving(false)
@@ -48,21 +56,31 @@ const DevtoolZoneRemovalModal: React.FC<DevtoolZoneRemovalModalProps> = ({
4856

4957
return (
5058
<Dialog open={isOpen} onClose={onClose} maxWidth="sm" fullWidth>
51-
<DialogTitle>{actionType === "modification" ? "Modify" : "Remove"} {zoneType === "scoring" ? "Scoring" : "Protected"} Zone</DialogTitle>
59+
<DialogTitle>
60+
{actionType === "modification" ? "Modify" : "Remove"} {zoneType === "scoring" ? "Scoring" : "Protected"}{" "}
61+
Zone
62+
</DialogTitle>
5263
<DialogContent>
5364
<Stack spacing={2}>
5465
<Typography variant="body1">
5566
The {zoneType} zone "{zoneName}" was defined in the field file and is cached.
5667
</Typography>
5768
<Typography variant="body2" color="text.secondary">
58-
Choose how you'd like to {actionType === "modification" ? "save your modifications" : "remove it"}:
69+
Choose how you'd like to{" "}
70+
{actionType === "modification" ? "save your modifications" : "remove it"}:
5971
</Typography>
6072
<Stack spacing={1}>
6173
<Typography variant="body2">
62-
<strong>Temporary {actionType === "modification" ? "modification" : "removal"}:</strong> {actionType === "modification" ? "Save changes until next field reload. Original zone will reappear when you refresh or reload the field." : "Remove zone until next field reload. The zone will reappear when you refresh or reload the field."}
74+
<strong>Temporary {actionType === "modification" ? "modification" : "removal"}:</strong>{" "}
75+
{actionType === "modification"
76+
? "Save changes until next field reload. Original zone will reappear when you refresh or reload the field."
77+
: "Remove zone until next field reload. The zone will reappear when you refresh or reload the field."}
6378
</Typography>
6479
<Typography variant="body2">
65-
<strong>Permanent {actionType === "modification" ? "modification" : "removal"}:</strong> {actionType === "modification" ? "Save changes to the field file cache. This will persist your modifications on future loads." : "Remove zone from the field file cache. This will prevent it from reappearing on future loads."}
80+
<strong>Permanent {actionType === "modification" ? "modification" : "removal"}:</strong>{" "}
81+
{actionType === "modification"
82+
? "Save changes to the field file cache. This will persist your modifications on future loads."
83+
: "Remove zone from the field file cache. This will prevent it from reappearing on future loads."}
6684
</Typography>
6785
</Stack>
6886
</Stack>
@@ -74,8 +92,15 @@ const DevtoolZoneRemovalModal: React.FC<DevtoolZoneRemovalModalProps> = ({
7492
<Button onClick={handleTemporaryRemoval} disabled={isRemoving} variant="outlined" color="warning">
7593
Temporary {actionType === "modification" ? "Modification" : "Removal"}
7694
</Button>
77-
<Button onClick={handlePermanentRemoval} disabled={isRemoving} variant="contained" color={actionType === "modification" ? "primary" : "error"}>
78-
{isRemoving ? `${actionType === "modification" ? "Modifying" : "Removing"}...` : `Permanent ${actionType === "modification" ? "Modification" : "Removal"}`}
95+
<Button
96+
onClick={handlePermanentRemoval}
97+
disabled={isRemoving}
98+
variant="contained"
99+
color={actionType === "modification" ? "primary" : "error"}
100+
>
101+
{isRemoving
102+
? `${actionType === "modification" ? "Modifying" : "Removing"}...`
103+
: `Permanent ${actionType === "modification" ? "Modification" : "Removal"}`}
79104
</Button>
80105
</DialogActions>
81106
</Dialog>

fission/src/ui/panels/configuring/assembly-config/ConfigurePanel.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,13 @@ const ConfigInterface: React.FC<ConfigInterfaceProps<void, ConfigurePanelCustomP
7979
console.error("Field does not contain scoring zone preferences!")
8080
return <Label size="md">ERROR: Field does not contain scoring zone configuration!</Label>
8181
}
82-
return <ConfigureScoringZonesInterface panel={panel as Panel<any, any>} selectedField={assembly} initialZones={zones} />
82+
return (
83+
<ConfigureScoringZonesInterface
84+
panel={panel as Panel<any, any>}
85+
selectedField={assembly}
86+
initialZones={zones}
87+
/>
88+
)
8389
}
8490
case ConfigMode.PROTECTED_ZONES: {
8591
const zones = assembly.fieldPreferences?.protectedZones ?? []

fission/src/ui/panels/configuring/assembly-config/interfaces/scoring/ScoringZoneConfigInterface.tsx

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import World from "@/systems/World"
1515
import Checkbox from "@/ui/components/Checkbox"
1616
import SelectButton from "@/ui/components/SelectButton"
1717
import TransformGizmoControl from "@/ui/components/TransformGizmoControl"
18+
import type { Panel } from "@/ui/helpers/UIProviderHelpers"
19+
import { CloseType, useUIContext } from "@/ui/helpers/UIProviderHelpers"
1820
import DevtoolZoneRemovalModal from "@/ui/modals/DevtoolZoneRemovalModal"
1921
import { isZoneFromDevtools, modifyZoneInDevtools } from "@/util/DevtoolZoneUtils"
2022
import {
@@ -23,8 +25,6 @@ import {
2325
convertThreeMatrix4ToArray,
2426
} from "@/util/TypeConversions"
2527
import { deltaFieldTransformsPhysicalProp as deltaFieldTransformsVisualProperties } from "@/util/threejs/MeshCreation"
26-
import type { Panel } from "@/ui/helpers/UIProviderHelpers"
27-
import { CloseType, useUIContext } from "@/ui/helpers/UIProviderHelpers"
2828

2929
/**
3030
* Saves ejector configuration to selected field.
@@ -269,17 +269,19 @@ const ZoneConfigInterface: React.FC<ZoneConfigProps> = ({ selectedField, selecte
269269
gizmoRef.current,
270270
selectedNode
271271
)
272-
272+
273273
const fieldZones = selectedField.fieldPreferences?.scoringZones
274274
if (fieldZones) {
275-
const zoneIndex = fieldZones.findIndex(z =>
276-
z === selectedZone ||
277-
(z.name === originalZoneRef.current.name &&
278-
z.alliance === originalZoneRef.current.alliance &&
279-
z.parentNode === originalZoneRef.current.parentNode &&
280-
JSON.stringify(z.deltaTransformation) === JSON.stringify(originalZoneRef.current.deltaTransformation))
275+
const zoneIndex = fieldZones.findIndex(
276+
z =>
277+
z === selectedZone ||
278+
(z.name === originalZoneRef.current.name &&
279+
z.alliance === originalZoneRef.current.alliance &&
280+
z.parentNode === originalZoneRef.current.parentNode &&
281+
JSON.stringify(z.deltaTransformation) ===
282+
JSON.stringify(originalZoneRef.current.deltaTransformation))
281283
)
282-
284+
283285
if (zoneIndex >= 0) {
284286
fieldZones[zoneIndex] = {
285287
name,
@@ -288,15 +290,15 @@ const ZoneConfigInterface: React.FC<ZoneConfigProps> = ({ selectedField, selecte
288290
points,
289291
destroyGamepiece: destroy,
290292
persistentPoints: persistent,
291-
deltaTransformation: selectedZone.deltaTransformation
293+
deltaTransformation: selectedZone.deltaTransformation,
292294
}
293295
}
294296
}
295-
297+
296298
PreferencesSystem.savePreferences()
297299
selectedField.updateScoringZones()
298300
}
299-
301+
300302
setConfirmationModal({ isOpen: false, pendingSave: false })
301303
if (panel) closePanel(panel.id, CloseType.Accept)
302304
}
@@ -310,14 +312,13 @@ const ZoneConfigInterface: React.FC<ZoneConfigProps> = ({ selectedField, selecte
310312
points,
311313
destroyGamepiece: destroy,
312314
persistentPoints: persistent,
313-
deltaTransformation: selectedZone.deltaTransformation
315+
deltaTransformation: selectedZone.deltaTransformation,
314316
}
315-
317+
316318
handleSave()
317319
modifiedZone.deltaTransformation = selectedZone.deltaTransformation
318320

319321
await modifyZoneInDevtools(originalZoneRef.current, modifiedZone, "scoring")
320-
321322
} catch (error) {
322323
console.error("Failed to permanently modify zone:", error)
323324
} finally {

fission/src/util/DevtoolZoneUtils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import MirabufCachingService, { MiraType } from "@/mirabuf/MirabufLoader"
21
import FieldMiraEditor from "@/mirabuf/FieldMiraEditor"
2+
import MirabufCachingService, { MiraType } from "@/mirabuf/MirabufLoader"
33
import PreferencesSystem from "@/systems/preferences/PreferencesSystem"
4-
import type { ScoringZonePreferences, ProtectedZonePreferences } from "@/systems/preferences/PreferenceTypes"
4+
import type { ProtectedZonePreferences, ScoringZonePreferences } from "@/systems/preferences/PreferenceTypes"
55
import World from "@/systems/World"
66

77
export type ZoneType = "scoring" | "protected"

0 commit comments

Comments
 (0)