mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-24 12:44:18 +08:00
feat(profiles): add setting to toggle project switcher on main page
Add a show/hide toggle for the header project profile switcher under the Homepage Display section in settings. Defaults to visible so existing users keep the current behavior.
This commit is contained in:
@@ -374,6 +374,9 @@ pub struct AppSettings {
|
||||
/// Whether to show the failover toggle independently on the main page
|
||||
#[serde(default)]
|
||||
pub enable_failover_toggle: bool,
|
||||
/// Whether to show the project profile switcher on the main page header
|
||||
#[serde(default = "default_show_profile_switcher")]
|
||||
pub show_profile_switcher: bool,
|
||||
/// Keep Codex ChatGPT login material in auth.json when switching to third-party providers.
|
||||
/// Opt-in: defaults to false so third-party switches cleanly overwrite auth.json.
|
||||
#[serde(default)]
|
||||
@@ -490,6 +493,10 @@ fn default_minimize_to_tray_on_close() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn default_show_profile_switcher() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
impl Default for AppSettings {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
@@ -506,6 +513,7 @@ impl Default for AppSettings {
|
||||
usage_dashboard_refresh_interval_ms: None,
|
||||
stream_check_confirmed: None,
|
||||
enable_failover_toggle: false,
|
||||
show_profile_switcher: true,
|
||||
preserve_codex_official_auth_on_switch: false,
|
||||
unify_codex_session_history: false,
|
||||
unify_codex_migrate_existing: None,
|
||||
|
||||
+9
-8
@@ -1263,14 +1263,15 @@ function App() {
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{currentView === "providers" && (
|
||||
<div
|
||||
className="flex shrink-0 items-center"
|
||||
style={{ WebkitAppRegion: "no-drag" } as any}
|
||||
>
|
||||
<ProfileSwitcher activeApp={activeApp} />
|
||||
</div>
|
||||
)}
|
||||
{currentView === "providers" &&
|
||||
(settingsData?.showProfileSwitcher ?? true) && (
|
||||
<div
|
||||
className="flex shrink-0 items-center"
|
||||
style={{ WebkitAppRegion: "no-drag" } as any}
|
||||
>
|
||||
<ProfileSwitcher activeApp={activeApp} />
|
||||
</div>
|
||||
)}
|
||||
<div
|
||||
ref={toolbarRef}
|
||||
className="flex flex-1 min-w-0 overflow-x-hidden items-center py-4 pr-2"
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { FolderOpen } from "lucide-react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { ToggleRow } from "@/components/ui/toggle-row";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { ProviderIcon } from "@/components/ProviderIcon";
|
||||
import type { SettingsFormState } from "@/hooks/useSettings";
|
||||
@@ -91,6 +93,13 @@ export function AppVisibilitySettings({
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
<ToggleRow
|
||||
icon={<FolderOpen className="h-4 w-4 text-emerald-500" />}
|
||||
title={t("settings.appVisibility.showProfileSwitcher")}
|
||||
description={t("settings.appVisibility.showProfileSwitcherDescription")}
|
||||
checked={settings.showProfileSwitcher ?? true}
|
||||
onCheckedChange={(value) => onChange({ showProfileSwitcher: value })}
|
||||
/>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -697,7 +697,9 @@
|
||||
"claudeDesc": "Anthropic Claude Code CLI",
|
||||
"codexDesc": "OpenAI Codex CLI",
|
||||
"geminiDesc": "Google Gemini CLI",
|
||||
"opencodeDesc": "OpenCode CLI"
|
||||
"opencodeDesc": "OpenCode CLI",
|
||||
"showProfileSwitcher": "Show project switcher",
|
||||
"showProfileSwitcherDescription": "Show the project switcher in the main page header"
|
||||
},
|
||||
"skillStorage": {
|
||||
"title": "Skill Storage Location",
|
||||
|
||||
@@ -697,7 +697,9 @@
|
||||
"claudeDesc": "Anthropic Claude Code CLI",
|
||||
"codexDesc": "OpenAI Codex CLI",
|
||||
"geminiDesc": "Google Gemini CLI",
|
||||
"opencodeDesc": "OpenCode CLI"
|
||||
"opencodeDesc": "OpenCode CLI",
|
||||
"showProfileSwitcher": "プロジェクト切り替えを表示",
|
||||
"showProfileSwitcherDescription": "メイン画面上部にプロジェクト切り替えを表示します"
|
||||
},
|
||||
"skillStorage": {
|
||||
"title": "スキル保存場所",
|
||||
|
||||
@@ -697,7 +697,9 @@
|
||||
"claudeDesc": "Anthropic Claude Code CLI",
|
||||
"codexDesc": "OpenAI Codex CLI",
|
||||
"geminiDesc": "Google Gemini CLI",
|
||||
"opencodeDesc": "OpenCode CLI"
|
||||
"opencodeDesc": "OpenCode CLI",
|
||||
"showProfileSwitcher": "顯示專案切換",
|
||||
"showProfileSwitcherDescription": "在主頁面頂部顯示專案切換入口"
|
||||
},
|
||||
"skillStorage": {
|
||||
"title": "Skills 儲存位置",
|
||||
|
||||
@@ -697,7 +697,9 @@
|
||||
"claudeDesc": "Anthropic Claude Code CLI",
|
||||
"codexDesc": "OpenAI Codex CLI",
|
||||
"geminiDesc": "Google Gemini CLI",
|
||||
"opencodeDesc": "OpenCode CLI"
|
||||
"opencodeDesc": "OpenCode CLI",
|
||||
"showProfileSwitcher": "显示项目切换",
|
||||
"showProfileSwitcherDescription": "在主页面顶部显示项目切换入口"
|
||||
},
|
||||
"skillStorage": {
|
||||
"title": "Skills 存储位置",
|
||||
|
||||
@@ -375,6 +375,8 @@ export interface Settings {
|
||||
streamCheckConfirmed?: boolean;
|
||||
// Whether to show the failover toggle independently on the main page
|
||||
enableFailoverToggle?: boolean;
|
||||
// Whether to show the project profile switcher on the main page header
|
||||
showProfileSwitcher?: boolean;
|
||||
// Preserve Codex ChatGPT login in auth.json when switching third-party providers
|
||||
preserveCodexOfficialAuthOnSwitch?: boolean;
|
||||
// Run official Codex under the shared "custom" provider id so future
|
||||
|
||||
Reference in New Issue
Block a user