Skip to content

Commit

Permalink
Add PWA app shortcuts
Browse files Browse the repository at this point in the history
  • Loading branch information
jlucaspains committed Nov 19, 2023
1 parent 9a37c52 commit 500588c
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 2 deletions.
Binary file modified public/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/favicon.ico
Binary file not shown.
Binary file added public/shortcut-add-manual.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/shortcut-add-scan.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/shortcut-add-url.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 9 additions & 1 deletion src/components/TopBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ const canGoBack = ref(false);
router.afterEach((to) => {
canGoBack.value = to.path !== "/";
});
function goBack() {
if (router.currentRoute.value.query?.fromShortcut == "1") {
router.replace("/");
} else {
router.back();
}
}
</script>

<template>
Expand Down Expand Up @@ -47,7 +55,7 @@ router.afterEach((to) => {
focus-visible:ring-opacity-75
"
v-show="canGoBack"
@click="$router.back()"
@click="goBack()"
>
<svg
class="h-6 w-6 text-white"
Expand Down
25 changes: 24 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default defineConfig({
includeAssets: ['favicon.svg', 'favicon.ico', 'robots.txt', 'apple-touch-icon.png'],
devOptions: {
enabled: true
/* other options */
/* other options */
},
registerType: 'autoUpdate',
manifest: {
Expand All @@ -31,6 +31,29 @@ export default defineConfig({
sizes: '512x512',
type: 'image/png',
}
],
"shortcuts": [
{
"name": "New Manual Recipe",
"short_name": "New Manual Recipe",
"description": "Create a new recipe manually",
"url": "/#/recipe/0/edit?fromShortcut=1",
"icons": [{ "src": "/shortcut-add-manual.png", "sizes": "192x192" }]
},
{
"name": "Import From URL",
"short_name": "New Recipe",
"description": "Create a new recipe from a URL",
"url": "/#/recipe/0/edit?import=1&fromShortcut=1",
"icons": [{ "src": "/shortcut-add-url.png", "sizes": "192x192" }]
},
{
"name": "Scan a Recipe",
"short_name": "New Recipe",
"description": "Create a new recipe by scanning from an image",
"url": "/#/recipe/import-ocr?fromShortcut=1",
"icons": [{ "src": "/shortcut-add-scan.png", "sizes": "192x192" }]
}
]
}
}),
Expand Down

0 comments on commit 500588c

Please sign in to comment.