Skip to content

Commit 3a20e92

Browse files
Moving Import Local Mirabuf (#1071)
2 parents 1a171c5 + 645ee2b commit 3a20e92

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed

fission/src/ui/components/MainHUD.tsx

-5
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,6 @@ const MainHUD: React.FC = () => {
9595
icon={SynthesisIcons.MagnifyingGlass}
9696
onClick={() => openModal("view")}
9797
/> */}
98-
<MainHUDButton
99-
value={"Import Local Asset"}
100-
icon={SynthesisIcons.Import}
101-
onClick={() => openModal("import-local-mirabuf")}
102-
/>
10398
<MainHUDButton
10499
value={"Configure"}
105100
icon={SynthesisIcons.Gear}

fission/src/ui/modals/mirabuf/ImportLocalMirabufModal.tsx

+7-3
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ import MirabufCachingService, { MiraType } from "@/mirabuf/MirabufLoader"
88
import Dropdown from "@/ui/components/Dropdown"
99
import { CreateMirabuf } from "@/mirabuf/MirabufSceneObject"
1010
import { SynthesisIcons } from "@/ui/components/StyledComponents"
11+
import { usePanelControlContext } from "@/ui/PanelContext"
1112

1213
const ImportLocalMirabufModal: React.FC<ModalPropsImpl> = ({ modalId }) => {
1314
// update tooltip based on type of drivetrain, receive message from Synthesis
1415
const { showTooltip } = useTooltipControlContext()
16+
const { openPanel } = usePanelControlContext()
1517

1618
const fileUploadRef = useRef<HTMLInputElement>(null)
1719

@@ -44,7 +46,7 @@ const ImportLocalMirabufModal: React.FC<ModalPropsImpl> = ({ modalId }) => {
4446

4547
return (
4648
<Modal
47-
name={"Import Local Assemblies"}
49+
name={"Import From File"}
4850
icon={SynthesisIcons.Import}
4951
modalId={modalId}
5052
acceptEnabled={selectedFile !== undefined && miraType !== undefined}
@@ -64,12 +66,14 @@ const ImportLocalMirabufModal: React.FC<ModalPropsImpl> = ({ modalId }) => {
6466
World.SceneRenderer.RegisterSceneObject(x)
6567
}
6668
})
69+
70+
if (miraType == MiraType.ROBOT) openPanel("choose-scheme")
6771
}
6872
}}
6973
>
7074
<div className="flex flex-col items-center gap-5">
7175
<input ref={fileUploadRef} onChange={onInputChanged} type="file" hidden={true} />
72-
<Button value="Upload" size={ButtonSize.Large} onClick={uploadClicked} />
76+
<Button value="Upload File" size={ButtonSize.Large} onClick={uploadClicked} />
7377
{selectedFile ? (
7478
<Label
7579
className="text-center"
@@ -79,7 +83,7 @@ const ImportLocalMirabufModal: React.FC<ModalPropsImpl> = ({ modalId }) => {
7983
<></>
8084
)}
8185
<Dropdown
82-
label="Type"
86+
label="File Type"
8387
options={["None", "Robot", "Field"]}
8488
onSelect={(selected: string) => {
8589
typeSelected(selected)

fission/src/ui/panels/mirabuf/ImportMirabufPanel.tsx

+11
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { CreateMirabuf } from "@/mirabuf/MirabufSceneObject"
1515
import { Box } from "@mui/material"
1616
import { ToggleButton, ToggleButtonGroup } from "@/ui/components/ToggleButtonGroup"
1717
import { usePanelControlContext } from "@/ui/PanelContext"
18+
import { useModalControlContext } from "@/ui/ModalContext"
1819
import TaskStatus from "@/util/TaskStatus"
1920
import {
2021
PositiveButton,
@@ -23,9 +24,11 @@ import {
2324
DeleteButton,
2425
RefreshButton,
2526
SynthesisIcons,
27+
Spacer,
2628
} from "@/ui/components/StyledComponents"
2729
import { ProgressHandle } from "@/ui/components/ProgressNotificationData"
2830
import Panel, { PanelPropsImpl } from "@/ui/components/Panel"
31+
import Button from "@/ui/components/Button"
2932

3033
interface ItemCardProps {
3134
id: string
@@ -100,6 +103,7 @@ function SpawnCachedMira(info: MirabufCacheInfo, type: MiraType, progressHandle?
100103
const ImportMirabufPanel: React.FC<PanelPropsImpl> = ({ panelId }) => {
101104
const { showTooltip } = useTooltipControlContext()
102105
const { closePanel, openPanel } = usePanelControlContext()
106+
const { openModal } = useModalControlContext()
103107

104108
const [cachedRobots, setCachedRobots] = useState(GetCacheInfo(MiraType.ROBOT))
105109
const [cachedFields, setCachedFields] = useState(GetCacheInfo(MiraType.FIELD))
@@ -378,6 +382,10 @@ const ImportMirabufPanel: React.FC<PanelPropsImpl> = ({ panelId }) => {
378382
</SectionLabel>
379383
<SectionDivider />
380384
{cachedFieldElements}
385+
{Spacer(5)}
386+
<Box alignSelf={"center"}>
387+
<Button value="Import from File" onClick={() => openModal("import-local-mirabuf")} />
388+
</Box>
381389
</>
382390
)}
383391
<Box
@@ -419,6 +427,9 @@ const ImportMirabufPanel: React.FC<PanelPropsImpl> = ({ panelId }) => {
419427
{remoteFieldElements}
420428
</>
421429
)}
430+
<Box alignSelf={"center"}>
431+
<Button value="Import from File" onClick={() => openModal("import-local-mirabuf")} />
432+
</Box>
422433
</div>
423434
</Panel>
424435
)

0 commit comments

Comments
 (0)