Skip to content

Commit 970b799

Browse files
Merge dev
* dev: fix: eslint fix: adding suggested changes Co-authored-by: Azalea Colburn <62953415+azaleacolburn@users.noreply.github.com> fix: comment position changes fix: eslint error fix: moving placement of comment refactor: avoid having potentially undefined global functions fix: replacing empty fragment tag with null fix: formatting feat: hides all touch control schemes if not supported by device
2 parents 500366c + 330d333 commit 970b799

18 files changed

Lines changed: 52 additions & 54 deletions

fission/src/aps/APS.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ class APS {
205205
} catch (e) {
206206
console.error(e)
207207
World.analyticsSystem?.exception("APS Login Failure")
208-
globalAddToast?.("error", "Error signing in.", "Please try again.")
208+
globalAddToast("error", "Error signing in.", "Please try again.")
209209
}
210210
})
211211
}
@@ -236,7 +236,7 @@ class APS {
236236
const json = await res.json()
237237
if (!res.ok) {
238238
if (shouldRelog) {
239-
globalAddToast?.("warning", "Must Re-signin.", json.userMessage)
239+
globalAddToast("warning", "Must Re-signin.", json.userMessage)
240240
this._auth = undefined
241241
await this.requestAuthCode()
242242
return false
@@ -249,13 +249,13 @@ class APS {
249249
if (this._auth) {
250250
await this.loadUserInfo(this._auth)
251251
if (APS.userInfo) {
252-
globalAddToast?.("info", "ADSK Login", `Hello, ${APS.userInfo.givenName}`)
252+
globalAddToast("info", "ADSK Login", `Hello, ${APS.userInfo.givenName}`)
253253
}
254254
}
255255
return true
256256
} catch (e) {
257257
World.analyticsSystem?.exception("APS Login Failure")
258-
globalAddToast?.("error", "Error signing in.", "Please try again.")
258+
globalAddToast("error", "Error signing in.", "Please try again.")
259259
this._auth = undefined
260260
await this.requestAuthCode()
261261
return false
@@ -281,7 +281,7 @@ class APS {
281281
const json = await res.json()
282282
if (!res.ok) {
283283
World.analyticsSystem?.exception("APS Login Failure")
284-
globalAddToast?.("error", "Error signing in.", json.userMessage)
284+
globalAddToast("error", "Error signing in.", json.userMessage)
285285
this._auth = undefined
286286
return
287287
}
@@ -293,7 +293,7 @@ class APS {
293293
if (auth) {
294294
await this.loadUserInfo(auth)
295295
if (APS.userInfo) {
296-
globalAddToast?.("info", "ADSK Login", `Hello, ${APS.userInfo.givenName}`)
296+
globalAddToast("info", "ADSK Login", `Hello, ${APS.userInfo.givenName}`)
297297
}
298298
} else {
299299
console.error("Couldn't get auth data.")
@@ -306,7 +306,7 @@ class APS {
306306
if (retryLogin) {
307307
this._auth = undefined
308308
World.analyticsSystem?.exception("APS Login Failure")
309-
globalAddToast?.("error", "Error signing in.", "Please try again.")
309+
globalAddToast("error", "Error signing in.", "Please try again.")
310310
}
311311
}
312312

@@ -327,7 +327,7 @@ class APS {
327327
const json = await res.json()
328328
if (!res.ok) {
329329
World.analyticsSystem?.exception("APS Failure: User Info")
330-
globalAddToast?.("error", "Error fetching user data.", json.userMessage)
330+
globalAddToast("error", "Error fetching user data.", json.userMessage)
331331
this._auth = undefined
332332
await this.requestAuthCode()
333333
return
@@ -343,7 +343,7 @@ class APS {
343343
} catch (e) {
344344
console.error(e)
345345
World.analyticsSystem?.exception("APS Login Failure: User Info")
346-
globalAddToast?.("error", "Error signing in.", "Please try again.")
346+
globalAddToast("error", "Error signing in.", "Please try again.")
347347
this._auth = undefined
348348
}
349349
}
@@ -359,7 +359,7 @@ class APS {
359359
} catch (e) {
360360
console.error(e)
361361
World.analyticsSystem?.exception("APS Login Failure: Code Challenge")
362-
globalAddToast?.("error", "Error signing in.", "Please try again.")
362+
globalAddToast("error", "Error signing in.", "Please try again.")
363363
}
364364
}
365365
}

fission/src/aps/APSDataManagement.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ export async function getHubs(): Promise<Hub[] | undefined> {
140140
console.log(auth)
141141
console.log(APS.userInfo)
142142
if (e instanceof APSDataError) {
143-
globalAddToast?.("error", e.title, e.detail)
143+
globalAddToast("error", e.title, e.detail)
144144
} else if (e instanceof Error) {
145-
globalAddToast?.("error", "Failed to get hubs.", e.message)
145+
globalAddToast("error", "Failed to get hubs.", e.message)
146146
}
147147
return undefined
148148
}
@@ -179,7 +179,7 @@ export async function getProjects(hub: Hub): Promise<Project[] | undefined> {
179179
} catch (e) {
180180
console.error("Failed to get hubs")
181181
if (e instanceof Error) {
182-
globalAddToast?.("error", "Failed to get hubs.", e.message)
182+
globalAddToast("error", "Failed to get hubs.", e.message)
183183
}
184184
return undefined
185185
}
@@ -224,7 +224,7 @@ export async function getFolderData(project: Project, folder: Folder): Promise<D
224224
} catch (e) {
225225
console.error("Failed to get folder data")
226226
if (e instanceof Error) {
227-
globalAddToast?.("error", "Failed to get folder data.", e.message)
227+
globalAddToast("error", "Failed to get folder data.", e.message)
228228
}
229229
return undefined
230230
}
@@ -250,7 +250,7 @@ export async function searchFolder(project: Project, folder: Folder, filters?: F
250250
},
251251
})
252252
if (!res.ok) {
253-
globalAddToast?.("error", "Error getting cloud files.", "Please sign in again.")
253+
globalAddToast("error", "Error getting cloud files.", "Please sign in again.")
254254
return []
255255
}
256256
const json = await res.json()

fission/src/mirabuf/MirabufLoader.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ class MirabufCachingService {
140140

141141
if (cached) return cached
142142

143-
globalAddToast?.("error", "Cache Fallback", `Unable to cache “${fetchLocation}”. Using raw buffer instead.`)
143+
globalAddToast("error", "Cache Fallback", `Unable to cache “${fetchLocation}”. Using raw buffer instead.`)
144144

145145
// fallback: return raw buffer wrapped in MirabufCacheInfo
146146
return {

fission/src/mirabuf/MirabufSceneObject.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ import JOLT from "@/util/loading/JoltSyncLoader"
1010
import { BodyAssociate, LayerReserve } from "@/systems/physics/PhysicsSystem"
1111
import Mechanism from "@/systems/physics/Mechanism"
1212
import {
13+
Alliance,
1314
EjectorPreferences,
1415
FieldPreferences,
1516
IntakePreferences,
16-
ScoringZonePreferences,
1717
ProtectedZonePreferences,
18+
ScoringZonePreferences,
1819
} from "@/systems/preferences/PreferenceTypes"
1920
import PreferencesSystem from "@/systems/preferences/PreferencesSystem"
2021
import { MiraType } from "./MirabufLoader"
@@ -40,7 +41,6 @@ import {
4041
} from "@/ui/panels/configuring/assembly-config/ConfigurationType"
4142
import { SimConfigData } from "@/ui/panels/simulation/SimConfigShared"
4243
import WPILibBrain from "@/systems/simulation/wpilib_brain/WPILibBrain"
43-
import { Alliance } from "@/systems/preferences/PreferenceTypes"
4444
import { OnContactAddedEvent } from "@/systems/physics/ContactEvents"
4545

4646
const DEBUG_BODIES = false
@@ -524,7 +524,7 @@ class MirabufSceneObject extends SceneObject implements ContextSupplier {
524524
const now = Date.now()
525525
if (now - this._lastEjectableToastTime > MirabufSceneObject.EJECTABLE_TOAST_COOLDOWN_MS) {
526526
console.log(`Configure an ejectable first.`)
527-
globalAddToast?.("info", "Configure Ejectable", "Configure an ejectable first.")
527+
globalAddToast("info", "Configure Ejectable", "Configure an ejectable first.")
528528
this._lastEjectableToastTime = now
529529
}
530530

@@ -710,7 +710,7 @@ class MirabufSceneObject extends SceneObject implements ContextSupplier {
710710
configMode: ConfigMode.MOVE,
711711
selectedAssembly: this,
712712
})
713-
globalOpenPanel?.("configure")
713+
globalOpenPanel("configure")
714714
},
715715
},
716716
{
@@ -723,7 +723,7 @@ class MirabufSceneObject extends SceneObject implements ContextSupplier {
723723
configMode: undefined,
724724
selectedAssembly: this,
725725
})
726-
globalOpenPanel?.("configure")
726+
globalOpenPanel("configure")
727727
},
728728
}
729729
)
@@ -732,7 +732,7 @@ class MirabufSceneObject extends SceneObject implements ContextSupplier {
732732
data.items.push({
733733
name: "Auto Testing",
734734
func: () => {
735-
globalOpenPanel?.("auto-test")
735+
globalOpenPanel("auto-test")
736736
},
737737
})
738738
}

