From 4a9e686816507c36ec80b1a133a981089d7cca70 Mon Sep 17 00:00:00 2001
From: Terry Truong <terry06890@gmail.com>
Date: Mon, 27 Jun 2022 01:41:18 +1000
Subject: Clean up code in SettingsModal

Add reduced-versions of developer options
Add input-range value indicators
---
 src/App.vue | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

(limited to 'src/App.vue')

diff --git a/src/App.vue b/src/App.vue
index 1c80acf..887b9a1 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -69,17 +69,9 @@ function getDefaultUiOpts(lytOpts: LayoutOptions): UiOptions {
 	//
 	return {
 		// Shared coloring/sizing
-		textColor,
-		textColorAlt,
-		bgColor,
-		bgColorLight,
-		bgColorDark,
-		bgColorLight2,
-		bgColorDark2,
-		bgColorAlt,
-		bgColorAltDark,
-		altColor,
-		altColorDark,
+		textColor, textColorAlt,
+		bgColor, bgColorLight, bgColorDark, bgColorLight2, bgColorDark2, bgColorAlt, bgColorAltDark,
+		altColor, altColorDark,
 		borderRadius: 5, // px
 		shadowNormal: '0 0 2px black',
 		shadowHovered: '0 0 1px 2px ' + altColor,
@@ -660,6 +652,7 @@ export default defineComponent({
 			this.settingsOpen = true;
 		},
 		async onSettingChg(setting: string){
+			// Save in localStorage
 			if (setting in this.lytOpts){
 				localStorage.setItem(lytOptPrefix + setting, String(this.lytOpts[setting as keyof LayoutOptions]));
 				this.relayoutWithCollapse();
@@ -671,7 +664,7 @@ export default defineComponent({
 			} else {
 				throw new Error('Unexpected setting');
 			}
-			console.log(`Saved ${setting}`)
+			console.log(`Saved setting ${setting}`);
 		},
 		async onTreeChange(){
 			if (this.activeRoot != this.layoutTree){
@@ -683,6 +676,7 @@ export default defineComponent({
 		},
 		onResetSettings(): void {
 			localStorage.clear();
+			// Restore default options
 			let defaultLytOpts = getDefaultLytOpts();
 			let defaultUiOpts = getDefaultUiOpts(defaultLytOpts);
 			if (this.uiOpts.useReducedTree != defaultUiOpts.useReducedTree){
@@ -691,6 +685,7 @@ export default defineComponent({
 			Object.assign(this.lytOpts, defaultLytOpts);
 			Object.assign(this.uiOpts, defaultUiOpts);
 			console.log('Settings reset');
+			//
 			this.relayoutWithCollapse();
 		},
 		// For help events
-- 
cgit v1.2.3

