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 { keys } from "#lib/keys.svelte.js";
|
||||||
import { period, rangeFromUrl } from "#lib/period.svelte.js";
|
import { period, rangeFromUrl } from "#lib/period.svelte.js";
|
||||||
import { session } from "#lib/session.svelte.js";
|
import { session } from "#lib/session.svelte.js";
|
||||||
|
import { ui } from "#lib/ui.svelte.js";
|
||||||
import { goto } from "$app/navigation";
|
import { goto } from "$app/navigation";
|
||||||
import { page } from "$app/state";
|
import { page } from "$app/state";
|
||||||
|
|
||||||
@@ -23,6 +24,7 @@
|
|||||||
await goto(back, { replace: true });
|
await goto(back, { replace: true });
|
||||||
}
|
}
|
||||||
period.init(session.viewRange, page.url);
|
period.init(session.viewRange, page.url);
|
||||||
|
ui.quickEntry = page.url.searchParams.has("quick");
|
||||||
period.loadFirst().catch(() => undefined);
|
period.loadFirst().catch(() => undefined);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
session.failed = error instanceof Error ? error.message : String(error);
|
session.failed = error instanceof Error ? error.message : String(error);
|
||||||
@@ -43,12 +45,15 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
lastHref = url.href;
|
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) {
|
if (clean && fromUrl?.start === start && fromUrl?.end === end) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const next = new URL(url.href);
|
const next = new URL(url.href);
|
||||||
next.searchParams.delete("ffui");
|
next.searchParams.delete("ffui");
|
||||||
|
next.searchParams.delete("quick");
|
||||||
next.searchParams.set("start", start);
|
next.searchParams.set("start", start);
|
||||||
next.searchParams.set("end", end);
|
next.searchParams.set("end", end);
|
||||||
lastHref = next.href;
|
lastHref = next.href;
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"shortcuts": [
|
"shortcuts": [
|
||||||
|
{ "name": "Quick entry", "url": "/?quick" },
|
||||||
{ "name": "New expense", "url": "/transactions/create/withdrawal" },
|
{ "name": "New expense", "url": "/transactions/create/withdrawal" },
|
||||||
{ "name": "Transactions", "url": "/transactions/all" }
|
{ "name": "Transactions", "url": "/transactions/all" }
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in new issue
Block a user