From 5e01d68c63e37faf64406cc42412fc2545366a23 Mon Sep 17 00:00:00 2001
From: dennistruemper <dennis.truemper@gmail.com>
Date: Sun, 30 Jul 2023 21:48:36 +0200
Subject: [PATCH] feat(PWA): shortcuts for create item and list (#31)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Co-authored-by: Dennis Trümper <privat@truemper-nord.de>
---
 src/app.html                                      |  2 +-
 src/components/buttons/actionBarBackButton.svelte |  2 +-
 src/stores/timetravelStore.ts                     |  2 --
 static/manifest.json                              | 14 ++++++++++++--
 4 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/src/app.html b/src/app.html
index 69671d0f..0f8ccc1b 100644
--- a/src/app.html
+++ b/src/app.html
@@ -3,7 +3,7 @@
 	<head>
 		<meta charset="utf-8" />
 		<link rel="icon" href="%sveltekit.assets%/favicon.ico" />
-		<link rel="manifest" href="manifest.json" />
+		<link rel="manifest" href="/manifest.json" />
 		<meta name="theme-color" content="##d946ef" />
 		<meta name="viewport" content="width=device-width" />
 		%sveltekit.head%
diff --git a/src/components/buttons/actionBarBackButton.svelte b/src/components/buttons/actionBarBackButton.svelte
index a1088c51..d47bcdef 100644
--- a/src/components/buttons/actionBarBackButton.svelte
+++ b/src/components/buttons/actionBarBackButton.svelte
@@ -6,7 +6,7 @@
 	let previousPage: string = base;
 
 	afterNavigate((input) => {
-		previousPage = input.from?.url.pathname ?? base;
+		previousPage = input.from?.url?.pathname ?? base;
 	});
 </script>
 
diff --git a/src/stores/timetravelStore.ts b/src/stores/timetravelStore.ts
index e44d4807..84761127 100644
--- a/src/stores/timetravelStore.ts
+++ b/src/stores/timetravelStore.ts
@@ -35,7 +35,6 @@ export function createTimetraveStore<Model, Event>(
 		};
 	}
 
-	console.log('droch');
 	const loadedData = storage?.load() ?? initialData();
 
 	const { subscribe, set, update } = writable(loadedData ?? initialData());
@@ -48,7 +47,6 @@ export function createTimetraveStore<Model, Event>(
 		subscribe,
 		dispatch: (event: Event) =>
 			update((store) => {
-				console.log('dispatch');
 				// create new future if event occures in history
 				if (store.version === store.history.length - 1) {
 					//append to history
diff --git a/static/manifest.json b/static/manifest.json
index 7cc093c9..c27b6b4d 100644
--- a/static/manifest.json
+++ b/static/manifest.json
@@ -6,7 +6,17 @@
 		{ "src": "/android-chrome-192x192.png", "sizes": "192x192", "type": "image/png" },
 		{ "src": "/android-chrome-512x512.png", "sizes": "512x512", "type": "image/png" }
 	],
-	"theme_color": "##d946ef",
+	"theme_color": "#d946ef",
 	"background_color": "#f0abfc",
-	"display": "standalone"
+	"display": "standalone",
+	"shortcuts": [
+		{
+			"name": "New Item",
+			"url": "/lists/create"
+		},
+		{
+			"name": "New List",
+			"url": "/createItem"
+		}
+	]
 }