From 6a3e24dfb4e6b11885544b8d55675347cb0601cf Mon Sep 17 00:00:00 2001
From: Fuwn <contact@fuwn.me>
Date: Sat, 11 Nov 2023 18:30:23 -0800
Subject: fix(tools): better default handling

---
 src/routes/tools/+page.svelte | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

(limited to 'src/routes/tools/+page.svelte')

diff --git a/src/routes/tools/+page.svelte b/src/routes/tools/+page.svelte
index 5a12fb0f..5114efa5 100644
--- a/src/routes/tools/+page.svelte
+++ b/src/routes/tools/+page.svelte
@@ -4,11 +4,32 @@
 	import Wrapped from '$lib/Tools/Wrapped.svelte';
 	import { browser } from '$app/environment';
 	import EpisodeDiscussionCollector from '$lib/Tools/EpisodeDiscussionCollector.svelte';
+	import { onMount } from 'svelte';
 
 	export let data;
 
 	const urlParameters = browser ? new URLSearchParams(window.location.search) : null;
-	let tool = browser && urlParameters?.size !== 0 ? urlParameters?.get('tool') : 'default';
+	let tool = 'default';
+
+	onMount(() => {
+		switch (browser && urlParameters?.size !== 0 ? urlParameters?.get('tool') : 'default') {
+			case 'activity_history_hole_risks':
+				tool = 'activity_history_hole_risks';
+				break;
+			case 'wrapped':
+				tool = 'wrapped';
+				break;
+			case 'episode_discussion_collector':
+				tool = 'episode_discussion_collector';
+				break;
+			case 'todays_character_birthdays':
+				tool = 'todays_character_birthdays';
+				break;
+			default:
+				tool = 'default';
+				break;
+		}
+	});
 </script>
 
 <p>
-- 
cgit v1.2.3

