merge leftovers

This commit is contained in:
Dobromir Popov
2024-05-07 11:08:19 +03:00
parent 201399bc7a
commit 6a9debcf16
5 changed files with 32 additions and 21 deletions

View File

@ -216,24 +216,15 @@ function PwaManager() {
{isPWAInstalled && <p>App is installed!</p>} {isPWAInstalled && <p>App is installed!</p>}
{isStandAlone && <p>PWA App</p>} {isStandAlone && <p>PWA App</p>}
<button <button
onClick={subscribeToNotifications} onClick={isSubscribed ? unsubscribeFromNotifications : subscribeToNotifications}
disabled={isSubscribed} disabled={false} // Since the button itself acts as a toggle, the disabled attribute might not be needed
className={`text-xs py-1 px-2 rounded-full focus:outline-none transition duration-150 ease-in-out ${isSubscribed ? 'cursor-not-allowed bg-gray-300 text-gray-500' : 'bg-green-500 hover:bg-green-700 text-white' className={`text-xs py-1 px-2 rounded-full focus:outline-none transition duration-150 ease-in-out ${isSubscribed ? 'bg-red-500 hover:bg-red-700 text-white' : 'bg-green-500 hover:bg-green-700 text-white'
}`} }`}
> >
Subscribe to Notifications {isSubscribed ? 'Unsubscribe from Notifications' : 'Subscribe to Notifications'}
</button>
<button
onClick={unsubscribeFromNotifications}
disabled={!isSubscribed}
className={`text-xs py-1 px-2 rounded-full focus:outline-none transition duration-150 ease-in-out ${!isSubscribed ? 'cursor-not-allowed bg-gray-300 text-gray-500' : 'bg-red-500 hover:bg-red-700 text-white'
}`}
>
Unsubscribe from Notifications
</button> </button>
</div >
</div>
<div> <div>
<button <button
onClick={sendTestNotification} onClick={sendTestNotification}

View File

@ -18,7 +18,7 @@ module.exports = withPWA({
// !! WARN !! // !! WARN !!
ignoreBuildErrors: true, ignoreBuildErrors: true,
}, },
compress: false, compress: true,
pageExtensions: ['ts', 'tsx', 'md', 'mdx'], // Replace `jsx?` with `tsx?` pageExtensions: ['ts', 'tsx', 'md', 'mdx'], // Replace `jsx?` with `tsx?`
env: { env: {
env: process.env.APP_ENV, env: process.env.APP_ENV,
@ -52,7 +52,24 @@ module.exports = withPWA({
//config.productionBrowserSourceMaps = true; //config.productionBrowserSourceMaps = true;
// Enable source maps based on non-production environments // Enable source maps based on non-production environments
if (!dev) { if (!dev) {
config.devtool = 'source-map'; //config.devtool = 'source-map';
/* TypeError: Invalid character in header content ["Location"]
at ServerResponse.setHeader (node:_http_outgoing:655:3)
at _res.setHeader (D:\DEV\workspace\REPOS\git.d-popov.com\mwhitnessing\node_modules\next\dist\server\base-server.js:481:24)
at NodeNextResponse.setHeader (D:\DEV\workspace\REPOS\git.d-popov.com\mwhitnessing\node_modules\next\dist\server\base-http\node.js:74:19)
at NodeNextResponse.redirect (D:\DEV\workspace\REPOS\git.d-popov.com\mwhitnessing\node_modules\next\dist\server\base-http\index.js:43:14)
at handleRedirect (D:\DEV\workspace\REPOS\git.d-popov.com\mwhitnessing\node_modules\next\dist\server\base-server.js:1208:17)
at DevServer.renderToResponseWithComponentsImpl (D:\DEV\workspace\REPOS\git.d-popov.com\mwhitnessing\node_modules\next\dist\server\base-server.js:1666:23)
at async DevServer.renderPageComponent (D:\DEV\workspace\REPOS\git.d-popov.com\mwhitnessing\node_modules\next\dist\server\base-server.js:1856:24)
at async DevServer.renderToResponseImpl (D:\DEV\workspace\REPOS\git.d-popov.com\mwhitnessing\node_modules\next\dist\server\base-server.js:1894:32)
at async DevServer.pipeImpl (D:\DEV\workspace\REPOS\git.d-popov.com\mwhitnessing\node_modules\next\dist\server\base-server.js:911:25)
at async NextNodeServer.handleCatchallRenderRequest (D:\DEV\workspace\REPOS\git.d-popov.com\mwhitnessing\node_modules\next\dist\server\next-server.js:271:17)
at async DevServer.handleRequestImpl (D:\DEV\workspace\REPOS\git.d-popov.com\mwhitnessing\node_modules\next\dist\server\base-server.js:807:17)
at async D:\DEV\workspace\REPOS\git.d-popov.com\mwhitnessing\node_modules\next\dist\server\dev\next-dev-server.js:331:20
at async Span.traceAsyncFn (D:\DEV\workspace\REPOS\git.d-popov.com\mwhitnessing\node_modules\next\dist\trace\trace.js:151:20)
at async DevServer.handleRequest (D:\DEV\workspace\REPOS\git.d-popov.com\mwhitnessing\node_modules\next\dist\server\dev\next-dev-server.js:328:24) {
code: 'ERR_INVALID_CHAR',
page: '/cart/publishers/edit/react_devtools_backend_compact.js.map' */
} }
// Add custom fallbacks // Add custom fallbacks
config.resolve.fallback = { ...config.resolve.fallback, fs: false }; config.resolve.fallback = { ...config.resolve.fallback, fs: false };

View File

@ -1,8 +1,8 @@
{ {
"name": "pwwa", "name": "smws",
"version": "1.2.2", "version": "1.2.4",
"private": true, "private": true,
"description": "JW PW Web App", "description": "SMWS | ССОМ | Специално Свидетелстване София",
"repository": "http://git.d-popov.com/popov/next-cart-app.git", "repository": "http://git.d-popov.com/popov/next-cart-app.git",
"bugs": { "bugs": {
"url": "https://git.d-popov.com/popov/next-cart-app/issues" "url": "https://git.d-popov.com/popov/next-cart-app/issues"
@ -119,4 +119,4 @@
"depcheck": "^1.4.7", "depcheck": "^1.4.7",
"prisma": "^5.13.0" "prisma": "^5.13.0"
} }
} }

View File

@ -120,6 +120,8 @@ nextApp
next(); next();
}); });
server.use("/favicon.ico", express.static("public/favicon.png")); server.use("/favicon.ico", express.static("public/favicon.png"));
//all static files are served from the public folder, including subfolders
server.use(express.static("public")); //ToDo: not working for some reason
// server.use("/robots.txt", express.static("styles/favicon_io/robots.txt")); // server.use("/robots.txt", express.static("styles/favicon_io/robots.txt"));
// server.use("/sitemap.xml", express.static("styles/favicon_io/sitemap.xml")); // server.use("/sitemap.xml", express.static("styles/favicon_io/sitemap.xml"));

View File

@ -24,7 +24,8 @@ self.addEventListener('push', function (event) {
event.waitUntil( event.waitUntil(
registration.showNotification(data.title, { registration.showNotification(data.title, {
body: data.message, body: data.message,
icon: '/icons/android-chrome-192x192.png' icon: '/favicon.ico',
actions: data.actions,
}) })
) )
}) })