Skip to content

Commit a98dd49

Browse files
authored
Simplify logic for adding of StepperLimit slider (#3056)
* Update js-slang * Enable step limit for Scheme variants * Simplify logic for step limit setting * update snapshots * remove commented line * update tests * update execution time logic
1 parent 81573e6 commit a98dd49

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

src/commons/application/ApplicationTypes.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,10 @@ export function isSchemeLanguage(chapter: Chapter): boolean {
214214
].includes(chapter);
215215
}
216216

217+
export function isCseVariant(variant: Variant): boolean {
218+
return variant == Variant.EXPLICIT_CONTROL;
219+
}
220+
217221
const pySubLanguages: Array<Pick<SALanguage, 'chapter' | 'variant' | 'displayName'>> = [
218222
{ chapter: Chapter.PYTHON_1, variant: Variant.DEFAULT, displayName: 'Python \xa71' }
219223
//{ chapter: Chapter.PYTHON_2, variant: Variant.DEFAULT, displayName: 'Python \xa72' },

src/pages/playground/Playground.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
setSessionDetails,
1919
setSharedbConnected
2020
} from 'src/commons/collabEditing/CollabEditingActions';
21+
import { ControlBarExecutionTime } from 'src/commons/controlBar/ControlBarExecutionTime';
2122
import makeCseMachineTabFrom from 'src/commons/sideContent/content/SideContentCseMachine';
2223
import makeDataVisualizerTabFrom from 'src/commons/sideContent/content/SideContentDataVisualizer';
2324
import makeHtmlDisplayTabFrom from 'src/commons/sideContent/content/SideContentHtmlDisplay';
@@ -49,6 +50,7 @@ import {
4950
import {
5051
getDefaultFilePath,
5152
getLanguageConfig,
53+
isCseVariant,
5254
isSourceLanguage,
5355
OverallState,
5456
ResultOutput,
@@ -59,7 +61,6 @@ import { ControlBarAutorunButtons } from '../../commons/controlBar/ControlBarAut
5961
import { ControlBarChapterSelect } from '../../commons/controlBar/ControlBarChapterSelect';
6062
import { ControlBarClearButton } from '../../commons/controlBar/ControlBarClearButton';
6163
import { ControlBarEvalButton } from '../../commons/controlBar/ControlBarEvalButton';
62-
import { ControlBarExecutionTime } from '../../commons/controlBar/ControlBarExecutionTime';
6364
import { ControlBarGoogleDriveButtons } from '../../commons/controlBar/ControlBarGoogleDriveButtons';
6465
import { ControlBarSessionButtons } from '../../commons/controlBar/ControlBarSessionButton';
6566
import { ControlBarShareButton } from '../../commons/controlBar/ControlBarShareButton';
@@ -210,8 +211,8 @@ const Playground: React.FC<PlaygroundProps> = props => {
210211
editorTabs,
211212
editorSessionId,
212213
sessionDetails,
213-
execTime,
214214
stepLimit,
215+
execTime,
215216
isEditorAutorun,
216217
isRunning,
217218
isDebugging,
@@ -977,11 +978,11 @@ const Playground: React.FC<PlaygroundProps> = props => {
977978
languageConfig.supports.multiFile ? toggleFolderModeButton : null,
978979
persistenceButtons,
979980
githubButtons,
980-
usingRemoteExecution || !isSourceLanguage(languageConfig.chapter)
981-
? null
982-
: usingSubst || usingCse
983-
? stepperStepLimit
984-
: executionTime
981+
usingSubst || usingCse || isCseVariant(languageConfig.variant)
982+
? stepperStepLimit
983+
: isSourceLanguage(languageConfig.chapter)
984+
? executionTime
985+
: null
985986
]
986987
},
987988
editorContainerProps: editorContainerProps,

0 commit comments

Comments
 (0)