From 6d1116f44d89333fc40eac2bc29b30845d4a5c46 Mon Sep 17 00:00:00 2001 From: "J. Lewis" <6710419+lewxdev@users.noreply.github.com> Date: Tue, 27 Aug 2024 16:53:20 -0400 Subject: [PATCH] refactor: use dynamifest --- app/layout.tsx | 21 +++++++++------------ app/manifest.ts | 29 +++++++++++++++++++++++++++++ app/utils/const.ts | 6 ++++++ public/manifest.json | 26 -------------------------- 4 files changed, 44 insertions(+), 38 deletions(-) create mode 100644 app/manifest.ts create mode 100644 app/utils/const.ts delete mode 100644 public/manifest.json diff --git a/app/layout.tsx b/app/layout.tsx index ba626a3..918d22e 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -3,39 +3,36 @@ import { GeistSans } from "geist/font/sans"; import { ThemeProvider } from "next-themes"; import { Header } from "@/components/header"; import { SocketProvider } from "@/components/socket-provider"; +import { app } from "@/utils/const"; import "@/globals.css"; -const title = "mmmines!"; -const description = "an endless, massive multiplayer minesweeper game"; - export const metadata: Metadata = { - title, - description, + title: app.NAME, + description: app.DESCRIPTION, icons: { icon: [ { url: "/icon-light.svg" }, { url: "/icon-dark.svg", media: "(prefers-color-scheme: dark)" }, ], }, - manifest: "/manifest.json", appleWebApp: { capable: true, + title: app.NAME, statusBarStyle: "default", - title, }, metadataBase: new URL(process.env["BASE_URL"]!), openGraph: { - title, - description, - siteName: title, - url: "https://mmmines.fly.dev", + title: app.NAME, + description: app.DESCRIPTION, + siteName: app.NAME, + url: app.URL, locale: "en_US", type: "website", }, }; export const viewport: Viewport = { - themeColor: "#020617", + themeColor: app.THEME_COLOR, }; export default function RootLayout(props: Readonly) { diff --git a/app/manifest.ts b/app/manifest.ts new file mode 100644 index 0000000..47d847d --- /dev/null +++ b/app/manifest.ts @@ -0,0 +1,29 @@ +import type { MetadataRoute } from "next"; +import { app } from "./utils/const"; + +export default function manifest(): MetadataRoute.Manifest { + return { + name: app.NAME, + short_name: app.NAME, + theme_color: app.THEME_COLOR, + background_color: app.THEME_COLOR, + display: "standalone", + orientation: "any", + scope: "/", + start_url: "/", + icons: [ + { + src: "icon-maskable.svg", + sizes: "any", + type: "image/svg+xml", + purpose: "any maskable" as "maskable", + }, + { + src: "icon-monochrome.svg", + sizes: "any", + type: "image/svg+xml", + purpose: "monochrome", + }, + ], + }; +} diff --git a/app/utils/const.ts b/app/utils/const.ts new file mode 100644 index 0000000..95a3be9 --- /dev/null +++ b/app/utils/const.ts @@ -0,0 +1,6 @@ +export const app = { + NAME: "mmmines!", + DESCRIPTION: "an endless, massive multiplayer minesweeper game", + URL: "https://mmmines.fly.dev", + THEME_COLOR: "#020617", +}; diff --git a/public/manifest.json b/public/manifest.json deleted file mode 100644 index ae708de..0000000 --- a/public/manifest.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "$schema": "https://json.schemastore.org/web-manifest-combined.json", - - "name": "mmmines", - "short_name": "mmmines", - "theme_color": "#020617", - "background_color": "#020617", - "display": "standalone", - "orientation": "any", - "scope": "/", - "start_url": "/", - "icons": [ - { - "src": "icon-maskable.svg", - "sizes": "any", - "type": "image/svg+xml", - "purpose": "any maskable" - }, - { - "src": "icon-monochrome.svg", - "sizes": "any", - "type": "image/svg+xml", - "purpose": "monochrome" - } - ] -}