mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-25 13:45:03 +08:00
feat(ui): add OpenClaw support to frontend components
- Update App.tsx with openclaw visibility and skills fallback - Add OpenClaw to AppSwitcher icon and display name maps - Update McpFormModal with openclaw in enabled apps - Update PromptFormModal/Panel with openclaw filename map - Update EndpointSpeedTest with openclaw timeout - Update AppVisibilitySettings with openclaw toggle - Update test state with openclaw defaults
This commit is contained in:
+3
-1
@@ -123,6 +123,7 @@ function App() {
|
||||
codex: true,
|
||||
gemini: true,
|
||||
opencode: true,
|
||||
openclaw: true,
|
||||
};
|
||||
|
||||
const getFirstVisibleApp = (): AppId => {
|
||||
@@ -130,6 +131,7 @@ function App() {
|
||||
if (visibleApps.codex) return "codex";
|
||||
if (visibleApps.gemini) return "gemini";
|
||||
if (visibleApps.opencode) return "opencode";
|
||||
if (visibleApps.openclaw) return "openclaw";
|
||||
return "claude"; // fallback
|
||||
};
|
||||
|
||||
@@ -586,7 +588,7 @@ function App() {
|
||||
return (
|
||||
<SkillsPage
|
||||
ref={skillsPageRef}
|
||||
initialApp={activeApp === "opencode" ? "claude" : activeApp}
|
||||
initialApp={activeApp === "opencode" || activeApp === "openclaw" ? "claude" : activeApp}
|
||||
/>
|
||||
);
|
||||
case "mcp":
|
||||
|
||||
@@ -29,12 +29,14 @@ export function AppSwitcher({
|
||||
codex: "openai",
|
||||
gemini: "gemini",
|
||||
opencode: "opencode",
|
||||
openclaw: "openclaw",
|
||||
};
|
||||
const appDisplayName: Record<AppId, string> = {
|
||||
claude: "Claude",
|
||||
codex: "Codex",
|
||||
gemini: "Gemini",
|
||||
opencode: "OpenCode",
|
||||
openclaw: "OpenClaw",
|
||||
};
|
||||
|
||||
// Filter apps based on visibility settings (default all visible)
|
||||
|
||||
@@ -66,6 +66,7 @@ const McpFormModal: React.FC<McpFormModalProps> = ({
|
||||
codex: boolean;
|
||||
gemini: boolean;
|
||||
opencode: boolean;
|
||||
openclaw: boolean;
|
||||
}>(() => {
|
||||
if (initialData?.apps) {
|
||||
return { ...initialData.apps };
|
||||
@@ -75,6 +76,7 @@ const McpFormModal: React.FC<McpFormModalProps> = ({
|
||||
codex: defaultEnabledApps.includes("codex"),
|
||||
gemini: defaultEnabledApps.includes("gemini"),
|
||||
opencode: defaultEnabledApps.includes("opencode"),
|
||||
openclaw: defaultEnabledApps.includes("openclaw"),
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ const PromptFormModal: React.FC<PromptFormModalProps> = ({
|
||||
codex: "AGENTS.md",
|
||||
gemini: "GEMINI.md",
|
||||
opencode: "AGENTS.md",
|
||||
openclaw: "AGENTS.md",
|
||||
};
|
||||
const filename = filenameMap[appId];
|
||||
const [name, setName] = useState("");
|
||||
|
||||
@@ -29,6 +29,7 @@ const PromptFormPanel: React.FC<PromptFormPanelProps> = ({
|
||||
codex: "AGENTS.md",
|
||||
gemini: "GEMINI.md",
|
||||
opencode: "AGENTS.md",
|
||||
openclaw: "AGENTS.md",
|
||||
};
|
||||
const filename = filenameMap[appId];
|
||||
const [name, setName] = useState("");
|
||||
|
||||
@@ -14,6 +14,7 @@ const ENDPOINT_TIMEOUT_SECS: Record<AppId, number> = {
|
||||
claude: 8,
|
||||
gemini: 8,
|
||||
opencode: 8,
|
||||
openclaw: 8,
|
||||
};
|
||||
|
||||
interface TestResult {
|
||||
|
||||
@@ -4,9 +4,10 @@ import {
|
||||
setCodexBaseUrl as setCodexBaseUrlInConfig,
|
||||
} from "@/utils/providerConfigUtils";
|
||||
import type { ProviderCategory } from "@/types";
|
||||
import type { AppId } from "@/lib/api";
|
||||
|
||||
interface UseBaseUrlStateProps {
|
||||
appType: "claude" | "codex" | "gemini" | "opencode";
|
||||
appType: AppId;
|
||||
category: ProviderCategory | undefined;
|
||||
settingsConfig: string;
|
||||
codexConfig?: string;
|
||||
|
||||
@@ -20,6 +20,7 @@ const APP_CONFIG: Array<{
|
||||
{ id: "codex", icon: "openai", nameKey: "apps.codex" },
|
||||
{ id: "gemini", icon: "gemini", nameKey: "apps.gemini" },
|
||||
{ id: "opencode", icon: "opencode", nameKey: "apps.opencode" },
|
||||
{ id: "openclaw", icon: "openclaw", nameKey: "apps.openclaw" },
|
||||
];
|
||||
|
||||
export function AppVisibilitySettings({
|
||||
@@ -33,6 +34,7 @@ export function AppVisibilitySettings({
|
||||
codex: true,
|
||||
gemini: true,
|
||||
opencode: true,
|
||||
openclaw: true,
|
||||
};
|
||||
|
||||
// Count how many apps are currently visible
|
||||
|
||||
Reference in New Issue
Block a user