Skip to content

Commit

Permalink
Build Errors (#1029)
Browse files Browse the repository at this point in the history
  • Loading branch information
HunterBarclay authored Jul 16, 2024
2 parents 8d208bc + 18874ad commit 5fa5cad
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 24 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/FissionBuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Fission - Build

on:
workflow_dispatch: {}
pull_request:
branches: [master, dev]

jobs:
buildFission:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: JavaScript Setup
uses: actions/setup-node@v2
with:
node-version: 20

- name: Install Dependencies
run: |
cd fission
npm install
- name: Build Fission
run: |
cd fission
npm run build && echo "Build Passed" || (echo "Build Failed" && exit 1)
2 changes: 2 additions & 0 deletions fission/src/Synthesis.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import APS from "./aps/APS.ts"
import ImportMirabufPanel from "@/ui/panels/mirabuf/ImportMirabufPanel.tsx"
import Skybox from "./ui/components/Skybox.tsx"
import ConfigureRobotModal from "./ui/modals/configuring/ConfigureRobotModal.tsx"
import ResetAllInputsModal from "./ui/modals/configuring/ResetAllInputsModal.tsx"

const DEFAULT_MIRA_PATH = "/api/mira/Robots/Team 2471 (2018)_v7.mira"

Expand Down Expand Up @@ -215,6 +216,7 @@ const initialModals = [
<ManageAssembliesModal key="manage-assemblies" modalId="manage-assemblies" />,
<ImportLocalMirabufModal key="import-local-mirabuf" modalId="import-local-mirabuf" />,
<ConfigureRobotModal key="config-robot" modalId="config-robot" />,
<ResetAllInputsModal key="reset-inputs" modalId="reset-inputs" />,
]

const initialPanels: ReactElement[] = [
Expand Down
8 changes: 4 additions & 4 deletions fission/src/systems/preferences/PreferencesSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ import {

class PreferenceEvent extends Event {
public prefName: GlobalPreference
public prefValue: object
public prefValue: unknown

constructor(prefName: GlobalPreference, prefValue: object) {
constructor(prefName: GlobalPreference, prefValue: unknown) {
super("preferenceChanged")
this.prefName = prefName
this.prefValue = prefValue
}
}

class PreferencesSystem {
private static _preferences: { [key: string]: object }
private static _preferences: { [key: string]: unknown }
private static _localStorageKey = "Preferences"

/** Event dispatched when any global preference is updated */
Expand All @@ -30,7 +30,7 @@ class PreferencesSystem {
}

/** Sets a global preference to be a value of a specific type */
public static setGlobalPreference<T extends object>(key: GlobalPreference, value: T) {
public static setGlobalPreference<T>(key: GlobalPreference, value: T) {
if (this._preferences == undefined) this.loadPreferences()

window.dispatchEvent(new PreferenceEvent(key, value))
Expand Down
31 changes: 17 additions & 14 deletions fission/src/ui/modals/configuring/ResetAllInputsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import React from "react"
import Modal, { ModalPropsImpl } from "@/components/Modal"
import { GrFormClose } from "react-icons/gr"
import { useModalControlContext } from "@/ui/ModalContext"
import InputSystem from "@/systems/input/InputSystem"
import DefaultInputs from "@/systems/input/DefaultInputs"
import PreferencesSystem from "@/systems/preferences/PreferencesSystem"

const ResetAllInputsModal: React.FC<ModalPropsImpl> = ({ modalId }) => {
const { openModal } = useModalControlContext()
Expand All @@ -14,24 +14,27 @@ const ResetAllInputsModal: React.FC<ModalPropsImpl> = ({ modalId }) => {
icon={<GrFormClose />}
modalId={modalId}
onAccept={() => {
let i = 0
InputSystem.allInputs.forEach(currentScheme => {
const scheme = DefaultInputs.ALL_INPUT_SCHEMES[i]
if (!currentScheme || !scheme) return
const roboPrefs = PreferencesSystem.getAllRobotPreferences()

scheme.inputs.forEach(newInput => {
const currentInput = currentScheme.inputs.find(i => i.inputName == newInput.inputName)
// TODO: This will be improved to make more sense to a user in the "named inputs" PR
Object.values(roboPrefs).forEach(roboPref => {
roboPref.inputsSchemes.forEach(currentScheme => {
const resetScheme = DefaultInputs.ALL_INPUT_SCHEMES[0]
if (!currentScheme || !resetScheme) return

if (currentInput) {
const inputIndex = currentScheme.inputs.indexOf(currentInput)
resetScheme.inputs.forEach(newInput => {
const currentInput = currentScheme.inputs.find(i => i.inputName == newInput.inputName)

currentScheme.inputs[inputIndex] = newInput.getCopy()
}
})
currentScheme.usesGamepad = scheme.usesGamepad
if (currentInput) {
const inputIndex = currentScheme.inputs.indexOf(currentInput)

i++
currentScheme.inputs[inputIndex] = newInput.getCopy()
}
})
currentScheme.usesGamepad = resetScheme.usesGamepad
})
})

openModal("change-inputs")
}}
onCancel={() => {
Expand Down
11 changes: 5 additions & 6 deletions fission/src/ui/panels/configuring/scoring/ZoneConfigPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import Input from "@/components/Input"
import Panel, { PanelPropsImpl } from "@/components/Panel"
import Button from "@/components/Button"
import Checkbox from "@/components/Checkbox"
import Slider from "@/components/Slider"
import NumberInput from "@/components/NumberInput"

export type ScoringZone = {
Expand All @@ -22,11 +21,11 @@ const ZoneConfigPanel: React.FC<PanelPropsImpl> = ({ panelId, openLocation, side
// then set all default values to the state of the zone
const [, setName] = useState<string>("")
const [alliance, setAlliance] = useState<"red" | "blue">("blue")
const [, setParent] = useState<string>("")
const [,] = useState<string>("")
const [, setPoints] = useState<number>(1)
const [, setDestroy] = useState<boolean>(false)
const [, setPersistent] = useState<boolean>(false)
const [, setScale] = useState<[number, number, number]>([1, 1, 1])
const [,] = useState<[number, number, number]>([1, 1, 1])

return (
<Panel name="Scoring Zone Config" panelId={panelId} openLocation={openLocation} sidePadding={sidePadding}>
Expand All @@ -40,7 +39,7 @@ const ZoneConfigPanel: React.FC<PanelPropsImpl> = ({ panelId, openLocation, side
<NumberInput label="Points" placeholder="Zone points" defaultValue={1} onInput={v => setPoints(v || 1)} />
<Checkbox label="Destroy Gamepiece" defaultState={false} onClick={setDestroy} />
<Checkbox label="Persistent Points" defaultState={false} onClick={setPersistent} />
<Slider
{/* <Slider
label="X Scale"
min={0}
max={10}
Expand Down Expand Up @@ -76,9 +75,9 @@ const ZoneConfigPanel: React.FC<PanelPropsImpl> = ({ panelId, openLocation, side
setScale(s => {
s[2] = v
return s
})
} )
}
/>
/>*/}
</Panel>
)
}
Expand Down

0 comments on commit 5fa5cad

Please sign in to comment.