From d03b30bc0028cee09e24aa84813ca0fbec6d3303 Mon Sep 17 00:00:00 2001
From: Julian Wachholz <julian@wachholz.ch>
Date: Thu, 4 Jul 2024 17:27:57 +0200
Subject: [PATCH] Add PWA shortcuts (#2980)

* Add PWA shortcuts

* Add release note
---
 .../public/shortcut-accounts.svg              |  3 ++
 .../public/shortcut-reports.svg               |  3 ++
 .../public/shortcut-transaction.svg           |  4 ++
 .../desktop-client/public/site.webmanifest    | 40 ++++++++++++++++++-
 upcoming-release-notes/2980.md                |  6 +++
 5 files changed, 55 insertions(+), 1 deletion(-)
 create mode 100644 packages/desktop-client/public/shortcut-accounts.svg
 create mode 100644 packages/desktop-client/public/shortcut-reports.svg
 create mode 100644 packages/desktop-client/public/shortcut-transaction.svg
 create mode 100644 upcoming-release-notes/2980.md

diff --git a/packages/desktop-client/public/shortcut-accounts.svg b/packages/desktop-client/public/shortcut-accounts.svg
new file mode 100644
index 000000000..e75012d68
--- /dev/null
+++ b/packages/desktop-client/public/shortcut-accounts.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
+  <path d="M1.857 7.612H.98a.98.98 0 0 0-.98.98v2.224c0 .449.184.857.51 1.163.612.551 1.816 1.49 3.735 2.368a.571.571 0 0 1 .306.346l.939 3.286a.484.484 0 0 0 .469.347h1.47a.479.479 0 0 0 .469-.367l.47-1.817a.262.262 0 0 1 .326-.183c.571.122 1.183.163 1.795.163.613 0 1.225-.061 1.796-.163.143-.02.286.06.327.183l.47 1.817a.502.502 0 0 0 .468.367h1.47a.484.484 0 0 0 .47-.347l1.224-4.245a.487.487 0 0 1 .122-.224c.919-.98 1.53-2.163 1.735-3.47h.49c.53 0 .959-.448.938-.979-.02-.51-.47-.918-.98-.918h-.448C18.06 4.673 14.632 2 10.489 2c-1.775 0-3.428.49-4.755 1.326-.591-.408-1.469-.734-2.693-.632-.49.04-.715.612-.388.959.408.429.796 1 .877 1.735L1.857 7.612Zm3.122.98a.862.862 0 0 1-.857-.858c0-.469.388-.857.857-.857.47 0 .858.388.858.857 0 .47-.388.858-.858.858Z" />
+</svg>
diff --git a/packages/desktop-client/public/shortcut-reports.svg b/packages/desktop-client/public/shortcut-reports.svg
new file mode 100644
index 000000000..f00ef8503
--- /dev/null
+++ b/packages/desktop-client/public/shortcut-reports.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
+  <path d="M19 18h-1v-8c0-.6-.4-1-1-1s-1 .4-1 1v8h-3V1c0-.6-.4-1-1-1s-1 .4-1 1v17H8V7c0-.6-.4-1-1-1s-1 .4-1 1v11H3V3c0-.6-.4-1-1-1s-1 .4-1 1v15c-.6 0-1 .4-1 1s.4 1 1 1h18c.6 0 1-.4 1-1s-.4-1-1-1z" />
+</svg>
diff --git a/packages/desktop-client/public/shortcut-transaction.svg b/packages/desktop-client/public/shortcut-transaction.svg
new file mode 100644
index 000000000..d6816f890
--- /dev/null
+++ b/packages/desktop-client/public/shortcut-transaction.svg
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
+  <path d="M23 11.5a1.5 1.5 0 0 1-1.5 1.5h-20a1.5 1.5 0 0 1 0-3h20a1.5 1.5 0 0 1 1.5 1.5Z" />
+  <path d="M11.5 23a1.5 1.5 0 0 1-1.5-1.5v-20a1.5 1.5 0 0 1 3 0v20a1.5 1.5 0 0 1-1.5 1.5Z" />
+</svg>
diff --git a/packages/desktop-client/public/site.webmanifest b/packages/desktop-client/public/site.webmanifest
index 53381d451..f104a4215 100644
--- a/packages/desktop-client/public/site.webmanifest
+++ b/packages/desktop-client/public/site.webmanifest
@@ -28,6 +28,44 @@
             "purpose": "maskable"
         }
     ],
+    "shortcuts": [
+        {
+            "name": "Add Transaction",
+            "short_name": "Add Transaction",
+            "description": "Add a new transaction",
+            "url": "/transactions/new",
+            "icons": [
+                {
+                    "src": "/shortcut-transaction.svg",
+                    "sizes": "150x150"
+                }
+            ]
+        },
+        {
+            "name": "Accounts",
+            "short_name": "Accounts",
+            "description": "View all accounts",
+            "url": "/accounts",
+            "icons": [
+                {
+                    "src": "/shortcut-accounts.svg",
+                    "sizes": "150x150"
+                }
+            ]
+        },
+        {
+            "name": "Reports",
+            "short_name": "Reports",
+            "description": "View reports",
+            "url": "/reports",
+            "icons": [
+                {
+                    "src": "/shortcut-reports.svg",
+                    "sizes": "150x150"
+                }
+            ]
+        }
+    ],
     "screenshots": [
         {
             "src": "/screenshot_wide.png",
@@ -43,7 +81,7 @@
             "type": "image/png",
             "sizes": "350x600"
         }
-    ], 
+    ],
     "theme_color": "#8812E1",
     "background_color": "#ffffff",
     "display": "standalone",
diff --git a/upcoming-release-notes/2980.md b/upcoming-release-notes/2980.md
new file mode 100644
index 000000000..4c2901faa
--- /dev/null
+++ b/upcoming-release-notes/2980.md
@@ -0,0 +1,6 @@
+---
+category: Enhancements
+authors: [julianwachholz]
+---
+
+Add PWA shortcut actions
-- 
GitLab