diff --git a/package.json b/package.json index 9a0bd12..17201d0 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "cc-mate", + "name": "claude-samurai", "private": true, "version": "0.2.0", "type": "module", diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx index 7480398..8e3d734 100644 --- a/src/components/Layout.tsx +++ b/src/components/Layout.tsx @@ -42,68 +42,86 @@ export function Layout() { const location = useLocation(); const isProjectsRoute = location.pathname.startsWith("/projects"); - const navLinks = [ + const navSections = [ { - to: "/", - icon: FileJsonIcon, - label: t("navigation.configurations"), + id: "core", + label: t("navigation.section.core", { defaultValue: "Core" }), + items: [ + { + to: "/", + icon: FileJsonIcon, + label: t("navigation.configurations"), + }, + { + to: "/projects", + icon: FolderIcon, + label: t("navigation.projects"), + }, + { + to: "/mcp", + icon: CpuIcon, + label: t("navigation.mcp"), + }, + ], }, { - to: "/projects", - icon: FolderIcon, - label: t("navigation.projects"), + id: "automation", + label: t("navigation.section.automation", { defaultValue: "Automation" }), + items: [ + { + to: "/hooks", + icon: CpuIcon, + label: t("hooks.title"), + }, + { + to: "/commands", + icon: TerminalIcon, + label: t("navigation.commands"), + }, + { + to: "/skills", + icon: SparklesIcon, + label: t("navigation.skills"), + }, + { + to: "/agents", + icon: BotIcon, + label: "Agents", + }, + ], }, { - to: "/mcp", - icon: CpuIcon, - label: t("navigation.mcp"), + id: "system", + label: t("navigation.section.system", { defaultValue: "System" }), + items: [ + { + to: "/memory", + icon: BrainIcon, + label: t("navigation.memory"), + }, + { + to: "/plugins", + icon: PackageIcon, + label: t("navigation.plugins"), + }, + { + to: "/notification", + icon: BellIcon, + label: t("navigation.notifications"), + }, + { + to: "/usage", + icon: ActivityIcon, + label: t("navigation.usage"), + }, + { + to: "/settings", + icon: SettingsIcon, + label: t("navigation.settings"), + }, + ], }, - { - to: "/hooks", - icon: CpuIcon, - label: t("hooks.title"), - }, - { - to: "/agents", - icon: BotIcon, - label: "Agents", - }, - { - to: "/memory", - icon: BrainIcon, - label: t("navigation.memory"), - }, - { - to: "/commands", - icon: TerminalIcon, - label: t("navigation.commands"), - }, - { - to: "/skills", - icon: SparklesIcon, - label: t("navigation.skills"), - }, - { - to: "/plugins", - icon: PackageIcon, - label: t("navigation.plugins"), - }, - { - to: "/notification", - icon: BellIcon, - label: t("navigation.notifications"), - }, - { - to: "/usage", - icon: ActivityIcon, - label: t("navigation.usage"), - }, - { - to: "/settings", - icon: SettingsIcon, - label: t("navigation.settings"), - }, - ]; + ] as const; return (
@@ -113,37 +131,51 @@ export function Layout() {
-
+
diff --git a/src/pages/ConfigSwitcherPage.tsx b/src/pages/ConfigSwitcherPage.tsx index 9c65887..aa29d7e 100644 --- a/src/pages/ConfigSwitcherPage.tsx +++ b/src/pages/ConfigSwitcherPage.tsx @@ -5,17 +5,29 @@ import { useNavigate } from "react-router-dom"; import { GLMDialog } from "@/components/GLMBanner"; import { KimiDialog } from "@/components/KimiDialog"; import { MiniMaxDialog } from "@/components/MiniMaxDialog"; +import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { ButtonGroup } from "@/components/ui/button-group"; +import { + AlertDialog, + AlertDialogAction, + AlertDialogCancel, + AlertDialogContent, + AlertDialogDescription, + AlertDialogFooter, + AlertDialogHeader, + AlertDialogTitle, + AlertDialogTrigger, +} from "@/components/ui/alert-dialog"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; -import { cn } from "@/lib/utils"; import { useCreateConfig, + useDeleteConfig, useResetToOriginalConfig, useSetCurrentConfig, useStores, @@ -23,11 +35,9 @@ import { export function ConfigSwitcherPage() { return ( -
-
- -
-
+
+ +
); } @@ -39,6 +49,10 @@ function ConfigStores() { const navigate = useNavigate(); const isOriginalConfigActive = !stores.some((store) => store.using); + const activeStore = stores.find((store) => store.using) ?? null; + const otherStores = activeStore + ? stores.filter((store) => store.id !== activeStore.id) + : stores; const handleStoreClick = (storeId: string, isCurrentStore: boolean) => { if (!isCurrentStore) { @@ -53,94 +67,106 @@ function ConfigStores() { }; const createStoreMutation = useCreateConfig(); + const deleteStoreMutation = useDeleteConfig(); const onCreateStore = async () => { const store = await createStoreMutation.mutateAsync({ title: t("configSwitcher.newConfig"), settings: {}, }); - navigate(`/edit/${store.id}`); + if (store) { + navigate(`/edit/${store.id}`); + } }; if (stores.length === 0) { return ( -
-
- - -

+

+
+

+ {t("configSwitcher.emptyTitle", { + defaultValue: "No configurations yet", + })} +

+

{t("configSwitcher.description")}

-
- + + + - } - /> - - - {t("minimax.useMiniMax")} - - } - /> - - - {t("kimi.useKimi")} - - } - /> -
+ + + e.preventDefault()}> + + {t("glm.useZhipuGlm")} + + } + /> + e.preventDefault()}> + + {t("minimax.useMiniMax")} + + } + /> + e.preventDefault()}> + + {t("kimi.useKimi")} + + } + /> + + + + +

+ {t("configSwitcher.emptyHelper", { + defaultValue: + "Start from a template like Zhipu GLM, MiniMax, or Kimi, or create a config from scratch.", + })} +

); } return ( -
-
-
-

+
+
+
+

{t("configSwitcher.title")} -

-

+

+

{t("configSwitcher.description")}

@@ -183,71 +209,246 @@ function ConfigStores() { -
+ - {/* */} - -
- {/* Fixed Claude Original Config Item */} -
-
-
{t("configSwitcher.originalConfig")}
-
- {t("configSwitcher.originalConfigDescription")} -
+
+
+

+ {t("configSwitcher.activeConfigHeading", { + defaultValue: "Active configuration", + })} +

+
+ + {t("configSwitcher.activeBadge", { defaultValue: "Active" })} + +
- {stores.map((store) => { - const isCurrentStore = store.using; - return ( -
handleStoreClick(store.id, isCurrentStore)} - className={cn( - "border rounded-xl p-3 h-[100px] flex flex-col justify-between transition-colors disabled:opacity-50", - { - "bg-primary/10 border-primary border-2": isCurrentStore, - }, - )} - > -
-
{store.title}
- {store.settings.env?.ANTHROPIC_BASE_URL && ( -
+ {activeStore ? ( +
+
+
+

{activeStore.title}

+ - {store.settings.env.ANTHROPIC_BASE_URL} -
+ {t("configSwitcher.tagDailyDriver", { + defaultValue: "Daily driver", + })} + +
+ {activeStore.settings.env?.ANTHROPIC_BASE_URL && ( +

+ {activeStore.settings.env.ANTHROPIC_BASE_URL} +

)}
- -
- + + {t("configSwitcher.edit", { defaultValue: "Edit" })} +
- ); - })} -
+ ) : ( +
+
+
+

+ {t("configSwitcher.originalConfig", { + defaultValue: "Original Claude config", + })} +

+ + {t("configSwitcher.tagDefault", { + defaultValue: "Default", + })} + +
+

+ {t("configSwitcher.originalConfigDescription")} +

+
+ +
+ )} +
+
+ +
+
+

+ {t("configSwitcher.otherConfigsHeading", { + defaultValue: "Other configurations", + })} +

+

+ {t("configSwitcher.otherConfigsHelper", { + defaultValue: + "Use these for experiments, different providers, or project-specific setups.", + })} +

+
+ + {otherStores.length === 0 ? ( +

+ {t("configSwitcher.noOtherConfigs", { + defaultValue: "You only have the active configuration right now.", + })} +

+ ) : ( +
+ {otherStores.map((store) => ( +
+
+
+

+ {store.title} +

+
+ {store.settings.env?.ANTHROPIC_BASE_URL && ( +

+ {store.settings.env.ANTHROPIC_BASE_URL} +

+ )} +
+ +
+ +
+ + + + + + + + + + {t("configSwitcher.deleteConfirmTitle", { + defaultValue: "Delete configuration?", + })} + + + {t( + "configSwitcher.deleteConfirmDescription", + { + defaultValue: + "This will permanently remove this configuration from Claude Samurai. This action cannot be undone.", + }, + )} + + + + + {t("common.cancel", { + defaultValue: "Cancel", + })} + + + deleteStoreMutation.mutate({ + storeId: store.id, + }) + } + className="bg-destructive text-destructive-foreground hover:bg-destructive/90" + disabled={deleteStoreMutation.isPending} + > + {t("configSwitcher.deleteConfirmAction", { + defaultValue: "Delete", + })} + + + + +
+
+
+ ))} +
+ )} +
); }