@@ -21,20 +21,14 @@ import { MobileRegisters } from "./components/MobileRegisters";
21
21
import { MobileKnowledgeBase } from "./components/KnowledgeBase/Mobile" ;
22
22
import { Assembly } from "./components/ProgramLoader/Assembly" ;
23
23
import { useAppDispatch , useAppSelector } from "@/store/hooks.ts" ;
24
- import {
25
- setClickedInstruction ,
26
- setInstructionMode ,
27
- setIsProgramEditMode ,
28
- setIsProgramInvalid ,
29
- } from "@/store/debugger/debuggerSlice.ts" ;
24
+ import { setClickedInstruction , setInstructionMode , setIsProgramEditMode } from "@/store/debugger/debuggerSlice.ts" ;
30
25
import { MemoryPreview } from "@/components/MemoryPreview" ;
31
26
import { DebuggerControlls } from "./components/DebuggerControlls" ;
32
27
import { useDebuggerActions } from "./hooks/useDebuggerActions" ;
33
28
import { Loader } from "./components/ProgramLoader/Loader" ;
34
29
import classNames from "classnames" ;
35
30
import { DebuggerSettings } from "./components/DebuggerSettings" ;
36
31
import { HostCalls } from "./components/HostCalls" ;
37
- import { ProgramTextLoader } from "@/components/ProgramTextLoader" ;
38
32
39
33
const DebuggerContent = ( ) => {
40
34
const dispatch = useAppDispatch ( ) ;
@@ -43,7 +37,7 @@ const DebuggerContent = () => {
43
37
program,
44
38
initialState,
45
39
isProgramEditMode,
46
- isProgramInvalid ,
40
+ isAsmError ,
47
41
programPreviewResult,
48
42
clickedInstruction,
49
43
instructionMode,
@@ -80,37 +74,18 @@ const DebuggerContent = () => {
80
74
81
75
return (
82
76
< >
83
- < HostCalls />
77
+ < HostCalls currentInstructionEnriched = { currentInstructionEnriched } />
84
78
< div className = "col-span-12 md:col-span-4 max-h-[70vh] max-sm:min-h-[330px]" >
85
79
{ ! program . length && < InitialLoadProgramCTA /> }
86
80
{ ! ! program . length && (
87
81
< >
88
82
{ isProgramEditMode && (
89
- < div className = "border-2 rounded-md h-full p-2" >
90
- { instructionMode === InstructionMode . ASM ? (
91
- < Assembly
92
- program = { program }
93
- onProgramLoad = { debuggerActions . handleProgramLoad }
94
- initialState = { initialState }
95
- />
96
- ) : (
97
- < ProgramTextLoader
98
- program = { program }
99
- setProgram = { ( program , error ) => {
100
- if ( error ) {
101
- dispatch ( setIsProgramInvalid ( true ) ) ;
102
- }
103
-
104
- if ( ! error && program ) {
105
- debuggerActions . handleProgramLoad ( {
106
- initial : initialState ,
107
- program : program || [ ] ,
108
- name : "custom" ,
109
- } ) ;
110
- }
111
- } }
112
- />
113
- ) }
83
+ < div className = "border-2 rounded-md h-full p-2 pt-8" >
84
+ < Assembly
85
+ program = { program }
86
+ onProgramLoad = { debuggerActions . handleProgramLoad }
87
+ initialState = { initialState }
88
+ />
114
89
</ div >
115
90
) }
116
91
@@ -171,6 +146,7 @@ const DebuggerContent = () => {
171
146
< div className = { `flex items-center space-x-2 ${ ! program . length ? "invisible" : "visible" } ` } >
172
147
< Label htmlFor = "instruction-mode" > ASM</ Label >
173
148
< Switch
149
+ disabled = { isProgramEditMode }
174
150
id = "instruction-mode"
175
151
checked = { instructionMode === InstructionMode . BYTECODE }
176
152
onCheckedChange = { ( checked ) =>
@@ -184,7 +160,7 @@ const DebuggerContent = () => {
184
160
variant = "link"
185
161
size = "icon"
186
162
className = { ! program . length ? "invisible" : "visible" }
187
- disabled = { ! program . length || isProgramInvalid }
163
+ disabled = { ! program . length || isAsmError }
188
164
title = "Edit the code"
189
165
onClick = { ( ) => {
190
166
if ( isProgramEditMode ) {
@@ -206,7 +182,7 @@ const DebuggerContent = () => {
206
182
} ;
207
183
208
184
function App ( ) {
209
- const { pvmInitialized } = useAppSelector ( ( state ) => state . debugger ) ;
185
+ const { pvmInitialized, initialState , program } = useAppSelector ( ( state ) => state . debugger ) ;
210
186
211
187
return (
212
188
< >
@@ -236,7 +212,7 @@ function App() {
236
212
) : (
237
213
< div className = "col-span-12 flex justify-center h-[50vh] align-middle" >
238
214
< div className = "min-w-[50vw] max-md:w-[100%] min-h-[500px] h-[75vh] flex flex-col" >
239
- < Loader />
215
+ < Loader initialState = { initialState } program = { program } />
240
216
</ div >
241
217
</ div >
242
218
) }
0 commit comments