Skip to content

Commit 49dadc8

Browse files
CSE Machine : Fixed the NavBar (#3630)
* Fixed the errors * Fixed format errors * Fixed inequality overlook
1 parent 811e389 commit 49dadc8

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/commons/sideContent/content/SideContentCseMachine.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,11 @@ class SideContentCseMachineBase extends React.Component<CseMachineProps, State>
212212
['e', () => {}]
213213
];
214214

215+
const currentStep = Math.max(0, this.state.value);
216+
const isAtFirstStep = currentStep < 1;
217+
const isAtLastStep = currentStep >= this.props.stepsTotal;
218+
const isNavDisabled = !this.state.visualization;
219+
215220
return (
216221
<HotKeys
217222
bindings={hotkeyBindings}
@@ -297,12 +302,12 @@ class SideContentCseMachineBase extends React.Component<CseMachineProps, State>
297302
)}
298303
<ButtonGroup>
299304
<Button
300-
disabled={!this.state.visualization}
305+
disabled={isNavDisabled || isAtFirstStep}
301306
icon="double-chevron-left"
302307
onClick={this.stepPrevBreakpoint}
303308
/>
304309
<Button
305-
disabled={!this.state.visualization}
310+
disabled={isNavDisabled || isAtFirstStep}
306311
icon="chevron-left"
307312
onClick={
308313
this.isJava() || CseMachine.getControlStash()
@@ -311,7 +316,7 @@ class SideContentCseMachineBase extends React.Component<CseMachineProps, State>
311316
}
312317
/>
313318
<Button
314-
disabled={!this.state.visualization}
319+
disabled={isNavDisabled || isAtLastStep}
315320
icon="chevron-right"
316321
onClick={
317322
this.isJava() || CseMachine.getControlStash()
@@ -320,7 +325,7 @@ class SideContentCseMachineBase extends React.Component<CseMachineProps, State>
320325
}
321326
/>
322327
<Button
323-
disabled={!this.state.visualization}
328+
disabled={isNavDisabled || isAtLastStep}
324329
icon="double-chevron-right"
325330
onClick={this.stepNextBreakpoint}
326331
/>

0 commit comments

Comments
 (0)