From da7c0f644fb69552b83c373d5ad13550634900f9 Mon Sep 17 00:00:00 2001 From: KyroVibe Date: Mon, 29 Jul 2024 02:57:00 -0600 Subject: [PATCH 01/16] Adding dev flags to turn off certain analytics settings/ui while testing. Fixed modal overflow --- fission/src/Synthesis.tsx | 2 +- fission/src/systems/analytics/AnalyticsSystem.ts | 3 ++- fission/src/ui/components/Modal.tsx | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/fission/src/Synthesis.tsx b/fission/src/Synthesis.tsx index 51e9c4db05..1b3d308176 100644 --- a/fission/src/Synthesis.tsx +++ b/fission/src/Synthesis.tsx @@ -95,7 +95,7 @@ function Synthesis() { World.InitWorld() - if (!PreferencesSystem.getGlobalPreference("ReportAnalytics")) { + if (!PreferencesSystem.getGlobalPreference("ReportAnalytics") && !import.meta.env.DEV) { setConsentPopupDisable(false) } diff --git a/fission/src/systems/analytics/AnalyticsSystem.ts b/fission/src/systems/analytics/AnalyticsSystem.ts index 778a60b69f..6fd1d04a9d 100644 --- a/fission/src/systems/analytics/AnalyticsSystem.ts +++ b/fission/src/systems/analytics/AnalyticsSystem.ts @@ -27,7 +27,8 @@ class AnalyticsSystem extends WorldSystem { init({ measurementId: "G-6XNCRD7QNC", debug: import.meta.env.DEV, - sendPageViews: true, + anonymizeIp: true, + sendPageViews: false, trackingConsent: PreferencesSystem.getGlobalPreference("ReportAnalytics"), }) diff --git a/fission/src/ui/components/Modal.tsx b/fission/src/ui/components/Modal.tsx index 97152494b2..a0570db82e 100644 --- a/fission/src/ui/components/Modal.tsx +++ b/fission/src/ui/components/Modal.tsx @@ -70,7 +70,7 @@ const Modal: React.FC = ({ id="content" className={`${contentClassName} ${ !contentClassName?.includes("mx") ? "mx-[2rem]" : "" - } flex flex-col gap-4 max-h-75vh`} + } flex flex-col gap-4 max-h-75vh overflow-y-auto p-4`} > {children} From a15615554bd5bff03583a35dae2fe8e93461b2f6 Mon Sep 17 00:00:00 2001 From: LucaHaverty Date: Mon, 29 Jul 2024 10:18:02 -0700 Subject: [PATCH 02/16] Fixed only one input scheme saving --- fission/src/systems/input/InputSchemeManager.ts | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/fission/src/systems/input/InputSchemeManager.ts b/fission/src/systems/input/InputSchemeManager.ts index 76c433c962..23a5ede69d 100644 --- a/fission/src/systems/input/InputSchemeManager.ts +++ b/fission/src/systems/input/InputSchemeManager.ts @@ -122,24 +122,10 @@ class InputSchemeManager { /** Save all schemes that have been customized to local storage via preferences */ public static saveSchemes() { - const customizedSchemes = Array.from(InputSystem.brainIndexSchemeMap.values()).filter(s => { + const customizedSchemes = this.allInputSchemes.filter(s => { return s.customized }) - // Save default schemes that have been customized if a customized version does not already exist - this.defaultInputSchemes.forEach(s => { - if (!s.customized) return - - if ( - customizedSchemes.some(c => { - if (c.schemeName === s.schemeName) return true - }) - ) - return - - customizedSchemes.push(s) - }) - PreferencesSystem.setGlobalPreference("InputSchemes", customizedSchemes) PreferencesSystem.savePreferences() } From f1e8a8c21e94b2a847d3926876f0067c212e9d54 Mon Sep 17 00:00:00 2001 From: KyroVibe Date: Mon, 29 Jul 2024 14:15:33 -0600 Subject: [PATCH 03/16] Trying to fix bug with selecting scheme --- fission/src/ui/components/Dropdown.tsx | 2 +- fission/src/ui/components/Panel.tsx | 1 + .../modals/spawning/ManageAssembliesModal.tsx | 37 ++++++++++++++++++- .../configuring/ChooseInputSchemePanel.tsx | 28 +++++++++++--- 4 files changed, 61 insertions(+), 7 deletions(-) diff --git a/fission/src/ui/components/Dropdown.tsx b/fission/src/ui/components/Dropdown.tsx index 43229fa496..7b57996c81 100644 --- a/fission/src/ui/components/Dropdown.tsx +++ b/fission/src/ui/components/Dropdown.tsx @@ -45,7 +45,7 @@ const Dropdown: React.FC = ({ label, options, onSelect }) => { ) => typeof value === "string" && onSelect && onSelect(value)} > {optionList.map(option => ( - ))} diff --git a/fission/src/ui/components/Panel.tsx b/fission/src/ui/components/Panel.tsx index b8faee4977..f37c95becc 100644 --- a/fission/src/ui/components/Panel.tsx +++ b/fission/src/ui/components/Panel.tsx @@ -70,6 +70,7 @@ export type PanelPropsImpl = { panelId: string openLocation?: OpenLocation sidePadding?: number + args?: unknown[] } type PanelProps = { diff --git a/fission/src/ui/modals/spawning/ManageAssembliesModal.tsx b/fission/src/ui/modals/spawning/ManageAssembliesModal.tsx index 4f4451da78..41accd8ad3 100644 --- a/fission/src/ui/modals/spawning/ManageAssembliesModal.tsx +++ b/fission/src/ui/modals/spawning/ManageAssembliesModal.tsx @@ -1,10 +1,13 @@ -import React, { useReducer } from "react" +import React, { useMemo, useReducer } from "react" import Modal, { ModalPropsImpl } from "@/components/Modal" import { FaWrench } from "react-icons/fa6" import Button from "@/components/Button" import Label, { LabelSize } from "@/components/Label" import World from "@/systems/World" import MirabufSceneObject from "@/mirabuf/MirabufSceneObject" +import { usePanelControlContext } from "@/ui/PanelContext" +import { setSelectedBrainIndexGlobal } from "@/ui/panels/configuring/ChooseInputSchemePanel" +import SynthesisBrain from "@/systems/simulation/synthesis_brain/SynthesisBrain" interface AssemblyCardProps { mira: MirabufSceneObject @@ -12,12 +15,44 @@ interface AssemblyCardProps { } const AssemblyCard: React.FC = ({ mira, update }) => { + + const { openPanel } = usePanelControlContext() + + const brain = useMemo(() => (mira.brain as SynthesisBrain)?.brainIndex, [mira]) + return (
+ {/* s.schemeName), + selectedScheme?.schemeName + )} + onSelect={value => { + const schemeData = InputSchemeManager.allInputSchemes.find( + s => s.schemeName == value + ) + if (!schemeData || schemeData == selectedScheme) return + + setSelectedScheme(schemeData) + if (brain != undefined) { + console.debug(schemeData.schemeName) + InputSystem.brainIndexSchemeMap.set(brain, schemeData) + } + }} + /> */} +
) } @@ -78,18 +63,7 @@ const ManageAssembliesModal: React.FC = ({ modalId }) => { .map(x => x[1] as MirabufSceneObject) return ( - } - modalId={modalId} - onAccept={() => { - // showTooltip("controls", [ - // { control: "WASD", description: "Drive" }, - // { control: "E", description: "Intake" }, - // { control: "Q", description: "Dispense" }, - // ]); - }} - > + } modalId={modalId}>
From ee02494c8e64c97391dccddc2a3b3e94cdf20f29 Mon Sep 17 00:00:00 2001 From: LucaHaverty Date: Mon, 29 Jul 2024 10:18:02 -0700 Subject: [PATCH 09/16] Fixed only one input scheme saving --- fission/src/systems/input/InputSchemeManager.ts | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/fission/src/systems/input/InputSchemeManager.ts b/fission/src/systems/input/InputSchemeManager.ts index 76c433c962..23a5ede69d 100644 --- a/fission/src/systems/input/InputSchemeManager.ts +++ b/fission/src/systems/input/InputSchemeManager.ts @@ -122,24 +122,10 @@ class InputSchemeManager { /** Save all schemes that have been customized to local storage via preferences */ public static saveSchemes() { - const customizedSchemes = Array.from(InputSystem.brainIndexSchemeMap.values()).filter(s => { + const customizedSchemes = this.allInputSchemes.filter(s => { return s.customized }) - // Save default schemes that have been customized if a customized version does not already exist - this.defaultInputSchemes.forEach(s => { - if (!s.customized) return - - if ( - customizedSchemes.some(c => { - if (c.schemeName === s.schemeName) return true - }) - ) - return - - customizedSchemes.push(s) - }) - PreferencesSystem.setGlobalPreference("InputSchemes", customizedSchemes) PreferencesSystem.savePreferences() } From 76c38d85e5bc31adeca5e01d307eacbcedc31e3b Mon Sep 17 00:00:00 2001 From: KyroVibe Date: Mon, 29 Jul 2024 14:15:33 -0600 Subject: [PATCH 10/16] Trying to fix bug with selecting scheme --- fission/src/ui/components/Dropdown.tsx | 2 +- fission/src/ui/components/Panel.tsx | 1 + .../modals/spawning/ManageAssembliesModal.tsx | 37 ++++++++++++++++++- .../configuring/ChooseInputSchemePanel.tsx | 28 +++++++++++--- 4 files changed, 61 insertions(+), 7 deletions(-) diff --git a/fission/src/ui/components/Dropdown.tsx b/fission/src/ui/components/Dropdown.tsx index 43229fa496..7b57996c81 100644 --- a/fission/src/ui/components/Dropdown.tsx +++ b/fission/src/ui/components/Dropdown.tsx @@ -45,7 +45,7 @@ const Dropdown: React.FC = ({ label, options, onSelect }) => { ) => typeof value === "string" && onSelect && onSelect(value)} > {optionList.map(option => ( - ))} diff --git a/fission/src/ui/components/Panel.tsx b/fission/src/ui/components/Panel.tsx index b8faee4977..f37c95becc 100644 --- a/fission/src/ui/components/Panel.tsx +++ b/fission/src/ui/components/Panel.tsx @@ -70,6 +70,7 @@ export type PanelPropsImpl = { panelId: string openLocation?: OpenLocation sidePadding?: number + args?: unknown[] } type PanelProps = { diff --git a/fission/src/ui/modals/spawning/ManageAssembliesModal.tsx b/fission/src/ui/modals/spawning/ManageAssembliesModal.tsx index 4f4451da78..41accd8ad3 100644 --- a/fission/src/ui/modals/spawning/ManageAssembliesModal.tsx +++ b/fission/src/ui/modals/spawning/ManageAssembliesModal.tsx @@ -1,10 +1,13 @@ -import React, { useReducer } from "react" +import React, { useMemo, useReducer } from "react" import Modal, { ModalPropsImpl } from "@/components/Modal" import { FaWrench } from "react-icons/fa6" import Button from "@/components/Button" import Label, { LabelSize } from "@/components/Label" import World from "@/systems/World" import MirabufSceneObject from "@/mirabuf/MirabufSceneObject" +import { usePanelControlContext } from "@/ui/PanelContext" +import { setSelectedBrainIndexGlobal } from "@/ui/panels/configuring/ChooseInputSchemePanel" +import SynthesisBrain from "@/systems/simulation/synthesis_brain/SynthesisBrain" interface AssemblyCardProps { mira: MirabufSceneObject @@ -12,12 +15,44 @@ interface AssemblyCardProps { } const AssemblyCard: React.FC = ({ mira, update }) => { + + const { openPanel } = usePanelControlContext() + + const brain = useMemo(() => (mira.brain as SynthesisBrain)?.brainIndex, [mira]) + return (
+ {/* s.schemeName), + selectedScheme?.schemeName + )} + onSelect={value => { + const schemeData = InputSchemeManager.allInputSchemes.find( + s => s.schemeName == value + ) + if (!schemeData || schemeData == selectedScheme) return + + setSelectedScheme(schemeData) + if (brain != undefined) { + console.debug(schemeData.schemeName) + InputSystem.brainIndexSchemeMap.set(brain, schemeData) + } + }} + /> */} +
) } @@ -78,18 +63,7 @@ const ManageAssembliesModal: React.FC = ({ modalId }) => { .map(x => x[1] as MirabufSceneObject) return ( - } - modalId={modalId} - onAccept={() => { - // showTooltip("controls", [ - // { control: "WASD", description: "Drive" }, - // { control: "E", description: "Intake" }, - // { control: "Q", description: "Dispense" }, - // ]); - }} - > + } modalId={modalId}>