mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-04-08 15:10:34 +08:00
fix: show context-aware JSON editor hint and hide quick toggles for non-active providers
The hint text and ClaudeQuickToggles were misleading when editing non-current providers or creating new ones, since the editor only contains a config snippet rather than the full live settings.json.
This commit is contained in:
@@ -192,6 +192,7 @@ export function EditProviderDialog({
|
|||||||
onCancel={() => onOpenChange(false)}
|
onCancel={() => onOpenChange(false)}
|
||||||
initialData={initialData}
|
initialData={initialData}
|
||||||
showButtons={false}
|
showButtons={false}
|
||||||
|
isCurrent={liveSettings !== null}
|
||||||
/>
|
/>
|
||||||
</FullScreenPanel>
|
</FullScreenPanel>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ interface ProviderFormProps {
|
|||||||
iconColor?: string;
|
iconColor?: string;
|
||||||
};
|
};
|
||||||
showButtons?: boolean;
|
showButtons?: boolean;
|
||||||
|
isCurrent?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ProviderForm({
|
export function ProviderForm({
|
||||||
@@ -130,6 +131,7 @@ export function ProviderForm({
|
|||||||
onManageUniversalProviders,
|
onManageUniversalProviders,
|
||||||
initialData,
|
initialData,
|
||||||
showButtons = true,
|
showButtons = true,
|
||||||
|
isCurrent = false,
|
||||||
}: ProviderFormProps) {
|
}: ProviderFormProps) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const isEditMode = Boolean(initialData);
|
const isEditMode = Boolean(initialData);
|
||||||
@@ -1496,7 +1498,7 @@ export function ProviderForm({
|
|||||||
<Label htmlFor="settingsConfig">
|
<Label htmlFor="settingsConfig">
|
||||||
{t("claudeConfig.configLabel")}
|
{t("claudeConfig.configLabel")}
|
||||||
</Label>
|
</Label>
|
||||||
{isEditMode && (
|
{isEditMode && isCurrent && (
|
||||||
<ClaudeQuickToggles
|
<ClaudeQuickToggles
|
||||||
onPatchApplied={(patch) => {
|
onPatchApplied={(patch) => {
|
||||||
try {
|
try {
|
||||||
@@ -1527,7 +1529,7 @@ export function ProviderForm({
|
|||||||
language="json"
|
language="json"
|
||||||
/>
|
/>
|
||||||
<p className="text-xs text-muted-foreground">
|
<p className="text-xs text-muted-foreground">
|
||||||
{t("claudeConfig.fullSettingsHint")}
|
{t(isCurrent ? "claudeConfig.fullSettingsHint" : "claudeConfig.fragmentSettingsHint")}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
{settingsConfigErrorField}
|
{settingsConfigErrorField}
|
||||||
|
|||||||
@@ -52,6 +52,7 @@
|
|||||||
"claudeConfig": {
|
"claudeConfig": {
|
||||||
"configLabel": "Claude Code settings.json (JSON) *",
|
"configLabel": "Claude Code settings.json (JSON) *",
|
||||||
"fullSettingsHint": "Full Claude Code settings.json content",
|
"fullSettingsHint": "Full Claude Code settings.json content",
|
||||||
|
"fragmentSettingsHint": "Config snippet for this provider; will be written to settings.json when activated",
|
||||||
"hideAttribution": "Hide AI Attribution",
|
"hideAttribution": "Hide AI Attribution",
|
||||||
"alwaysThinking": "Extended Thinking",
|
"alwaysThinking": "Extended Thinking",
|
||||||
"enableTeammates": "Teammates Mode"
|
"enableTeammates": "Teammates Mode"
|
||||||
|
|||||||
@@ -52,6 +52,7 @@
|
|||||||
"claudeConfig": {
|
"claudeConfig": {
|
||||||
"configLabel": "Claude Code settings.json (JSON) *",
|
"configLabel": "Claude Code settings.json (JSON) *",
|
||||||
"fullSettingsHint": "Claude Code の settings.json 全文",
|
"fullSettingsHint": "Claude Code の settings.json 全文",
|
||||||
|
"fragmentSettingsHint": "このプロバイダーの設定スニペット。有効化時に settings.json に書き込まれます",
|
||||||
"hideAttribution": "AI署名を非表示",
|
"hideAttribution": "AI署名を非表示",
|
||||||
"alwaysThinking": "拡張思考",
|
"alwaysThinking": "拡張思考",
|
||||||
"enableTeammates": "Teammates モード"
|
"enableTeammates": "Teammates モード"
|
||||||
|
|||||||
@@ -52,6 +52,7 @@
|
|||||||
"claudeConfig": {
|
"claudeConfig": {
|
||||||
"configLabel": "Claude Code 配置 (JSON) *",
|
"configLabel": "Claude Code 配置 (JSON) *",
|
||||||
"fullSettingsHint": "完整的 Claude Code settings.json 配置内容",
|
"fullSettingsHint": "完整的 Claude Code settings.json 配置内容",
|
||||||
|
"fragmentSettingsHint": "此供应商的配置片段,激活后将写入 settings.json",
|
||||||
"hideAttribution": "隐藏 AI 署名",
|
"hideAttribution": "隐藏 AI 署名",
|
||||||
"alwaysThinking": "扩展思考",
|
"alwaysThinking": "扩展思考",
|
||||||
"enableTeammates": "Teammates 模式"
|
"enableTeammates": "Teammates 模式"
|
||||||
|
|||||||
Reference in New Issue
Block a user