From 170936a96ef9b59ac8a95d0201c34ef6d9438644 Mon Sep 17 00:00:00 2001 From: Yorun <547747006@qq.com> Date: Fri, 12 May 2023 18:47:41 +0800 Subject: [PATCH 1/2] fix: the theme-color selector --- app/components/home.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/components/home.tsx b/app/components/home.tsx index 4c3d0a64..6b34a5a1 100644 --- a/app/components/home.tsx +++ b/app/components/home.tsx @@ -64,17 +64,17 @@ export function useSwitchTheme() { } const metaDescriptionDark = document.querySelector( - 'meta[name="theme-color"][media]', + 'meta[name="theme-color"][media*="dark"]', ); const metaDescriptionLight = document.querySelector( - 'meta[name="theme-color"]:not([media])', + 'meta[name="theme-color"][media*="light"]', ); if (config.theme === "auto") { metaDescriptionDark?.setAttribute("content", "#151515"); metaDescriptionLight?.setAttribute("content", "#fafafa"); } else { - const themeColor = getCSSVar("--themeColor"); + const themeColor = getCSSVar("--theme-color"); metaDescriptionDark?.setAttribute("content", themeColor); metaDescriptionLight?.setAttribute("content", themeColor); } From dd5604f5d9d21a5e10f9d4609072d7f118463072 Mon Sep 17 00:00:00 2001 From: Yorun <547747006@qq.com> Date: Fri, 12 May 2023 19:23:49 +0800 Subject: [PATCH 2/2] style: move nextjs supported meta tags to metadata --- app/layout.tsx | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/app/layout.tsx b/app/layout.tsx index f2e765ae..d08f87e4 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -9,11 +9,19 @@ const buildConfig = getBuildConfig(); export const metadata = { title: "ChatGPT Next Web", description: "Your personal ChatGPT Chat Bot.", + viewport: { + width: "device-width", + initialScale: 1, + maximumScale: 1, + }, + themeColor: [ + { media: "(prefers-color-scheme: light)", color: "#fafafa" }, + { media: "(prefers-color-scheme: dark)", color: "#151515" }, + ], appleWebApp: { title: "ChatGPT Next Web", statusBarStyle: "default", }, - viewport: "width=device-width, initial-scale=1, maximum-scale=1", }; export default function RootLayout({ @@ -24,22 +32,12 @@ export default function RootLayout({ return (
- -