fission/src/systems/PerformanceMonitor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ export class PerformanceMonitoringSystem extends WorldSystem {
2929
if (this.isCritical) {
3030
PreferencesSystem.resetGraphicsPreferences()
3131
World.sceneRenderer.changeCSMSettings(PreferencesSystem.getGraphicsPreferences())
32-
globalOpenPanel?.("graphics-settings")
33-
globalAddToast?.("warning", "Performance Issues Detected", "Reverting to simple graphics")
32+
globalOpenPanel("graphics-settings")
33+
globalAddToast("warning", "Performance Issues Detected", "Reverting to simple graphics")
3434
}
3535
}
3636
}

fission/src/systems/scene/SceneRenderer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ class SceneRenderer extends WorldSystem {
536536
miraSupplierData.items.push({
537537
name: "Add",
538538
func: () => {
539-
globalOpenPanel?.("import-mirabuf")
539+
globalOpenPanel("import-mirabuf")
540540
},
541541
})
542542
}

fission/src/systems/simulation/SimulationSystem.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class SimulationSystem extends WorldSystem {
7474

7575
public static robotPenalty(robot: MirabufSceneObject, penaltyPoints: number, penaltyInfo: string): void {
7676
// Display a toast showing that a penalty was committed
77-
globalAddToast?.(
77+
globalAddToast(
7878
"warning",
7979
"PENALTY COMMITTED",
8080
`Robot ${robot.nameTag?.text()} (${robot.assemblyName}), Committed Penalty: ${penaltyInfo}`

fission/src/ui/components/DragModeIndicator.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const DragModeIndicator: React.FC = () => {
2020

2121
const handleClick = () => {
2222
window.dispatchEvent(new CustomEvent("disableDragMode"))
23-
globalAddToast?.("info", "Drag Mode", "Drag mode has been disabled")
23+
globalAddToast("info", "Drag Mode", "Drag mode has been disabled")
2424
}
2525

2626
return enabled ? (

fission/src/ui/components/GlobalUIComponent.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,23 @@ const GlobalUIComponent: React.FC = () => {
2222
setOpenModal(openModal)
2323

2424
return () => {
25-
setOpenModal(undefined)
25+
setOpenModal(() => {})
2626
}
2727
}, [openModal])
2828

2929
useEffect(() => {
3030
setOpenPanel(openPanel)
3131

3232
return () => {
33-
setOpenPanel(undefined)
33+
setOpenPanel(() => {})
3434
}
3535
}, [openPanel])
3636

3737
useEffect(() => {
3838
setAddToast(addToast)
3939

4040
return () => {
41-
setAddToast(undefined)
41+
setAddToast(() => {})
4242
}
4343
}, [addToast])
4444

fission/src/ui/components/GlobalUIControls.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
import { ToastType } from "@/ui/ToastContext"
77

8-
export let globalAddToast: ((type: ToastType, title: string, description: string) => void) | undefined = undefined
9-
export let globalOpenPanel: ((panelId: string) => void) | undefined = undefined
10-
export let globalOpenModal: ((modalId: string) => void) | undefined = undefined
8+
export let globalAddToast: (type: ToastType, title: string, description: string) => void = () => {}
9+
export let globalOpenPanel: (panelId: string) => void = () => {}
10+
export let globalOpenModal: (modalId: string) => void = () => {}
1111

1212
export function setAddToast(func: typeof globalAddToast) {
1313
globalAddToast = func

0 commit comments

Comments
 (0)