feat(pwa): quick entry deep link and home screen shortcut
This commit is contained in:
1 parent
07bcc7c8fc
commit
beddb6b78f
2 files changed
+7
-1
No files matched your search
@@ -9,6 +9,7 @@
|
||||
import { keys } from "#lib/keys.svelte.js";
|
||||
import { period, rangeFromUrl } from "#lib/period.svelte.js";
|
||||
import { session } from "#lib/session.svelte.js";
|
||||
import { ui } from "#lib/ui.svelte.js";
|
||||
import { goto } from "$app/navigation";
|
||||
import { page } from "$app/state";
|
||||
|
||||
@@ -23,6 +24,7 @@
|
||||
await goto(back, { replace: true });
|
||||
}
|
||||
period.init(session.viewRange, page.url);
|
||||
ui.quickEntry = page.url.searchParams.has("quick");
|
||||
period.loadFirst().catch(() => undefined);
|
||||
} catch (error) {
|
||||
session.failed = error instanceof Error ? error.message : String(error);
|
||||
@@ -43,12 +45,15 @@
|
||||
return;
|
||||
}
|
||||
lastHref = url.href;
|
||||
const clean = !url.searchParams.has("ffui");
|
||||
const clean = !(
|
||||
url.searchParams.has("ffui") || url.searchParams.has("quick")
|
||||
);
|
||||
if (clean && fromUrl?.start === start && fromUrl?.end === end) {
|
||||
return;
|
||||
}
|
||||
const next = new URL(url.href);
|
||||
next.searchParams.delete("ffui");
|
||||
next.searchParams.delete("quick");
|
||||
next.searchParams.set("start", start);
|
||||
next.searchParams.set("end", end);
|
||||
lastHref = next.href;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
}
|
||||
],
|
||||
"shortcuts": [
|
||||
{ "name": "Quick entry", "url": "/?quick" },
|
||||
{ "name": "New expense", "url": "/transactions/create/withdrawal" },
|
||||
{ "name": "Transactions", "url": "/transactions/all" }
|
||||
]
|
||||
|
||||
Reference in new issue
Block a user