Add pwa
Some checks failed
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is failing

This commit is contained in:
Kasper Juul Hermansen 2021-11-15 14:12:18 +01:00
parent ef91dd3b34
commit fc6a5eef3e
Signed by: kjuulh
GPG Key ID: 0F95C140730F2F23
19 changed files with 1832 additions and 30 deletions

View File

@ -1,3 +1,20 @@
module.exports = { const withPWA = require("next-pwa");
const runtimeCaching = require("next-pwa/cache");
const { PHASE_DEVELOPMENT_SERVER } = require("next/constants");
module.exports = (phase, { defaultConfig }) => {
if (phase === PHASE_DEVELOPMENT_SERVER) {
return {
reactStrictMode: true, reactStrictMode: true,
};
} }
return withPWA({
reactStrictMode: true,
pwa: {
dest: "public",
runtimeCaching,
},
});
};

View File

@ -10,6 +10,7 @@
"dependencies": { "dependencies": {
"@microsoft/signalr": "^6.0.0", "@microsoft/signalr": "^6.0.0",
"next": "12.0.3", "next": "12.0.3",
"next-pwa": "^5.4.0",
"react": "17.0.2", "react": "17.0.2",
"react-dom": "17.0.2", "react-dom": "17.0.2",
"tailwindcss": "^2.2.19" "tailwindcss": "^2.2.19"

View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 761 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@ -0,0 +1,53 @@
{
"name": "Todo",
"short_name": "Todo",
"theme_color": "#e5a00d",
"background_color": "#282A2D",
"display": "fullscreen",
"orientation": "portrait",
"scope": "/",
"start_url": "/",
"icons": [
{
"src": "icons/icon-72x72.png",
"sizes": "72x72",
"type": "image/png"
},
{
"src": "icons/icon-96x96.png",
"sizes": "96x96",
"type": "image/png"
},
{
"src": "icons/icon-128x128.png",
"sizes": "128x128",
"type": "image/png"
},
{
"src": "icons/icon-144x144.png",
"sizes": "144x144",
"type": "image/png"
},
{
"src": "icons/icon-152x152.png",
"sizes": "152x152",
"type": "image/png"
},
{
"src": "icons/icon-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "icons/icon-384x384.png",
"sizes": "384x384",
"type": "image/png"
},
{
"src": "icons/icon-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"splash_pages": null
}

1
src/client/public/sw.js Normal file

File diff suppressed because one or more lines are too long

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

File diff suppressed because one or more lines are too long

View File

@ -1,11 +1,42 @@
import { AppProps } from "next/app"; import { AppProps } from "next/app";
import Head from "next/head";
import "@src/styles/tailwind.css"; import "@src/styles/tailwind.css";
import SocketProvider from "@src/presentation/contexts/SocketContext"; import SocketProvider from "@src/presentation/contexts/SocketContext";
const MyApp = ({ Component, pageProps }: AppProps) => ( const MyApp = ({ Component, pageProps }: AppProps) => (
<>
<Head>
<meta charSet="utf-8" />
<meta httpEquiv="X-UA-Compatible" content="IE=edge" />
<meta
name="viewport"
content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"
/>
<meta name="description" content="Description" />
<meta name="keywords" content="Keywords" />
<title>Todo</title>
<link rel="manifest" href="/manifest.json" />
<link
href="/icons/favicon-16x16.png"
rel="icon"
type="image/png"
sizes="16x16"
/>
<link
href="/icons/favicon-32x32.png"
rel="icon"
type="image/png"
sizes="32x32"
/>
<link rel="apple-touch-icon" href="/apple-icon.png"></link>
<meta name="theme-color" content="#317EFB" />
</Head>
<SocketProvider> <SocketProvider>
<Component {...pageProps} /> <Component {...pageProps} />
</SocketProvider> </SocketProvider>
</>
); );
export default MyApp; export default MyApp;

File diff suppressed because it is too large Load Diff