From ecb1fed5db6a54b357a279e9e7b5c691848c065d Mon Sep 17 00:00:00 2001 From: Jason Date: Thu, 9 Apr 2026 16:20:22 +0800 Subject: [PATCH] feat(common-config): add guide info and empty state to common config editor Add an informational alert block at the top of the common config snippet editor modal (Claude/Codex/Gemini) explaining what the feature is, why it exists, and how to use it. Also add an empty state prompt when no snippet has been extracted yet, guiding users to click "Extract from Editor". Includes i18n support for zh/en/ja. --- .../forms/CodexCommonConfigModal.tsx | 30 ++++++++++++++-- .../providers/forms/CommonConfigEditor.tsx | 35 +++++++++++++++---- .../forms/GeminiCommonConfigModal.tsx | 32 +++++++++++++++-- src/i18n/locales/en.json | 9 +++++ src/i18n/locales/ja.json | 9 +++++ src/i18n/locales/zh.json | 9 +++++ 6 files changed, 114 insertions(+), 10 deletions(-) diff --git a/src/components/providers/forms/CodexCommonConfigModal.tsx b/src/components/providers/forms/CodexCommonConfigModal.tsx index 67204ff59..0c0207d91 100644 --- a/src/components/providers/forms/CodexCommonConfigModal.tsx +++ b/src/components/providers/forms/CodexCommonConfigModal.tsx @@ -1,5 +1,5 @@ import React, { useEffect, useState } from "react"; -import { Save, Download, Loader2 } from "lucide-react"; +import { Save, Download, Loader2, Package } from "lucide-react"; import { useTranslation } from "react-i18next"; import { FullScreenPanel } from "@/components/common/FullScreenPanel"; import { Button } from "@/components/ui/button"; @@ -100,9 +100,35 @@ export const CodexCommonConfigModal: React.FC = ({ } >
-

+

+

+ {t("commonConfig.guideTitle")} +

+

+ {t("commonConfig.guidePurpose")} +

+

+ {t("commonConfig.guideUsage")} +

+

+ {t("commonConfig.guideReExtract")} +

+

+ {t("commonConfig.guideReassurance")} +

+
+

{t("codexConfig.commonConfigHint")}

+ {(!draftValue || draftValue.trim() === "") && ( +
+ +

+ {t("commonConfig.emptyTitle")} +

+

{t("commonConfig.emptyHint")}

+
+ )}
-

- {t("claudeConfig.commonConfigHint", { - defaultValue: "通用配置片段将合并到所有启用它的供应商配置中", - })} -

+
+

+ {t("commonConfig.guideTitle")} +

+

+ {t("commonConfig.guidePurpose")} +

+

+ {t("commonConfig.guideUsage")} +

+

+ {t("commonConfig.guideReExtract")} +

+

+ {t("commonConfig.guideReassurance")} +

+
+ {(!commonConfigSnippet || + commonConfigSnippet.trim() === "" || + commonConfigSnippet.trim() === "{}") && ( +
+ +

+ {t("commonConfig.emptyTitle")} +

+

{t("commonConfig.emptyHint")}

+
+ )}
-

+

+

+ {t("commonConfig.guideTitle")} +

+

+ {t("commonConfig.guidePurpose")} +

+

+ {t("commonConfig.guideUsage")} +

+

+ {t("commonConfig.guideReExtract")} +

+

+ {t("commonConfig.guideReassurance")} +

+
+

{t("geminiConfig.commonConfigHint", { defaultValue: "该片段会写入 Gemini 的 .env(不允许包含 GOOGLE_GEMINI_BASE_URL、GEMINI_API_KEY)", })}

+ {(!draftValue || + draftValue.trim() === "" || + draftValue.trim() === "{}") && ( +
+ +

+ {t("commonConfig.emptyTitle")} +

+

{t("commonConfig.emptyHint")}

+
+ )}