Skip to content

Commit

Permalink
feat: PWA compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-wang0 committed Jan 1, 2024
1 parent 3cdd516 commit 308f9fe
Show file tree
Hide file tree
Showing 10 changed files with 3,133 additions and 350 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
# IDE
.idea

# PWA files
**/public/sw.js
**/public/workbox-*.js
**/public/worker-*.js
**/public/sw.js.map
**/public/workbox-*.js.map
**/public/worker-*.js.map

# dependencies
/node_modules
/.pnp
Expand Down
1 change: 1 addition & 0 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export const metadata: Metadata = {
locale: "en_US",
type: "website",
},
// manifest: "/manifest",
};

export default function RootLayout({
Expand Down
45 changes: 45 additions & 0 deletions app/manifest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { MetadataRoute } from "next";

export default function manifest(): MetadataRoute.Manifest {
return {
theme_color: "#7e55ff",
background_color: "#ffffff",
display: "standalone",
scope: "/",
start_url: "/",
name: "GE-Z",
short_name: "GE-Z",
icons: [
{
src: "icons/icon-192x192.png",
sizes: "192x192",
type: "image/png",
purpose: "any",
},
{
src: "icons/icon-256x256.png",
sizes: "256x256",
type: "image/png",
purpose: "any",
},
{
src: "icons/icon-384x384.png",
sizes: "384x384",
type: "image/png",
purpose: "any",
},
{
src: "icons/icon-512x512.png",
sizes: "512x512",
type: "image/png",
purpose: "any",
},
{
src: "icons/icon-512x512.png",
sizes: "512x512",
type: "image/png",
purpose: "maskable",
},
],
};
}
13 changes: 11 additions & 2 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
/** @type {import('next').NextConfig} */
const nextConfig = {}

module.exports = nextConfig
const runtimeCaching = require("next-pwa/cache");
const withPWA = require('next-pwa')({
dest: 'public',
register: true,
skipWaiting: true,
runtimeCaching
})

module.exports = withPWA({
reactStrictMode: false
})
3,415 changes: 3,067 additions & 348 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"clsx": "^2.0.0",
"lucide-react": "^0.303.0",
"next": "^14.0.2",
"next-pwa": "^5.6.0",
"react": "^18.2.0",
"react-datepicker": "^4.25.0",
"react-dom": "^18.2.0",
Expand Down
Binary file added public/icons/icon-192x192.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/icons/icon-256x256.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/icons/icon-384x384.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/icons/icon-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 308f9fe

Please sign in to comment.