diff --git a/src/App.tsx b/src/App.tsx index d10c562..a3b1299 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -30,7 +30,6 @@ import { PromptFilesManager } from "@/components"; import i18n from "@/lib/i18n"; // Lazy load these components to match TabContent's dynamic imports -const MarkdownEditor = lazy(() => import('@/components/MarkdownEditor').then(m => ({ default: m.MarkdownEditor }))); const Settings = lazy(() => import('@/components/Settings').then(m => ({ default: m.Settings }))); const UsageDashboard = lazy(() => import('@/components/UsageDashboard').then(m => ({ default: m.UsageDashboard }))); const MCPManager = lazy(() => import('@/components/MCPManager').then(m => ({ default: m.MCPManager }))); @@ -38,7 +37,6 @@ const MCPManager = lazy(() => import('@/components/MCPManager').then(m => ({ def type View = | "welcome" | "projects" - | "editor" | "claude-file-editor" | "settings" | "cc-agents" @@ -61,7 +59,6 @@ function AppContent() { const { t } = useTranslation(); const [view, setView] = useState("welcome"); const { - createClaudeMdTab, createSettingsTab, createUsageTab, createMCPTab, @@ -457,14 +454,7 @@ function AppContent() { ); - case "editor": - return ( -
-
}> - handleViewChange("welcome")} /> - - - ); + // Removed old direct CLAUDE.md editor view case "prompt-files": return ( @@ -613,7 +603,7 @@ function AppContent() { - ); + ); case "usage-dashboard": return ( @@ -658,7 +648,6 @@ function AppContent() {
{/* Topbar */} view === 'tabs' ? createClaudeMdTab() : handleViewChange('editor')} onSettingsClick={() => view === 'tabs' ? createSettingsTab() : handleViewChange('settings')} onUsageClick={() => view === 'tabs' ? createUsageTab() : handleViewChange('usage-dashboard')} onMCPClick={() => view === 'tabs' ? createMCPTab() : handleViewChange('mcp')} diff --git a/src/components/MarkdownEditor.tsx b/src/components/MarkdownEditor.tsx deleted file mode 100644 index f2b865c..0000000 --- a/src/components/MarkdownEditor.tsx +++ /dev/null @@ -1,173 +0,0 @@ -import React, { useState, useEffect } from "react"; -import MDEditor from "@uiw/react-md-editor"; -import { motion } from "framer-motion"; -import { ArrowLeft, Save, Loader2 } from "lucide-react"; -import { Button } from "@/components/ui/button"; -import { Toast, ToastContainer } from "@/components/ui/toast"; -import { api } from "@/lib/api"; -import { cn } from "@/lib/utils"; -import { useTranslation } from "@/hooks/useTranslation"; - -interface MarkdownEditorProps { - /** - * Callback to go back to the main view - */ - onBack: () => void; - /** - * Optional className for styling - */ - className?: string; -} - -/** - * MarkdownEditor component for editing the CLAUDE.md system prompt - * - * @example - * setView('main')} /> - */ -export const MarkdownEditor: React.FC = ({ - onBack, - className, -}) => { - const { t } = useTranslation(); - const [content, setContent] = useState(""); - const [originalContent, setOriginalContent] = useState(""); - const [loading, setLoading] = useState(true); - const [saving, setSaving] = useState(false); - const [error, setError] = useState(null); - const [toast, setToast] = useState<{ message: string; type: "success" | "error" } | null>(null); - - const hasChanges = content !== originalContent; - - // Load the system prompt on mount - useEffect(() => { - loadSystemPrompt(); - }, []); - - const loadSystemPrompt = async () => { - try { - setLoading(true); - setError(null); - const prompt = await api.getSystemPrompt(); - setContent(prompt); - setOriginalContent(prompt); - } catch (err) { - console.error("Failed to load system prompt:", err); - setError(t('usage.loadClaudemdFailed')); - } finally { - setLoading(false); - } - }; - - const handleSave = async () => { - try { - setSaving(true); - setError(null); - setToast(null); - await api.saveSystemPrompt(content); - setOriginalContent(content); - setToast({ message: t('usage.claudemdSavedSuccess'), type: "success" }); - } catch (err) { - console.error("Failed to save system prompt:", err); - setError(t('usage.saveClaudemdFailed')); - setToast({ message: t('usage.saveClaudemdFailed'), type: "error" }); - } finally { - setSaving(false); - } - }; - - const handleBack = () => { - if (hasChanges) { - const confirmLeave = window.confirm( - t('usage.unsavedChangesConfirm') - ); - if (!confirmLeave) return; - } - onBack(); - }; - - return ( -
-
- {/* Header */} - -
- -
-

CLAUDE.md

-

- {t('usage.editSystemPrompt')} -

-
-
- - -
- - {/* Error display */} - {error && ( - - {error} - - )} - - {/* Editor */} -
- {loading ? ( -
- -
- ) : ( -
- setContent(val || "")} - preview="edit" - height="100%" - visibleDragbar={false} - /> -
- )} -
-
- - {/* Toast Notification */} - - {toast && ( - setToast(null)} - /> - )} - -
- ); -}; \ No newline at end of file diff --git a/src/components/TabContent.tsx b/src/components/TabContent.tsx index 4b2eafb..02fbc26 100644 --- a/src/components/TabContent.tsx +++ b/src/components/TabContent.tsx @@ -18,7 +18,7 @@ const CreateAgent = lazy(() => import('@/components/CreateAgent').then(m => ({ d const UsageDashboard = lazy(() => import('@/components/UsageDashboard').then(m => ({ default: m.UsageDashboard }))); const MCPManager = lazy(() => import('@/components/MCPManager').then(m => ({ default: m.MCPManager }))); const Settings = lazy(() => import('@/components/Settings').then(m => ({ default: m.Settings }))); -const MarkdownEditor = lazy(() => import('@/components/MarkdownEditor').then(m => ({ default: m.MarkdownEditor }))); +// Removed MarkdownEditor (direct CLAUDE.md editor) // const ClaudeFileEditor = lazy(() => import('@/components/ClaudeFileEditor').then(m => ({ default: m.ClaudeFileEditor }))); // Import non-lazy components for projects view @@ -234,8 +234,7 @@ const TabPanel: React.FC = ({ tab, isActive }) => { case 'settings': return {}} />; - case 'claude-md': - return {}} />; + // Removed 'claude-md' tab type case 'claude-file': if (!tab.claudeFileId) { diff --git a/src/components/TabManager.tsx b/src/components/TabManager.tsx index 6949d54..2bb2336 100644 --- a/src/components/TabManager.tsx +++ b/src/components/TabManager.tsx @@ -34,7 +34,6 @@ const TabItem: React.FC = ({ tab, isActive, onClose, onClick, isDr return Server; case 'settings': return Settings; - case 'claude-md': case 'claude-file': return FileText; case 'agent-execution': diff --git a/src/components/Topbar.tsx b/src/components/Topbar.tsx index 36211b3..661f057 100644 --- a/src/components/Topbar.tsx +++ b/src/components/Topbar.tsx @@ -1,6 +1,6 @@ import React, { useEffect, useState } from "react"; import { motion } from "framer-motion"; -import { Circle, FileText, Settings, ExternalLink, BarChart3, Network, Info, Bot, Files } from "lucide-react"; +import { Circle, Settings, ExternalLink, BarChart3, Network, Info, Bot, Files } from "lucide-react"; import { Button } from "@/components/ui/button"; import { Popover } from "@/components/ui/popover"; import { LanguageSwitcher } from "@/components/LanguageSwitcher"; @@ -10,10 +10,7 @@ import { api, type ClaudeVersionStatus } from "@/lib/api"; import { cn } from "@/lib/utils"; interface TopbarProps { - /** - * Callback when CLAUDE.md is clicked - */ - onClaudeClick: () => void; + // Removed direct CLAUDE.md editor entry to avoid duplication /** * Callback when Settings is clicked */ @@ -49,14 +46,13 @@ interface TopbarProps { * * @example * setView('editor')} + * // CLAUDE.md direct editor removed; use Prompt Files manager instead * onSettingsClick={() => setView('settings')} * onUsageClick={() => setView('usage-dashboard')} * onMCPClick={() => setView('mcp')} * /> */ export const Topbar: React.FC = ({ - onClaudeClick, onSettingsClick, onUsageClick, onMCPClick, @@ -213,15 +209,7 @@ export const Topbar: React.FC = ({ {t('navigation.usage')} - + {/* Removed old direct CLAUDE.md editor button */} {onPromptFilesClick && (
); -}; \ No newline at end of file +}; diff --git a/src/contexts/TabContext.tsx b/src/contexts/TabContext.tsx index 78dfcb9..6067cdb 100644 --- a/src/contexts/TabContext.tsx +++ b/src/contexts/TabContext.tsx @@ -3,7 +3,7 @@ import { useTranslation } from '@/hooks/useTranslation'; export interface Tab { id: string; - type: 'chat' | 'agent' | 'projects' | 'usage' | 'mcp' | 'settings' | 'claude-md' | 'claude-file' | 'agent-execution' | 'create-agent' | 'import-agent'; + type: 'chat' | 'agent' | 'projects' | 'usage' | 'mcp' | 'settings' | 'claude-file' | 'agent-execution' | 'create-agent' | 'import-agent'; title: string; sessionId?: string; // for chat tabs sessionData?: any; // for chat tabs - stores full session object diff --git a/src/hooks/useAnalytics.ts b/src/hooks/useAnalytics.ts index cabdb36..1ee3c9c 100644 --- a/src/hooks/useAnalytics.ts +++ b/src/hooks/useAnalytics.ts @@ -10,7 +10,6 @@ const TAB_SCREEN_NAMES: Record = { 'usage': 'usage_dashboard', 'mcp': 'mcp_manager', 'settings': 'settings', - 'claude-md': 'markdown_editor', 'claude-file': 'file_editor', 'agent-execution': 'agent_execution', 'create-agent': 'create_agent', diff --git a/src/hooks/useTabState.ts b/src/hooks/useTabState.ts index b82884b..9e176b9 100644 --- a/src/hooks/useTabState.ts +++ b/src/hooks/useTabState.ts @@ -20,7 +20,6 @@ interface UseTabStateReturn { createUsageTab: () => string | null; createMCPTab: () => string | null; createSettingsTab: () => string | null; - createClaudeMdTab: () => string | null; createClaudeFileTab: (fileId: string, fileName: string) => string; createCreateAgentTab: () => string; createImportAgentTab: () => string; @@ -161,22 +160,7 @@ export const useTabState = (): UseTabStateReturn => { }); }, [addTab, tabs, setActiveTab, t]); - const createClaudeMdTab = useCallback((): string | null => { - // Check if claude-md tab already exists (singleton) - const existingTab = tabs.find(tab => tab.type === 'claude-md'); - if (existingTab) { - setActiveTab(existingTab.id); - return existingTab.id; - } - - return addTab({ - type: 'claude-md', - title: t('messages.claudemdTitle'), - status: 'idle', - hasUnsavedChanges: false, - icon: 'file-text' - }); - }, [addTab, tabs, setActiveTab, t]); + // Removed createClaudeMdTab: using Prompt Files manager instead const createClaudeFileTab = useCallback((fileId: string, fileName: string): string => { // Check if tab already exists for this file @@ -328,7 +312,6 @@ export const useTabState = (): UseTabStateReturn => { createUsageTab, createMCPTab, createSettingsTab, - createClaudeMdTab, createClaudeFileTab, createCreateAgentTab, createImportAgentTab,