Implement ctrl-tab navigation between weight and energy
This commit is contained in:
		@@ -3,15 +3,23 @@
 | 
			
		||||
	import Router from "$lib/router/Router.svelte";
 | 
			
		||||
	import { Close } from "$wails/main/App";
 | 
			
		||||
	import { Toaster } from "svelte-sonner";
 | 
			
		||||
	import * as srouter from "svelte-spa-router";
 | 
			
		||||
	import { location } from "svelte-spa-router";
 | 
			
		||||
 | 
			
		||||
	function keyDown(event: KeyboardEvent) {
 | 
			
		||||
		if (event.ctrlKey && event.key == "r") {
 | 
			
		||||
			window.location.reload();
 | 
			
		||||
		}
 | 
			
		||||
		if (event.ctrlKey && event.key == 'w') {
 | 
			
		||||
			console.log("close");
 | 
			
		||||
		if (event.ctrlKey && event.key == "w") {
 | 
			
		||||
			Close();
 | 
			
		||||
		}
 | 
			
		||||
		if (event.ctrlKey && event.key == "Tab") {
 | 
			
		||||
			if ($location == "/") {
 | 
			
		||||
				srouter.replace("/Weight");
 | 
			
		||||
			} else if ($location == "/Weight") {
 | 
			
		||||
				srouter.replace("/");
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
@@ -19,8 +27,8 @@
 | 
			
		||||
 | 
			
		||||
<Toaster />
 | 
			
		||||
<template>
 | 
			
		||||
		<Header />
 | 
			
		||||
		<main class="flex-1">
 | 
			
		||||
			<Router />
 | 
			
		||||
		</main>
 | 
			
		||||
	<Header />
 | 
			
		||||
	<main class="flex-1">
 | 
			
		||||
		<Router />
 | 
			
		||||
	</main>
 | 
			
		||||
</template>
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,6 @@
 | 
			
		||||
 | 
			
		||||
	let forceUpdate = false;
 | 
			
		||||
	weightStore.subscribe(() => {
 | 
			
		||||
		console.log("updte");
 | 
			
		||||
		forceUpdate = !forceUpdate;
 | 
			
		||||
	});
 | 
			
		||||
</script>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user