From 30ff915e9db9fa766e871118ff36f77818ec0d9c Mon Sep 17 00:00:00 2001 From: Yorun <547747006@qq.com> Date: Mon, 3 Apr 2023 16:24:59 +0000 Subject: [PATCH 1/2] fix: add media query to theme-color, fix auto theme not updating theme-color --- app/components/home.tsx | 22 +++++++++++++++++----- app/layout.tsx | 7 ++++++- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/app/components/home.tsx b/app/components/home.tsx index cbb5dbfc6..66f86348f 100644 --- a/app/components/home.tsx +++ b/app/components/home.tsx @@ -52,11 +52,23 @@ function useSwitchTheme() { document.body.classList.add("light"); } - const themeColor = getComputedStyle(document.body) - .getPropertyValue("--theme-color") - .trim(); - const metaDescription = document.querySelector('meta[name="theme-color"]'); - metaDescription?.setAttribute("content", themeColor); + const metaDescriptionDark = document.querySelector( + 'meta[name="theme-color"][media]', + ); + const metaDescriptionLight = document.querySelector( + 'meta[name="theme-color"]:not([media])', + ); + + if (config.theme === "auto") { + metaDescriptionDark?.setAttribute("content", "#151515"); + metaDescriptionLight?.setAttribute("content", "#fafafa"); + } else { + const themeColor = getComputedStyle(document.body) + .getPropertyValue("--theme-color") + .trim(); + metaDescriptionDark?.setAttribute("content", themeColor); + metaDescriptionLight?.setAttribute("content", themeColor); + } }, [config.theme]); } diff --git a/app/layout.tsx b/app/layout.tsx index 6b6999f83..49a6d644d 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -21,7 +21,7 @@ export const metadata = { description: "Your personal ChatGPT Chat Bot.", appleWebApp: { title: "ChatGPT Next Web", - statusBarStyle: "black-translucent", + statusBarStyle: "default", }, themeColor: "#fafafa", }; @@ -53,6 +53,11 @@ export default function RootLayout({ name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" /> + From 47f055872eea825bd170f83f719952cc687e6338 Mon Sep 17 00:00:00 2001 From: kakawanyifan Date: Tue, 4 Apr 2023 13:27:50 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=AE=BF=E9=97=AE=E6=94=B9=E6=88=90?= =?UTF-8?q?=E6=8E=88=E6=9D=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/locales/cn.ts | 10 +++++----- app/locales/tw.ts | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/locales/cn.ts b/app/locales/cn.ts index 49bcce235..b021c8497 100644 --- a/app/locales/cn.ts +++ b/app/locales/cn.ts @@ -3,7 +3,7 @@ import { SubmitKey } from "../store/app"; const cn = { WIP: "该功能仍在开发中……", Error: { - Unauthorized: "现在是未授权状态,请在设置页填写授权码。", + Unauthorized: "现在是未授权状态,请在设置页输入授权码。", }, ChatItem: { ChatItemCount: (count: number) => `${count} 条对话`, @@ -99,7 +99,7 @@ const cn = { }, Token: { Title: "API Key", - SubTitle: "使用自己的 Key 可绕过受控访问限制", + SubTitle: "使用自己的 Key 可绕过授权访问限制", Placeholder: "OpenAI API Key", }, Usage: { @@ -112,9 +112,9 @@ const cn = { NoAccess: "输入API Key查看余额", }, AccessCode: { - Title: "访问码", - SubTitle: "现在是受控访问状态", - Placeholder: "请输入访问码", + Title: "授权码", + SubTitle: "现在是未授权访问状态", + Placeholder: "请输入授权码", }, Model: "模型 (model)", Temperature: { diff --git a/app/locales/tw.ts b/app/locales/tw.ts index fff2f15dc..f27001971 100644 --- a/app/locales/tw.ts +++ b/app/locales/tw.ts @@ -4,7 +4,7 @@ import type { LocaleType } from "./index"; const tw: LocaleType = { WIP: "該功能仍在開發中……", Error: { - Unauthorized: "目前您的狀態是未授權,請前往設定頁面填寫授權碼。", + Unauthorized: "目前您的狀態是未授權,請前往設定頁面輸入授權碼。", }, ChatItem: { ChatItemCount: (count: number) => `${count} 條對話`, @@ -99,7 +99,7 @@ const tw: LocaleType = { }, Token: { Title: "API Key", - SubTitle: "使用自己的 Key 可規避受控訪問限制", + SubTitle: "使用自己的 Key 可規避授權訪問限制", Placeholder: "OpenAI API Key", }, Usage: { @@ -112,9 +112,9 @@ const tw: LocaleType = { NoAccess: "輸入API Key查看餘額", }, AccessCode: { - Title: "訪問碼", - SubTitle: "現在是受控訪問狀態", - Placeholder: "請輸入訪問碼", + Title: "授權碼", + SubTitle: "現在是未授權訪問狀態", + Placeholder: "請輸入授權碼", }, Model: "模型 (model)", Temperature: {