From 1d0d354bd5000f04183e7b61dd95326130b0058b Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 24 Sep 2020 09:35:23 +0200 Subject: [PATCH] Skip Tutorial Topic --- BackendServers/WebServer/main.css | 11 +++++++ CanvasApp/Spaces/TutorialSpace.js | 49 +++++++++++++++++++++++++++++-- 2 files changed, 57 insertions(+), 3 deletions(-) diff --git a/BackendServers/WebServer/main.css b/BackendServers/WebServer/main.css index 1c6acaaf5..c23838774 100644 --- a/BackendServers/WebServer/main.css +++ b/BackendServers/WebServer/main.css @@ -308,3 +308,14 @@ li > .tutorial-font-small { opacity: 1; } +kbd { + padding: 2px 8px; + font-size: 125%; + font-weight: 500; + color: #000; + background-color: #bcd643; + border-radius: 5px; + border-style: outset; + border-width: 1px; +} + diff --git a/CanvasApp/Spaces/TutorialSpace.js b/CanvasApp/Spaces/TutorialSpace.js index 7d948a6e1..51cadd3bd 100644 --- a/CanvasApp/Spaces/TutorialSpace.js +++ b/CanvasApp/Spaces/TutorialSpace.js @@ -420,7 +420,7 @@ function newTutorialSpace() { status: 'Skipped' } saveTutorial(currentNode.payload, tutorial) - advance() + advance(true) } function previous() { @@ -603,7 +603,7 @@ function newTutorialSpace() { } } - function advance() { + function advance(isSkipping) { let found let advanced @@ -615,7 +615,11 @@ function newTutorialSpace() { } case 'Playing Topic': { found = false - findNextNode(tutorialRootNode) + if (isSkipping === true) { + findNextTopic(tutorialRootNode) + } else { + findNextNode(tutorialRootNode) + } break } case 'Playing Step': { @@ -713,6 +717,45 @@ function newTutorialSpace() { findNextNode(tutorialTopic, found) } } + + function findNextTopic(node) { + for (let i = 0; i < node.tutorialTopics.length; i++) { + + if (advanced === true) { + return + } + + let tutorialTopic = node.tutorialTopics[i] + if (found === true) { + if (resumeModeActivated !== true) { + currentNode = tutorialTopic + currentStatus = 'Playing Topic' + advanced = true + navigationStack.push(currentNode) + findTutorialNode(currentNode) + return + } else { + let tutorial = { + status: undefined + } + loadTutorial(tutorialTopic.payload, tutorial) + if (tutorial.status !== 'Done') { + currentNode = tutorialTopic + currentStatus = 'Playing Topic' + advanced = true + navigationStack.push(currentNode) + findTutorialNode(currentNode) + return + } + } + } + if (tutorialTopic.id === currentNode.id) { + found = true + } else { + findNextTopic(tutorialTopic, found) + } + } + } } function buildHTML() {