From c2f8a84645dbb0d3159ad5b3831d0597854690ce Mon Sep 17 00:00:00 2001
From: Terry Truong <terry06890@gmail.com>
Date: Mon, 23 May 2022 22:23:53 +1000
Subject: Add help modal button that opens tutorial

Needed to add code for skipping tutorial pane's welcome message.
Also fixed small unwanted click-propagation bug in SettingsModal.
---
 src/App.vue | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

(limited to 'src/App.vue')

diff --git a/src/App.vue b/src/App.vue
index 5fdd279..2fdf0e4 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -109,6 +109,7 @@ export default defineComponent({
 			searchOpen: false,
 			settingsOpen: false,
 			tutorialOpen: true,
+			tutorialFirstRun: true,
 			enabledFeatures: new EnabledFeatures(),
 			// For search and auto-mode
 			modeRunning: false,
@@ -586,8 +587,16 @@ export default defineComponent({
 			this.helpOpen = true;
 		},
 		// For tutorial events
+		onStartTutorial(){
+			if (this.tutorialOpen == false){
+				this.tutorialOpen = true;
+				tryLayout(this.activeRoot, this.tileAreaPos, this.tileAreaDims, this.lytOpts,
+					{allowCollapse: true, layoutMap: this.layoutMap});
+			}
+		},
 		onTutorialClose(){
 			this.tutorialOpen = false;
+			this.tutorialFirstRun = false;
 			this.enabledFeatures = new EnabledFeatures();
 			tryLayout(this.activeRoot, this.tileAreaPos, this.tileAreaDims, this.lytOpts,
 				{allowCollapse: true, layoutMap: this.layoutMap});
@@ -689,7 +698,8 @@ export default defineComponent({
 		:pos="ancestryBarPos" :dims="ancestryBarDims" :nodes="detachedAncestors"
 		:tolMap="tolMap" :lytOpts="lytOpts" :uiOpts="uiOpts"
 		@detached-ancestor-click="onDetachedAncestorClick" @info-icon-click="onInfoIconClick"/>
-	<tutorial-pane v-if="tutorialOpen" :pos="[0,0]" :dims="tutorialPaneDims" :uiOpts="uiOpts"
+	<tutorial-pane v-if="tutorialOpen"
+		:skipWelcome="!tutorialFirstRun" :pos="[0,0]" :dims="tutorialPaneDims" :uiOpts="uiOpts"
 		@tutorial-close="onTutorialClose" @set-enabled-features="onSetEnabledFeatures"/>
 	<!-- Icons -->
 	<search-icon @click="onSearchIconClick"
@@ -705,19 +715,19 @@ export default defineComponent({
 		class="absolute bottom-[6px] right-[6px] w-[18px] h-[18px]
 			text-white/40 hover:text-white hover:cursor-pointer"/>
 	<!-- Modals -->
-	<transition name="fade">
-		<search-modal v-if="searchOpen" :tolMap="tolMap" :uiOpts="uiOpts" ref="searchModal"
-			@search-close="searchOpen = false" @search-node="onSearchNode" @info-icon-click="onInfoIconClick"/>
-	</transition>
 	<transition name="fade">
 		<tile-info-modal v-if="infoModalNodeName != null"
 			:nodeName="infoModalNodeName" :tolMap="tolMap" :lytOpts="lytOpts" :uiOpts="uiOpts"
 			@info-modal-close="infoModalNodeName = null"/>
 	</transition>
 	<transition name="fade">
-		<help-modal v-if="helpOpen" :uiOpts="uiOpts" @help-modal-close="helpOpen = false"/>
+		<search-modal v-if="searchOpen" :tolMap="tolMap" :uiOpts="uiOpts" ref="searchModal"
+			@search-close="searchOpen = false" @search-node="onSearchNode" @info-icon-click="onInfoIconClick"/>
+	</transition>
+	<transition name="fade">
+		<help-modal v-if="helpOpen" :uiOpts="uiOpts"
+			@help-modal-close="helpOpen = false" @start-tutorial="onStartTutorial"/>
 	</transition>
-	<!-- Settings -->
 	<settings-modal v-if="settingsOpen" :lytOpts="lytOpts" :uiOpts="uiOpts"
 		@settings-close="settingsOpen = false"
 		@layout-option-change="onLayoutOptionChange" @tree-change="onTreeChange"/>
-- 
cgit v1.2.3

