From 0bfad59f80227b24208f87ecebac19d0b7accb49 Mon Sep 17 00:00:00 2001 From: Alden <49450743+alcen@users.noreply.github.com> Date: Fri, 9 Aug 2019 09:39:51 +0800 Subject: [PATCH 1/2] Conditional tab rendering for Playground * Data visualiser tab now only enabled for Source Chapter 2 and above * Inspector/Env Visualiser tabs now only enabled for Source Chapter 3 and above --- src/components/Playground.tsx | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/components/Playground.tsx b/src/components/Playground.tsx index a587f180fe..f31bc56a6b 100755 --- a/src/components/Playground.tsx +++ b/src/components/Playground.tsx @@ -105,19 +105,25 @@ class Playground extends React.Component { } public render() { - const tabs: SideContentTab[] = [ - playgroundIntroductionTab, - listVisualizerTab, - inspectorTab, - envVisualizerTab - ]; + const tabs: SideContentTab[] = [playgroundIntroductionTab]; + // Conditional logic for tab rendering if ( this.props.externalLibraryName === ExternalLibraryNames.PIXNFLIX || this.props.externalLibraryName === ExternalLibraryNames.ALL ) { + // Enable video tab only when 'PIX&FLIX' is selected tabs.push(videoDisplayTab); } + if (this.props.sourceChapter >= 2) { + // Enable Data Visualizer for Source Chapter 2 and above + tabs.push(listVisualizerTab); + } + if (this.props.sourceChapter >= 3) { + // Enable Inspector, Env Visualizer for Source Chapter 3 and above + tabs.push(inspectorTab); + tabs.push(envVisualizerTab); + } const workspaceProps: WorkspaceProps = { controlBarProps: { From ad8c3d9cbe0eae2eaf3b9746c5f8d83c2fd0bfdf Mon Sep 17 00:00:00 2001 From: lumos309 <35829443+lumos309@users.noreply.github.com> Date: Tue, 6 Aug 2019 12:13:50 +0800 Subject: [PATCH 2/2] =?UTF-8?q?Fix=20For=20Crashing=20in=20Source=20=C2=A7?= =?UTF-8?q?1=20&=20=C2=A72?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/sagas/workspaces.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sagas/workspaces.ts b/src/sagas/workspaces.ts index 7c3afe6812..4af837717a 100644 --- a/src/sagas/workspaces.ts +++ b/src/sagas/workspaces.ts @@ -357,7 +357,7 @@ export function* evalCode( context.runtime.debuggerOn = (actionType === actionTypes.EVAL_EDITOR || actionType === actionTypes.DEBUG_RESUME) && context.chapter > 2; - if (!context.runtime.debuggerOn) { + if (!context.runtime.debuggerOn && context.chapter > 2) { inspectorUpdate(undefined); // effectively resets the interface } const { result, interrupted, paused } = yield race({