diff --git a/components/PwaManager.tsx b/components/PwaManager.tsx index 623fd17..a7e3f5d 100644 --- a/components/PwaManager.tsx +++ b/components/PwaManager.tsx @@ -201,6 +201,42 @@ function PwaManager() { }); }; + async function sendTestReminder(event: MouseEvent): Promise { + event.preventDefault(); + if (!subscription) { + console.error('Web push not subscribed'); + return; + } + + await fetch('/api/notify', { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ broadcast: true, message: 'Моля, въведете вашите предпочитания за юни до 25-ти май.' }) + }); + } + + async function sendTestCoverMe(event: MouseEvent): Promise { + event.preventDefault(); + if (!subscription) { + console.error('Web push not subscribed'); + return; + } + + await fetch('/api/notify', { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ + broadcast: true, message: "Брат ТЕСТ търси заместник за 24-ти май от 10:00 ч. Можеш ли да го покриеш?", + //use fontawesome icons for actions + actions: [{ action: 'covermeaccepted', title: 'Да ', icon: '✅' }] + }) + }); + } + return ( <>
@@ -216,24 +252,12 @@ function PwaManager() { {isPWAInstalled &&

App is installed!

} {isStandAlone &&

PWA App

} - - - -
+
+ + {notificationPermission !== "granted" && (