Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
abb25c1357 | |||
e0eb7f9748 |
@@ -6,6 +6,8 @@
|
|||||||
import * as srouter from "svelte-spa-router";
|
import * as srouter from "svelte-spa-router";
|
||||||
import { location } from "svelte-spa-router";
|
import { location } from "svelte-spa-router";
|
||||||
|
|
||||||
|
const energyLocRegex = /^\/(?:Energy)?(?!Weight)/;
|
||||||
|
const weightLocRegex = /^\/(?:Weight)(?!Energy)/;
|
||||||
function keyDown(event: KeyboardEvent) {
|
function keyDown(event: KeyboardEvent) {
|
||||||
if (event.ctrlKey && event.key == "r") {
|
if (event.ctrlKey && event.key == "r") {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
@@ -14,10 +16,10 @@
|
|||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
if (event.ctrlKey && event.key == "Tab") {
|
if (event.ctrlKey && event.key == "Tab") {
|
||||||
if ($location == "/") {
|
if (energyLocRegex.test($location)) {
|
||||||
srouter.replace("/Weight");
|
srouter.replace($location.replace(energyLocRegex, "/Weight"));
|
||||||
} else if ($location == "/Weight") {
|
} else if (weightLocRegex.test($location)) {
|
||||||
srouter.replace("/");
|
srouter.replace($location.replace(weightLocRegex, "/Energy"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
const routes = {
|
const routes = {
|
||||||
'/': Energy,
|
'/': Energy,
|
||||||
|
'/Energy': Energy,
|
||||||
'/Energy/daily': Daily,
|
'/Energy/daily': Daily,
|
||||||
'/Energy/weekly': Weekly,
|
'/Energy/weekly': Weekly,
|
||||||
'/Energy/monthly': Monthly,
|
'/Energy/monthly': Monthly,
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import FoodTable from "$lib/components/Energy/FoodTable.svelte";
|
import FoodTable from "$lib/components/Energy/FoodTable.svelte";
|
||||||
|
import * as srouter from "svelte-spa-router";
|
||||||
|
import { location } from "svelte-spa-router";
|
||||||
import { foodStore } from "$lib/store/Energy/foodStore";
|
import { foodStore } from "$lib/store/Energy/foodStore";
|
||||||
|
|
||||||
// Fuck this hacky shit
|
// Fuck this hacky shit
|
||||||
|
Reference in New Issue
Block a user