Implement ctrl-tab navigation between weight and energy

This commit is contained in:
2024-08-10 19:36:17 +02:00
parent 3118069297
commit 84002d1856
2 changed files with 14 additions and 7 deletions

View File

@@ -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>

View File

@@ -4,7 +4,6 @@
let forceUpdate = false;
weightStore.subscribe(() => {
console.log("updte");
forceUpdate = !forceUpdate;
});
</script>