Refactor/shared and tasks components (#473)

* refactor: remove unused TasksSettings component

* refactor: migrate TodoList component to a new file with improved structure and normalization logic

* refactor: Move Tooltip and DarkModeToggle to shared/ui

* refactor: Move Tooltip and DarkModeToggle to shared/view/ui

* refactor: move GeminiLogo to llm-logo-provider and update imports

* refactor: remove unused GeminiStatus component

* refactor: move components in src/components/ui to src/shared/view/ui

* refactor: move ErrorBoundary component to main-content/view and update imports

* refactor: move VersionUpgradeModal to its own module

* refactor(wizard): rebuild project creation flow as modular TypeScript components

Replace the monolithic `ProjectCreationWizard.jsx` with a feature-based TS
implementation under `src/components/project-creation-wizard`, while preserving
existing behavior and improving readability, maintainability, and state isolation.

Why:
- The previous wizard mixed API logic, flow state, folder browsing, and UI in one file.
- Refactoring and testing were difficult due to tightly coupled concerns.
- We needed stronger type safety and localized component state.

What changed:
- Deleted:
  - `src/components/ProjectCreationWizard.jsx`
- Added new modular structure:
  - `src/components/project-creation-wizard/index.ts`
  - `src/components/project-creation-wizard/ProjectCreationWizard.tsx`
  - `src/components/project-creation-wizard/types.ts`
  - `src/components/project-creation-wizard/data/workspaceApi.ts`
  - `src/components/project-creation-wizard/hooks/useGithubTokens.ts`
  - `src/components/project-creation-wizard/utils/pathUtils.ts`
  - `src/components/project-creation-wizard/components/*`
    - `WizardProgress`, `WizardFooter`, `ErrorBanner`
    - `StepTypeSelection`, `StepConfiguration`, `StepReview`
    - `WorkspacePathField`, `GithubAuthenticationCard`, `FolderBrowserModal`
- Updated import usage:
  - `src/components/sidebar/view/subcomponents/SidebarModals.tsx`
    now imports from `../../../project-creation-wizard`.

Implementation details:
- Migrated wizard logic to TypeScript using `type` aliases only.
- Kept component prop types colocated in each component file.
- Split responsibilities by feature:
  - container/orchestration in `ProjectCreationWizard.tsx`
  - API/SSE and request parsing in `data/workspaceApi.ts`
  - GitHub token loading/caching behavior in `useGithubTokens`
  - path/URL helpers in `utils/pathUtils.ts`
- Localized UI-only state to child components:
  - folder browser modal state (current path, hidden folders, create-folder input)
  - path suggestion dropdown state with debounced lookup
- Preserved existing UX flows:
  - step navigation and validation
  - existing/new workspace modes
  - optional GitHub clone + auth modes
  - clone progress via SSE
  - folder browsing + folder creation
- Added focused comments for non-obvious logic (debounce, SSE auth constraint, path edge cases).

* refactor(quick-settings): migrate panel to typed feature-based modules

Refactor QuickSettingsPanel from a single JSX component into a modular TypeScript feature structure while preserving behavior and translations.

Highlights:
- Replace legacy src/components/QuickSettingsPanel.jsx with a typed entrypoint (src/components/QuickSettingsPanel.tsx).
- Introduce src/components/quick-settings-panel/ with clear separation of concerns:
  - view/: panel shell, header, handle, section wrappers, toggle rows, and content sections.
  - hooks/: drag interactions and whisper mode persistence.
  - constants.ts and types.ts for shared config and strict local typing.
- Move drag logic into useQuickSettingsDrag with explicit touch/mouse handling, drag threshold detection, click suppression after drag, position clamping, and localStorage persistence.
- Keep user-visible behavior intact:
  - same open/close panel interactions.
  - same mobile/desktop drag behavior and persisted handle position.
  - same quick preference toggles and wiring to useUiPreferences.
  - same hidden whisper section behavior and localStorage/event updates.
- Improve readability and maintainability by extracting repetitive setting rows and section scaffolding into reusable components.
- Add focused comments around non-obvious behavior (drag click suppression, touch scroll lock, hidden whisper section intent).
- Keep files small and reviewable (all new/changed files are under 300 lines).

Validation:
- npm run typecheck
- npm run build

* refactor(quick-settings-panel): restructure QuickSettingsPanel import and create index file

* refactor(shared): move shared ui components to share/view/ui without subfolders

* refactor(LanguageSelector): move LanguageSelector to shared UI components

* refactor(prd-editor): modularize PRD editor with typed feature modules

Break the legacy PRDEditor.jsx monolith into a feature-based TypeScript architecture under src/components/prd-editor while keeping behavior parity and readability.

Key changes:

- Replace PRDEditor.jsx with a typed orchestrator component and a compatibility export bridge at src/components/PRDEditor.tsx.

- Split responsibilities into dedicated hooks: document loading/init, existing PRD registry fetching, save workflow with overwrite detection, and keyboard shortcuts.

- Split UI into focused view components: header, editor/preview body, footer stats, loading state, generate-tasks modal, and overwrite-confirm modal.

- Move filename concerns into utility helpers (sanitize, extension handling, default naming) and centralize template/constants.

- Keep component-local state close to the UI that owns it (workspace controls/modal toggles), while shared workflow state remains in the feature container.

- Reuse the existing MarkdownPreview component for safer markdown rendering instead of ad-hoc HTML conversion.

- Update TaskMasterPanel integration to consume typed PRDEditor directly (remove any-cast) and pass isExisting metadata for correct overwrite behavior.

- Keep all new/changed files below 300 lines and add targeted comments where behavior needs clarification.

Validation:

- npm run typecheck

- npm run build

* refactor(TaskMasterPanel): update PRDEditor import path to match new structure

* refactor(TaskMaster): Remove unused TaskMasterSetupWizard and TaskMasterStatus components

* refactor(TaskDetail): remove unused TaskIndicator import

* refactor(task-master): migrate tasks to a typed feature module

- introduce a new feature-oriented TaskMaster domain under src/components/task-master

- add typed TaskMaster context/provider with explicit project, task, MCP, and loading state handling

- split task UI into focused components (panel, board, toolbar, content, card, detail modal, setup/help modals, banner)

- move task board filtering/sorting/kanban derivation into dedicated hooks and utilities

- relocate CreateTaskModal into the feature module and keep task views modular/readable

- remove legacy monolithic TaskList/TaskDetail/TaskCard files and route main task panel to the new feature panel

- replace contexts/TaskMasterContext.jsx with a typed contexts/TaskMasterContext.ts re-export to the feature context

- update MainContent project sync logic to compare by project name to avoid state churn

- validation: npm run typecheck, npm run build

* refactor(MobileNav): remove unused React import and TaskMasterContext

* refactor(auth): migrate login and setup flows to typed feature module

- Introduce a new feature-based auth module under src/components/auth with clear separation of concerns:\n  - context/AuthContext.tsx for session lifecycle, onboarding status checks, token persistence, and auth actions\n  - view/* components for loading, route guarding, form layout, input fields, and error display\n  - shared auth constants, utility helpers, and type aliases (no interfaces)\n- Convert login and setup UIs to TypeScript and keep form state local to each component for readability and component-level ownership\n- Add explicit API payload typing and safe JSON parsing helpers to improve resilience when backend responses are malformed or incomplete\n- Centralize error fallback handling for auth requests to reduce repeated logic

- Replace legacy auth entrypoints with the new feature module in app wiring:\n  - App now imports AuthProvider and ProtectedRoute from src/components/auth\n  - WebSocketContext, TaskMasterContext, and Onboarding now consume useAuth from the new typed auth context\n- Remove duplicated legacy auth screens (LoginForm.jsx, SetupForm.jsx, ProtectedRoute.jsx)\n- Keep backward compatibility by turning src/contexts/AuthContext.jsx into a thin re-export of the new provider/hook

Result: auth code now follows a feature/domain structure, is fully typed, easier to navigate, and cleaner to extend without touching unrelated UI areas.

* refactor(AppContent): update MobileNav import path and add MobileNav component

* refactor(DiffViewer): rename different diff viewers and place them in different components

* refactor(components): reorganize onboarding/provider auth/sidebar indicator into domain features

- Move onboarding out of root-level components into a dedicated feature module:
  - add src/components/onboarding/view/Onboarding.tsx
  - split onboarding UI into focused subcomponents:
    - OnboardingStepProgress
    - GitConfigurationStep
    - AgentConnectionsStep
    - AgentConnectionCard
  - add onboarding-local types and utils for provider status and validation helpers

- Move multi-provider login modal into a dedicated provider-auth feature:
  - add src/components/provider-auth/view/ProviderLoginModal.tsx
  - add src/components/provider-auth/types.ts
  - keep provider-specific command/title behavior and Gemini setup guidance
  - preserve compatibility for both onboarding flow and settings login flow

- Move TaskIndicator into the sidebar domain:
  - add src/components/sidebar/view/subcomponents/TaskIndicator.tsx
  - update SidebarProjectItem to consume local sidebar TaskIndicator

- Update integration points to the new structure:
  - ProtectedRoute now imports onboarding from onboarding feature
  - Settings now imports ProviderLoginModal directly (remove legacy cast wrapper)
  - git panel consumers now import shared GitDiffViewer by explicit name

- Rename git shared diff view to clearer domain naming:
  - replace shared DiffViewer with shared GitDiffViewer
  - update FileChangeItem and CommitHistoryItem imports accordingly

- Remove superseded root-level legacy components:
  - delete src/components/LoginModal.jsx
  - delete src/components/Onboarding.jsx
  - delete src/components/TaskIndicator.jsx
  - delete old src/components/git-panel/view/shared/DiffViewer.tsx

- Result:
  - clearer feature boundaries (auth vs onboarding vs provider-auth vs sidebar)
  - easier navigation and ownership by domain
  - preserved runtime behavior with improved readability and modularity

* refactor(MainContent): remove TaskMasterPanel import and relocate to task-master component

* fix: update import paths for Input component in FileTree and FileTreeNode

* refactor(FileTree): make file tree context menu a typescript component and move it inside the file tree view

* refactor(FileTree): remove unused ScrollArea import

* feat: setup eslint with typescript and react rules, add unused imports plugin

* fix: remove unused imports, functions, and types after discovering using `npm run lint`

* feat: setup eslint-plugin-react, react-refresh, import-x, and tailwindcss plugins with recommended rules and configurations

* chore: reformat files after running `npm run lint:fix`

* chore: add omments about eslint config plugin uses

* feat: add husky and lint-staged for pre-commit linting

* feat: setup commitlint with conventional config

* fix: i18n translations

---------

Co-authored-by: Haileyesus <something@gmail.com>
Co-authored-by: viper151 <simosmik@gmail.com>
This commit is contained in:
Haileyesus
2026-03-06 01:47:58 +03:00
committed by GitHub
parent 8d28438fe7
commit 844de26ada
254 changed files with 14571 additions and 9347 deletions

View File

@@ -1,7 +1,7 @@
import type { AgentCategoryContentSectionProps } from '../types';
import AccountContent from './content/AccountContent';
import McpServersContent from './content/McpServersContent';
import PermissionsContent from './content/PermissionsContent';
import type { AgentCategoryContentSectionProps } from '../types';
export default function AgentCategoryContentSection({
selectedAgent,

View File

@@ -11,15 +11,15 @@ export default function AgentCategoryTabsSection({
const { t } = useTranslation('settings');
return (
<div className="border-b border-gray-200 dark:border-gray-700 flex-shrink-0">
<div role="tablist" className="flex px-2 md:px-4 overflow-x-auto">
<div className="flex-shrink-0 border-b border-gray-200 dark:border-gray-700">
<div role="tablist" className="flex overflow-x-auto px-2 md:px-4">
{AGENT_CATEGORIES.map((category) => (
<button
key={category}
role="tab"
aria-selected={selectedCategory === category}
onClick={() => onSelectCategory(category)}
className={`px-3 md:px-4 py-2 md:py-3 text-xs md:text-sm font-medium border-b-2 transition-colors whitespace-nowrap ${
className={`whitespace-nowrap border-b-2 px-3 py-2 text-xs font-medium transition-colors md:px-4 md:py-3 md:text-sm ${
selectedCategory === category
? 'border-blue-600 text-blue-600 dark:text-blue-400'
: 'border-transparent text-muted-foreground hover:text-foreground'

View File

@@ -11,7 +11,7 @@ export default function AgentSelectorSection({
}: AgentSelectorSectionProps) {
return (
<>
<div className="md:hidden border-b border-gray-200 dark:border-gray-700 flex-shrink-0">
<div className="flex-shrink-0 border-b border-gray-200 dark:border-gray-700 md:hidden">
<div className="flex">
{AGENT_PROVIDERS.map((agent) => (
<AgentListItem
@@ -26,7 +26,7 @@ export default function AgentSelectorSection({
</div>
</div>
<div className="hidden md:block w-48 border-r border-gray-200 dark:border-gray-700 flex-shrink-0">
<div className="hidden w-48 flex-shrink-0 border-r border-gray-200 dark:border-gray-700 md:block">
<div className="p-2">
{AGENT_PROVIDERS.map((agent) => (
<AgentListItem

View File

@@ -1,7 +1,6 @@
import { LogIn } from 'lucide-react';
import { useTranslation } from 'react-i18next';
import { Badge } from '../../../../../../ui/badge';
import { Button } from '../../../../../../ui/button';
import { Badge, Button } from '../../../../../../../shared/view/ui';
import SessionProviderLogo from '../../../../../../llm-logo-provider/SessionProviderLogo';
import type { AgentProvider, AuthStatus } from '../../../../../types/types';
@@ -63,8 +62,8 @@ export default function AccountContent({ agent, authStatus, onLogin }: AccountCo
return (
<div className="space-y-6">
<div className="flex items-center gap-3 mb-4">
<SessionProviderLogo provider={agent} className="w-6 h-6" />
<div className="mb-4 flex items-center gap-3">
<SessionProviderLogo provider={agent} className="h-6 w-6" />
<div>
<h3 className="text-lg font-medium text-foreground">{config.name}</h3>
<p className="text-sm text-muted-foreground">{t(`agents.account.${agent}.description`)}</p>
@@ -108,7 +107,7 @@ export default function AccountContent({ agent, authStatus, onLogin }: AccountCo
</div>
{authStatus.method !== 'api_key' && (
<div className="border-t border-gray-200 dark:border-gray-700 pt-4">
<div className="border-t border-gray-200 pt-4 dark:border-gray-700">
<div className="flex items-center justify-between">
<div>
<div className={`font-medium ${config.textClass}`}>
@@ -125,7 +124,7 @@ export default function AccountContent({ agent, authStatus, onLogin }: AccountCo
className={`${config.buttonClass} text-white`}
size="sm"
>
<LogIn className="w-4 h-4 mr-2" />
<LogIn className="mr-2 h-4 w-4" />
{authStatus.authenticated ? t('agents.login.reLoginButton') : t('agents.login.button')}
</Button>
</div>
@@ -133,7 +132,7 @@ export default function AccountContent({ agent, authStatus, onLogin }: AccountCo
)}
{authStatus.error && (
<div className="border-t border-gray-200 dark:border-gray-700 pt-4">
<div className="border-t border-gray-200 pt-4 dark:border-gray-700">
<div className="text-sm text-red-600 dark:text-red-400">
{t('agents.error', { error: authStatus.error })}
</div>

View File

@@ -1,23 +1,22 @@
import { Edit3, Globe, Plus, Server, Terminal, Trash2, Zap } from 'lucide-react';
import { useTranslation } from 'react-i18next';
import { Badge } from '../../../../../../ui/badge';
import { Button } from '../../../../../../ui/button';
import { Badge, Button } from '../../../../../../../shared/view/ui';
import type { McpServer, McpToolsResult, McpTestResult } from '../../../../../types/types';
const getTransportIcon = (type: string | undefined) => {
if (type === 'stdio') {
return <Terminal className="w-4 h-4" />;
return <Terminal className="h-4 w-4" />;
}
if (type === 'sse') {
return <Zap className="w-4 h-4" />;
return <Zap className="h-4 w-4" />;
}
if (type === 'http') {
return <Globe className="w-4 h-4" />;
return <Globe className="h-4 w-4" />;
}
return <Server className="w-4 h-4" />;
return <Server className="h-4 w-4" />;
};
const maskSecret = (value: unknown): string => {
@@ -57,14 +56,14 @@ function ClaudeMcpServers({
return (
<div className="space-y-4">
<div className="flex items-center gap-3">
<Server className="w-5 h-5 text-purple-500" />
<Server className="h-5 w-5 text-purple-500" />
<h3 className="text-lg font-medium text-foreground">{t('mcpServers.title')}</h3>
</div>
<p className="text-sm text-muted-foreground">{t('mcpServers.description.claude')}</p>
<div className="flex justify-between items-center">
<Button onClick={onAdd} className="bg-purple-600 hover:bg-purple-700 text-white" size="sm">
<Plus className="w-4 h-4 mr-2" />
<div className="flex items-center justify-between">
<Button onClick={onAdd} className="bg-purple-600 text-white hover:bg-purple-700" size="sm">
<Plus className="mr-2 h-4 w-4" />
{t('mcpServers.addButton')}
</Button>
</div>
@@ -81,10 +80,10 @@ function ClaudeMcpServers({
const toolsResult = serverTools[serverId];
return (
<div key={serverId} className="bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4">
<div key={serverId} className="rounded-lg border border-gray-200 bg-gray-50 p-4 dark:border-gray-700 dark:bg-gray-900/50">
<div className="flex items-start justify-between">
<div className="flex-1">
<div className="flex items-center gap-2 mb-2">
<div className="mb-2 flex items-center gap-2">
{getTransportIcon(server.type)}
<span className="font-medium text-foreground">{server.name}</span>
<Badge variant="outline" className="text-xs">
@@ -99,32 +98,32 @@ function ClaudeMcpServers({
</Badge>
</div>
<div className="text-sm text-muted-foreground space-y-1">
<div className="space-y-1 text-sm text-muted-foreground">
{server.type === 'stdio' && server.config?.command && (
<div>
{t('mcpServers.config.command')}:{' '}
<code className="bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs">{server.config.command}</code>
<code className="rounded bg-gray-100 px-1 text-xs dark:bg-gray-800">{server.config.command}</code>
</div>
)}
{(server.type === 'sse' || server.type === 'http') && server.config?.url && (
<div>
{t('mcpServers.config.url')}:{' '}
<code className="bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs">{server.config.url}</code>
<code className="rounded bg-gray-100 px-1 text-xs dark:bg-gray-800">{server.config.url}</code>
</div>
)}
{server.config?.args && server.config.args.length > 0 && (
<div>
{t('mcpServers.config.args')}:{' '}
<code className="bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs">{server.config.args.join(' ')}</code>
<code className="rounded bg-gray-100 px-1 text-xs dark:bg-gray-800">{server.config.args.join(' ')}</code>
</div>
)}
</div>
{testResult && (
<div className={`mt-2 p-2 rounded text-xs ${
<div className={`mt-2 rounded p-2 text-xs ${
testResult.success
? 'bg-green-50 dark:bg-green-900/20 text-green-800 dark:text-green-200'
: 'bg-red-50 dark:bg-red-900/20 text-red-800 dark:text-red-200'
? 'bg-green-50 text-green-800 dark:bg-green-900/20 dark:text-green-200'
: 'bg-red-50 text-red-800 dark:bg-red-900/20 dark:text-red-200'
}`}
>
<div className="font-medium">{testResult.message}</div>
@@ -132,13 +131,13 @@ function ClaudeMcpServers({
)}
{toolsResult && toolsResult.tools && toolsResult.tools.length > 0 && (
<div className="mt-2 p-2 rounded text-xs bg-blue-50 dark:bg-blue-900/20 text-blue-800 dark:text-blue-200">
<div className="mt-2 rounded bg-blue-50 p-2 text-xs text-blue-800 dark:bg-blue-900/20 dark:text-blue-200">
<div className="font-medium">
{t('mcpServers.tools.title')} {t('mcpServers.tools.count', { count: toolsResult.tools.length })}
</div>
<div className="flex flex-wrap gap-1 mt-1">
<div className="mt-1 flex flex-wrap gap-1">
{toolsResult.tools.slice(0, 5).map((tool, index) => (
<code key={`${tool.name}-${index}`} className="bg-blue-100 dark:bg-blue-800 px-1 rounded">
<code key={`${tool.name}-${index}`} className="rounded bg-blue-100 px-1 dark:bg-blue-800">
{tool.name}
</code>
))}
@@ -152,7 +151,7 @@ function ClaudeMcpServers({
)}
</div>
<div className="flex items-center gap-2 ml-4">
<div className="ml-4 flex items-center gap-2">
<Button
onClick={() => onEdit(server)}
variant="ghost"
@@ -160,7 +159,7 @@ function ClaudeMcpServers({
className="text-gray-600 hover:text-gray-700"
title={t('mcpServers.actions.edit')}
>
<Edit3 className="w-4 h-4" />
<Edit3 className="h-4 w-4" />
</Button>
<Button
onClick={() => onDelete(serverId, server.scope)}
@@ -169,7 +168,7 @@ function ClaudeMcpServers({
className="text-red-600 hover:text-red-700"
title={t('mcpServers.actions.delete')}
>
<Trash2 className="w-4 h-4" />
<Trash2 className="h-4 w-4" />
</Button>
</div>
</div>
@@ -177,7 +176,7 @@ function ClaudeMcpServers({
);
})}
{servers.length === 0 && (
<div className="text-center py-8 text-gray-500 dark:text-gray-400">{t('mcpServers.empty')}</div>
<div className="py-8 text-center text-gray-500 dark:text-gray-400">{t('mcpServers.empty')}</div>
)}
</div>
</div>
@@ -198,14 +197,14 @@ function CursorMcpServers({ servers, onAdd, onEdit, onDelete }: Omit<CursorMcpSe
return (
<div className="space-y-4">
<div className="flex items-center gap-3">
<Server className="w-5 h-5 text-purple-500" />
<Server className="h-5 w-5 text-purple-500" />
<h3 className="text-lg font-medium text-foreground">{t('mcpServers.title')}</h3>
</div>
<p className="text-sm text-muted-foreground">{t('mcpServers.description.cursor')}</p>
<div className="flex justify-between items-center">
<Button onClick={onAdd} className="bg-purple-600 hover:bg-purple-700 text-white" size="sm">
<Plus className="w-4 h-4 mr-2" />
<div className="flex items-center justify-between">
<Button onClick={onAdd} className="bg-purple-600 text-white hover:bg-purple-700" size="sm">
<Plus className="mr-2 h-4 w-4" />
{t('mcpServers.addButton')}
</Button>
</div>
@@ -215,11 +214,11 @@ function CursorMcpServers({ servers, onAdd, onEdit, onDelete }: Omit<CursorMcpSe
const serverId = server.id || server.name;
return (
<div key={serverId} className="bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4">
<div key={serverId} className="rounded-lg border border-gray-200 bg-gray-50 p-4 dark:border-gray-700 dark:bg-gray-900/50">
<div className="flex items-start justify-between">
<div className="flex-1">
<div className="flex items-center gap-2 mb-2">
<Terminal className="w-4 h-4" />
<div className="mb-2 flex items-center gap-2">
<Terminal className="h-4 w-4" />
<span className="font-medium text-foreground">{server.name}</span>
<Badge variant="outline" className="text-xs">stdio</Badge>
</div>
@@ -227,12 +226,12 @@ function CursorMcpServers({ servers, onAdd, onEdit, onDelete }: Omit<CursorMcpSe
{server.config?.command && (
<div>
{t('mcpServers.config.command')}:{' '}
<code className="bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs">{server.config.command}</code>
<code className="rounded bg-gray-100 px-1 text-xs dark:bg-gray-800">{server.config.command}</code>
</div>
)}
</div>
</div>
<div className="flex items-center gap-2 ml-4">
<div className="ml-4 flex items-center gap-2">
<Button
onClick={() => onEdit(server)}
variant="ghost"
@@ -240,7 +239,7 @@ function CursorMcpServers({ servers, onAdd, onEdit, onDelete }: Omit<CursorMcpSe
className="text-gray-600 hover:text-gray-700"
title={t('mcpServers.actions.edit')}
>
<Edit3 className="w-4 h-4" />
<Edit3 className="h-4 w-4" />
</Button>
<Button
onClick={() => onDelete(serverId)}
@@ -249,7 +248,7 @@ function CursorMcpServers({ servers, onAdd, onEdit, onDelete }: Omit<CursorMcpSe
className="text-red-600 hover:text-red-700"
title={t('mcpServers.actions.delete')}
>
<Trash2 className="w-4 h-4" />
<Trash2 className="h-4 w-4" />
</Button>
</div>
</div>
@@ -257,7 +256,7 @@ function CursorMcpServers({ servers, onAdd, onEdit, onDelete }: Omit<CursorMcpSe
);
})}
{servers.length === 0 && (
<div className="text-center py-8 text-gray-500 dark:text-gray-400">{t('mcpServers.empty')}</div>
<div className="py-8 text-center text-gray-500 dark:text-gray-400">{t('mcpServers.empty')}</div>
)}
</div>
</div>
@@ -279,14 +278,14 @@ function CodexMcpServers({ servers, onAdd, onEdit, onDelete, deleteError }: Omit
return (
<div className="space-y-4">
<div className="flex items-center gap-3">
<Server className="w-5 h-5 text-gray-700 dark:text-gray-300" />
<Server className="h-5 w-5 text-gray-700 dark:text-gray-300" />
<h3 className="text-lg font-medium text-foreground">{t('mcpServers.title')}</h3>
</div>
<p className="text-sm text-muted-foreground">{t('mcpServers.description.codex')}</p>
<div className="flex justify-between items-center">
<Button onClick={onAdd} className="bg-gray-800 hover:bg-gray-900 dark:bg-gray-700 dark:hover:bg-gray-600 text-white" size="sm">
<Plus className="w-4 h-4 mr-2" />
<div className="flex items-center justify-between">
<Button onClick={onAdd} className="bg-gray-800 text-white hover:bg-gray-900 dark:bg-gray-700 dark:hover:bg-gray-600" size="sm">
<Plus className="mr-2 h-4 w-4" />
{t('mcpServers.addButton')}
</Button>
</div>
@@ -298,32 +297,32 @@ function CodexMcpServers({ servers, onAdd, onEdit, onDelete, deleteError }: Omit
<div className="space-y-2">
{servers.map((server) => (
<div key={server.name} className="bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4">
<div key={server.name} className="rounded-lg border border-gray-200 bg-gray-50 p-4 dark:border-gray-700 dark:bg-gray-900/50">
<div className="flex items-start justify-between">
<div className="flex-1">
<div className="flex items-center gap-2 mb-2">
<Terminal className="w-4 h-4" />
<div className="mb-2 flex items-center gap-2">
<Terminal className="h-4 w-4" />
<span className="font-medium text-foreground">{server.name}</span>
<Badge variant="outline" className="text-xs">stdio</Badge>
</div>
<div className="text-sm text-muted-foreground space-y-1">
<div className="space-y-1 text-sm text-muted-foreground">
{server.config?.command && (
<div>
{t('mcpServers.config.command')}:{' '}
<code className="bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs">{server.config.command}</code>
<code className="rounded bg-gray-100 px-1 text-xs dark:bg-gray-800">{server.config.command}</code>
</div>
)}
{server.config?.args && server.config.args.length > 0 && (
<div>
{t('mcpServers.config.args')}:{' '}
<code className="bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs">{server.config.args.join(' ')}</code>
<code className="rounded bg-gray-100 px-1 text-xs dark:bg-gray-800">{server.config.args.join(' ')}</code>
</div>
)}
{server.config?.env && Object.keys(server.config.env).length > 0 && (
<div>
{t('mcpServers.config.environment')}:{' '}
<code className="bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs">
<code className="rounded bg-gray-100 px-1 text-xs dark:bg-gray-800">
{Object.entries(server.config.env).map(([key, value]) => `${key}=${maskSecret(value)}`).join(', ')}
</code>
</div>
@@ -331,7 +330,7 @@ function CodexMcpServers({ servers, onAdd, onEdit, onDelete, deleteError }: Omit
</div>
</div>
<div className="flex items-center gap-2 ml-4">
<div className="ml-4 flex items-center gap-2">
<Button
onClick={() => onEdit(server)}
variant="ghost"
@@ -339,7 +338,7 @@ function CodexMcpServers({ servers, onAdd, onEdit, onDelete, deleteError }: Omit
className="text-gray-600 hover:text-gray-700"
title={t('mcpServers.actions.edit')}
>
<Edit3 className="w-4 h-4" />
<Edit3 className="h-4 w-4" />
</Button>
<Button
onClick={() => onDelete(server.name)}
@@ -348,19 +347,19 @@ function CodexMcpServers({ servers, onAdd, onEdit, onDelete, deleteError }: Omit
className="text-red-600 hover:text-red-700"
title={t('mcpServers.actions.delete')}
>
<Trash2 className="w-4 h-4" />
<Trash2 className="h-4 w-4" />
</Button>
</div>
</div>
</div>
))}
{servers.length === 0 && (
<div className="text-center py-8 text-gray-500 dark:text-gray-400">{t('mcpServers.empty')}</div>
<div className="py-8 text-center text-gray-500 dark:text-gray-400">{t('mcpServers.empty')}</div>
)}
</div>
<div className="bg-gray-100 dark:bg-gray-800/50 border border-gray-300 dark:border-gray-600 rounded-lg p-4">
<h4 className="font-medium text-gray-900 dark:text-gray-100 mb-2">{t('mcpServers.help.title')}</h4>
<div className="rounded-lg border border-gray-300 bg-gray-100 p-4 dark:border-gray-600 dark:bg-gray-800/50">
<h4 className="mb-2 font-medium text-gray-900 dark:text-gray-100">{t('mcpServers.help.title')}</h4>
<p className="text-sm text-gray-700 dark:text-gray-300">{t('mcpServers.help.description')}</p>
</div>
</div>

View File

@@ -1,8 +1,7 @@
import { useState } from 'react';
import { AlertTriangle, Plus, Shield, X } from 'lucide-react';
import { useTranslation } from 'react-i18next';
import { Button } from '../../../../../../ui/button';
import { Input } from '../../../../../../ui/input';
import { Button, Input } from '../../../../../../../shared/view/ui';
import type { CodexPermissionMode, GeminiPermissionMode } from '../../../../../types/types';
const COMMON_CLAUDE_TOOLS = [
@@ -96,16 +95,16 @@ function ClaudePermissions({
<div className="space-y-6">
<div className="space-y-4">
<div className="flex items-center gap-3">
<AlertTriangle className="w-5 h-5 text-orange-500" />
<AlertTriangle className="h-5 w-5 text-orange-500" />
<h3 className="text-lg font-medium text-foreground">{t('permissions.title')}</h3>
</div>
<div className="bg-orange-50 dark:bg-orange-900/20 border border-orange-200 dark:border-orange-800 rounded-lg p-4">
<div className="rounded-lg border border-orange-200 bg-orange-50 p-4 dark:border-orange-800 dark:bg-orange-900/20">
<label className="flex items-center gap-3">
<input
type="checkbox"
checked={skipPermissions}
onChange={(event) => onSkipPermissionsChange(event.target.checked)}
className="w-4 h-4 text-blue-600 bg-gray-100 dark:bg-gray-700 border-gray-300 dark:border-gray-600 rounded focus:ring-blue-500 focus:ring-2"
className="h-4 w-4 rounded border-gray-300 bg-gray-100 text-blue-600 focus:ring-2 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700"
/>
<div>
<div className="font-medium text-orange-900 dark:text-orange-100">
@@ -121,12 +120,12 @@ function ClaudePermissions({
<div className="space-y-4">
<div className="flex items-center gap-3">
<Shield className="w-5 h-5 text-green-500" />
<Shield className="h-5 w-5 text-green-500" />
<h3 className="text-lg font-medium text-foreground">{t('permissions.allowedTools.title')}</h3>
</div>
<p className="text-sm text-muted-foreground">{t('permissions.allowedTools.description')}</p>
<div className="flex flex-col sm:flex-row gap-2">
<div className="flex flex-col gap-2 sm:flex-row">
<Input
value={newAllowedTool}
onChange={(event) => setNewAllowedTool(event.target.value)}
@@ -137,7 +136,7 @@ function ClaudePermissions({
handleAddAllowedTool(newAllowedTool);
}
}}
className="flex-1 h-10"
className="h-10 flex-1"
/>
<Button
onClick={() => handleAddAllowedTool(newAllowedTool)}
@@ -145,7 +144,7 @@ function ClaudePermissions({
size="sm"
className="h-10 px-4"
>
<Plus className="w-4 h-4 mr-2 sm:mr-0" />
<Plus className="mr-2 h-4 w-4 sm:mr-0" />
<span className="sm:hidden">{t('permissions.actions.add')}</span>
</Button>
</div>
@@ -162,7 +161,7 @@ function ClaudePermissions({
size="sm"
onClick={() => handleAddAllowedTool(tool)}
disabled={allowedTools.includes(tool)}
className="text-xs h-8"
className="h-8 text-xs"
>
{tool}
</Button>
@@ -172,7 +171,7 @@ function ClaudePermissions({
<div className="space-y-2">
{allowedTools.map((tool) => (
<div key={tool} className="flex items-center justify-between bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-3">
<div key={tool} className="flex items-center justify-between rounded-lg border border-green-200 bg-green-50 p-3 dark:border-green-800 dark:bg-green-900/20">
<span className="font-mono text-sm text-green-800 dark:text-green-200">{tool}</span>
<Button
variant="ghost"
@@ -180,12 +179,12 @@ function ClaudePermissions({
onClick={() => onAllowedToolsChange(removeValue(allowedTools, tool))}
className="text-green-600 hover:text-green-700"
>
<X className="w-4 h-4" />
<X className="h-4 w-4" />
</Button>
</div>
))}
{allowedTools.length === 0 && (
<div className="text-center py-6 text-gray-500 dark:text-gray-400">
<div className="py-6 text-center text-gray-500 dark:text-gray-400">
{t('permissions.allowedTools.empty')}
</div>
)}
@@ -194,12 +193,12 @@ function ClaudePermissions({
<div className="space-y-4">
<div className="flex items-center gap-3">
<AlertTriangle className="w-5 h-5 text-red-500" />
<AlertTriangle className="h-5 w-5 text-red-500" />
<h3 className="text-lg font-medium text-foreground">{t('permissions.blockedTools.title')}</h3>
</div>
<p className="text-sm text-muted-foreground">{t('permissions.blockedTools.description')}</p>
<div className="flex flex-col sm:flex-row gap-2">
<div className="flex flex-col gap-2 sm:flex-row">
<Input
value={newDisallowedTool}
onChange={(event) => setNewDisallowedTool(event.target.value)}
@@ -210,7 +209,7 @@ function ClaudePermissions({
handleAddDisallowedTool(newDisallowedTool);
}
}}
className="flex-1 h-10"
className="h-10 flex-1"
/>
<Button
onClick={() => handleAddDisallowedTool(newDisallowedTool)}
@@ -218,14 +217,14 @@ function ClaudePermissions({
size="sm"
className="h-10 px-4"
>
<Plus className="w-4 h-4 mr-2 sm:mr-0" />
<Plus className="mr-2 h-4 w-4 sm:mr-0" />
<span className="sm:hidden">{t('permissions.actions.add')}</span>
</Button>
</div>
<div className="space-y-2">
{disallowedTools.map((tool) => (
<div key={tool} className="flex items-center justify-between bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-3">
<div key={tool} className="flex items-center justify-between rounded-lg border border-red-200 bg-red-50 p-3 dark:border-red-800 dark:bg-red-900/20">
<span className="font-mono text-sm text-red-800 dark:text-red-200">{tool}</span>
<Button
variant="ghost"
@@ -233,27 +232,27 @@ function ClaudePermissions({
onClick={() => onDisallowedToolsChange(removeValue(disallowedTools, tool))}
className="text-red-600 hover:text-red-700"
>
<X className="w-4 h-4" />
<X className="h-4 w-4" />
</Button>
</div>
))}
{disallowedTools.length === 0 && (
<div className="text-center py-6 text-gray-500 dark:text-gray-400">
<div className="py-6 text-center text-gray-500 dark:text-gray-400">
{t('permissions.blockedTools.empty')}
</div>
)}
</div>
</div>
<div className="bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4">
<h4 className="font-medium text-blue-900 dark:text-blue-100 mb-2">
<div className="rounded-lg border border-blue-200 bg-blue-50 p-4 dark:border-blue-800 dark:bg-blue-900/20">
<h4 className="mb-2 font-medium text-blue-900 dark:text-blue-100">
{t('permissions.toolExamples.title')}
</h4>
<ul className="text-sm text-blue-800 dark:text-blue-200 space-y-1">
<li><code className="bg-blue-100 dark:bg-blue-800 px-1 rounded">"Bash(git log:*)"</code> {t('permissions.toolExamples.bashGitLog')}</li>
<li><code className="bg-blue-100 dark:bg-blue-800 px-1 rounded">"Bash(git diff:*)"</code> {t('permissions.toolExamples.bashGitDiff')}</li>
<li><code className="bg-blue-100 dark:bg-blue-800 px-1 rounded">"Write"</code> {t('permissions.toolExamples.write')}</li>
<li><code className="bg-blue-100 dark:bg-blue-800 px-1 rounded">"Bash(rm:*)"</code> {t('permissions.toolExamples.bashRm')}</li>
<ul className="space-y-1 text-sm text-blue-800 dark:text-blue-200">
<li><code className="rounded bg-blue-100 px-1 dark:bg-blue-800">"Bash(git log:*)"</code> {t('permissions.toolExamples.bashGitLog')}</li>
<li><code className="rounded bg-blue-100 px-1 dark:bg-blue-800">"Bash(git diff:*)"</code> {t('permissions.toolExamples.bashGitDiff')}</li>
<li><code className="rounded bg-blue-100 px-1 dark:bg-blue-800">"Write"</code> {t('permissions.toolExamples.write')}</li>
<li><code className="rounded bg-blue-100 px-1 dark:bg-blue-800">"Bash(rm:*)"</code> {t('permissions.toolExamples.bashRm')}</li>
</ul>
</div>
</div>
@@ -306,16 +305,16 @@ function CursorPermissions({
<div className="space-y-6">
<div className="space-y-4">
<div className="flex items-center gap-3">
<AlertTriangle className="w-5 h-5 text-orange-500" />
<AlertTriangle className="h-5 w-5 text-orange-500" />
<h3 className="text-lg font-medium text-foreground">{t('permissions.title')}</h3>
</div>
<div className="bg-orange-50 dark:bg-orange-900/20 border border-orange-200 dark:border-orange-800 rounded-lg p-4">
<div className="rounded-lg border border-orange-200 bg-orange-50 p-4 dark:border-orange-800 dark:bg-orange-900/20">
<label className="flex items-center gap-3">
<input
type="checkbox"
checked={skipPermissions}
onChange={(event) => onSkipPermissionsChange(event.target.checked)}
className="w-4 h-4 text-purple-600 bg-gray-100 dark:bg-gray-700 border-gray-300 dark:border-gray-600 rounded focus:ring-purple-500 focus:ring-2"
className="h-4 w-4 rounded border-gray-300 bg-gray-100 text-purple-600 focus:ring-2 focus:ring-purple-500 dark:border-gray-600 dark:bg-gray-700"
/>
<div>
<div className="font-medium text-orange-900 dark:text-orange-100">
@@ -331,12 +330,12 @@ function CursorPermissions({
<div className="space-y-4">
<div className="flex items-center gap-3">
<Shield className="w-5 h-5 text-green-500" />
<Shield className="h-5 w-5 text-green-500" />
<h3 className="text-lg font-medium text-foreground">{t('permissions.allowedCommands.title')}</h3>
</div>
<p className="text-sm text-muted-foreground">{t('permissions.allowedCommands.description')}</p>
<div className="flex flex-col sm:flex-row gap-2">
<div className="flex flex-col gap-2 sm:flex-row">
<Input
value={newAllowedCommand}
onChange={(event) => setNewAllowedCommand(event.target.value)}
@@ -347,7 +346,7 @@ function CursorPermissions({
handleAddAllowedCommand(newAllowedCommand);
}
}}
className="flex-1 h-10"
className="h-10 flex-1"
/>
<Button
onClick={() => handleAddAllowedCommand(newAllowedCommand)}
@@ -355,7 +354,7 @@ function CursorPermissions({
size="sm"
className="h-10 px-4"
>
<Plus className="w-4 h-4 mr-2 sm:mr-0" />
<Plus className="mr-2 h-4 w-4 sm:mr-0" />
<span className="sm:hidden">{t('permissions.actions.add')}</span>
</Button>
</div>
@@ -372,7 +371,7 @@ function CursorPermissions({
size="sm"
onClick={() => handleAddAllowedCommand(command)}
disabled={allowedCommands.includes(command)}
className="text-xs h-8"
className="h-8 text-xs"
>
{command}
</Button>
@@ -382,7 +381,7 @@ function CursorPermissions({
<div className="space-y-2">
{allowedCommands.map((command) => (
<div key={command} className="flex items-center justify-between bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-3">
<div key={command} className="flex items-center justify-between rounded-lg border border-green-200 bg-green-50 p-3 dark:border-green-800 dark:bg-green-900/20">
<span className="font-mono text-sm text-green-800 dark:text-green-200">{command}</span>
<Button
variant="ghost"
@@ -390,12 +389,12 @@ function CursorPermissions({
onClick={() => onAllowedCommandsChange(removeValue(allowedCommands, command))}
className="text-green-600 hover:text-green-700"
>
<X className="w-4 h-4" />
<X className="h-4 w-4" />
</Button>
</div>
))}
{allowedCommands.length === 0 && (
<div className="text-center py-6 text-gray-500 dark:text-gray-400">
<div className="py-6 text-center text-gray-500 dark:text-gray-400">
{t('permissions.allowedCommands.empty')}
</div>
)}
@@ -404,12 +403,12 @@ function CursorPermissions({
<div className="space-y-4">
<div className="flex items-center gap-3">
<AlertTriangle className="w-5 h-5 text-red-500" />
<AlertTriangle className="h-5 w-5 text-red-500" />
<h3 className="text-lg font-medium text-foreground">{t('permissions.blockedCommands.title')}</h3>
</div>
<p className="text-sm text-muted-foreground">{t('permissions.blockedCommands.description')}</p>
<div className="flex flex-col sm:flex-row gap-2">
<div className="flex flex-col gap-2 sm:flex-row">
<Input
value={newDisallowedCommand}
onChange={(event) => setNewDisallowedCommand(event.target.value)}
@@ -420,7 +419,7 @@ function CursorPermissions({
handleAddDisallowedCommand(newDisallowedCommand);
}
}}
className="flex-1 h-10"
className="h-10 flex-1"
/>
<Button
onClick={() => handleAddDisallowedCommand(newDisallowedCommand)}
@@ -428,14 +427,14 @@ function CursorPermissions({
size="sm"
className="h-10 px-4"
>
<Plus className="w-4 h-4 mr-2 sm:mr-0" />
<Plus className="mr-2 h-4 w-4 sm:mr-0" />
<span className="sm:hidden">{t('permissions.actions.add')}</span>
</Button>
</div>
<div className="space-y-2">
{disallowedCommands.map((command) => (
<div key={command} className="flex items-center justify-between bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-3">
<div key={command} className="flex items-center justify-between rounded-lg border border-red-200 bg-red-50 p-3 dark:border-red-800 dark:bg-red-900/20">
<span className="font-mono text-sm text-red-800 dark:text-red-200">{command}</span>
<Button
variant="ghost"
@@ -443,27 +442,27 @@ function CursorPermissions({
onClick={() => onDisallowedCommandsChange(removeValue(disallowedCommands, command))}
className="text-red-600 hover:text-red-700"
>
<X className="w-4 h-4" />
<X className="h-4 w-4" />
</Button>
</div>
))}
{disallowedCommands.length === 0 && (
<div className="text-center py-6 text-gray-500 dark:text-gray-400">
<div className="py-6 text-center text-gray-500 dark:text-gray-400">
{t('permissions.blockedCommands.empty')}
</div>
)}
</div>
</div>
<div className="bg-purple-50 dark:bg-purple-900/20 border border-purple-200 dark:border-purple-800 rounded-lg p-4">
<h4 className="font-medium text-purple-900 dark:text-purple-100 mb-2">
<div className="rounded-lg border border-purple-200 bg-purple-50 p-4 dark:border-purple-800 dark:bg-purple-900/20">
<h4 className="mb-2 font-medium text-purple-900 dark:text-purple-100">
{t('permissions.shellExamples.title')}
</h4>
<ul className="text-sm text-purple-800 dark:text-purple-200 space-y-1">
<li><code className="bg-purple-100 dark:bg-purple-800 px-1 rounded">"Shell(ls)"</code> {t('permissions.shellExamples.ls')}</li>
<li><code className="bg-purple-100 dark:bg-purple-800 px-1 rounded">"Shell(git status)"</code> {t('permissions.shellExamples.gitStatus')}</li>
<li><code className="bg-purple-100 dark:bg-purple-800 px-1 rounded">"Shell(npm install)"</code> {t('permissions.shellExamples.npmInstall')}</li>
<li><code className="bg-purple-100 dark:bg-purple-800 px-1 rounded">"Shell(rm -rf)"</code> {t('permissions.shellExamples.rmRf')}</li>
<ul className="space-y-1 text-sm text-purple-800 dark:text-purple-200">
<li><code className="rounded bg-purple-100 px-1 dark:bg-purple-800">"Shell(ls)"</code> {t('permissions.shellExamples.ls')}</li>
<li><code className="rounded bg-purple-100 px-1 dark:bg-purple-800">"Shell(git status)"</code> {t('permissions.shellExamples.gitStatus')}</li>
<li><code className="rounded bg-purple-100 px-1 dark:bg-purple-800">"Shell(npm install)"</code> {t('permissions.shellExamples.npmInstall')}</li>
<li><code className="rounded bg-purple-100 px-1 dark:bg-purple-800">"Shell(rm -rf)"</code> {t('permissions.shellExamples.rmRf')}</li>
</ul>
</div>
</div>
@@ -483,25 +482,25 @@ function CodexPermissions({ permissionMode, onPermissionModeChange }: Omit<Codex
<div className="space-y-6">
<div className="space-y-4">
<div className="flex items-center gap-3">
<Shield className="w-5 h-5 text-green-500" />
<Shield className="h-5 w-5 text-green-500" />
<h3 className="text-lg font-medium text-foreground">{t('permissions.codex.permissionMode')}</h3>
</div>
<p className="text-sm text-muted-foreground">{t('permissions.codex.description')}</p>
<div
className={`border rounded-lg p-4 cursor-pointer transition-all ${permissionMode === 'default'
? 'bg-gray-100 dark:bg-gray-800 border-gray-400 dark:border-gray-500'
: 'bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600'
className={`cursor-pointer rounded-lg border p-4 transition-all ${permissionMode === 'default'
? 'border-gray-400 bg-gray-100 dark:border-gray-500 dark:bg-gray-800'
: 'border-gray-200 bg-gray-50 hover:border-gray-300 dark:border-gray-700 dark:bg-gray-900/50 dark:hover:border-gray-600'
}`}
onClick={() => onPermissionModeChange('default')}
>
<label className="flex items-start gap-3 cursor-pointer">
<label className="flex cursor-pointer items-start gap-3">
<input
type="radio"
name="codexPermissionMode"
checked={permissionMode === 'default'}
onChange={() => onPermissionModeChange('default')}
className="mt-1 w-4 h-4 text-green-600"
className="mt-1 h-4 w-4 text-green-600"
/>
<div>
<div className="font-medium text-foreground">{t('permissions.codex.modes.default.title')}</div>
@@ -513,19 +512,19 @@ function CodexPermissions({ permissionMode, onPermissionModeChange }: Omit<Codex
</div>
<div
className={`border rounded-lg p-4 cursor-pointer transition-all ${permissionMode === 'acceptEdits'
? 'bg-green-50 dark:bg-green-900/20 border-green-400 dark:border-green-600'
: 'bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600'
className={`cursor-pointer rounded-lg border p-4 transition-all ${permissionMode === 'acceptEdits'
? 'border-green-400 bg-green-50 dark:border-green-600 dark:bg-green-900/20'
: 'border-gray-200 bg-gray-50 hover:border-gray-300 dark:border-gray-700 dark:bg-gray-900/50 dark:hover:border-gray-600'
}`}
onClick={() => onPermissionModeChange('acceptEdits')}
>
<label className="flex items-start gap-3 cursor-pointer">
<label className="flex cursor-pointer items-start gap-3">
<input
type="radio"
name="codexPermissionMode"
checked={permissionMode === 'acceptEdits'}
onChange={() => onPermissionModeChange('acceptEdits')}
className="mt-1 w-4 h-4 text-green-600"
className="mt-1 h-4 w-4 text-green-600"
/>
<div>
<div className="font-medium text-green-900 dark:text-green-100">{t('permissions.codex.modes.acceptEdits.title')}</div>
@@ -537,24 +536,24 @@ function CodexPermissions({ permissionMode, onPermissionModeChange }: Omit<Codex
</div>
<div
className={`border rounded-lg p-4 cursor-pointer transition-all ${permissionMode === 'bypassPermissions'
? 'bg-orange-50 dark:bg-orange-900/20 border-orange-400 dark:border-orange-600'
: 'bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600'
className={`cursor-pointer rounded-lg border p-4 transition-all ${permissionMode === 'bypassPermissions'
? 'border-orange-400 bg-orange-50 dark:border-orange-600 dark:bg-orange-900/20'
: 'border-gray-200 bg-gray-50 hover:border-gray-300 dark:border-gray-700 dark:bg-gray-900/50 dark:hover:border-gray-600'
}`}
onClick={() => onPermissionModeChange('bypassPermissions')}
>
<label className="flex items-start gap-3 cursor-pointer">
<label className="flex cursor-pointer items-start gap-3">
<input
type="radio"
name="codexPermissionMode"
checked={permissionMode === 'bypassPermissions'}
onChange={() => onPermissionModeChange('bypassPermissions')}
className="mt-1 w-4 h-4 text-orange-600"
className="mt-1 h-4 w-4 text-orange-600"
/>
<div>
<div className="font-medium text-orange-900 dark:text-orange-100 flex items-center gap-2">
<div className="flex items-center gap-2 font-medium text-orange-900 dark:text-orange-100">
{t('permissions.codex.modes.bypassPermissions.title')}
<AlertTriangle className="w-4 h-4" />
<AlertTriangle className="h-4 w-4" />
</div>
<div className="text-sm text-orange-700 dark:text-orange-300">
{t('permissions.codex.modes.bypassPermissions.description')}
@@ -567,7 +566,7 @@ function CodexPermissions({ permissionMode, onPermissionModeChange }: Omit<Codex
<summary className="cursor-pointer text-muted-foreground hover:text-foreground">
{t('permissions.codex.technicalDetails')}
</summary>
<div className="mt-2 p-3 bg-gray-50 dark:bg-gray-900/50 rounded-lg text-xs text-muted-foreground space-y-2">
<div className="mt-2 space-y-2 rounded-lg bg-gray-50 p-3 text-xs text-muted-foreground dark:bg-gray-900/50">
<p><strong>{t('permissions.codex.modes.default.title')}:</strong> {t('permissions.codex.technicalInfo.default')}</p>
<p><strong>{t('permissions.codex.modes.acceptEdits.title')}:</strong> {t('permissions.codex.technicalInfo.acceptEdits')}</p>
<p><strong>{t('permissions.codex.modes.bypassPermissions.title')}:</strong> {t('permissions.codex.technicalInfo.bypassPermissions')}</p>
@@ -592,7 +591,7 @@ function GeminiPermissions({ permissionMode, onPermissionModeChange }: Omit<Gemi
<div className="space-y-6">
<div className="space-y-4">
<div className="flex items-center gap-3">
<Shield className="w-5 h-5 text-green-500" />
<Shield className="h-5 w-5 text-green-500" />
<h3 className="text-lg font-medium text-foreground">
{t('gemini.permissionMode')}
</h3>
@@ -603,19 +602,19 @@ function GeminiPermissions({ permissionMode, onPermissionModeChange }: Omit<Gemi
{/* Default Mode */}
<div
className={`border rounded-lg p-4 cursor-pointer transition-all ${permissionMode === 'default'
? 'bg-gray-100 dark:bg-gray-800 border-gray-400 dark:border-gray-500'
: 'bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600'
className={`cursor-pointer rounded-lg border p-4 transition-all ${permissionMode === 'default'
? 'border-gray-400 bg-gray-100 dark:border-gray-500 dark:bg-gray-800'
: 'border-gray-200 bg-gray-50 hover:border-gray-300 dark:border-gray-700 dark:bg-gray-900/50 dark:hover:border-gray-600'
}`}
onClick={() => onPermissionModeChange('default')}
>
<label className="flex items-start gap-3 cursor-pointer">
<label className="flex cursor-pointer items-start gap-3">
<input
type="radio"
name="geminiPermissionMode"
checked={permissionMode === 'default'}
onChange={() => onPermissionModeChange('default')}
className="mt-1 w-4 h-4 text-green-600"
className="mt-1 h-4 w-4 text-green-600"
/>
<div>
<div className="font-medium text-foreground">{t('gemini.modes.default.title')}</div>
@@ -628,19 +627,19 @@ function GeminiPermissions({ permissionMode, onPermissionModeChange }: Omit<Gemi
{/* Auto Edit Mode */}
<div
className={`border rounded-lg p-4 cursor-pointer transition-all ${permissionMode === 'auto_edit'
? 'bg-green-50 dark:bg-green-900/20 border-green-400 dark:border-green-600'
: 'bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600'
className={`cursor-pointer rounded-lg border p-4 transition-all ${permissionMode === 'auto_edit'
? 'border-green-400 bg-green-50 dark:border-green-600 dark:bg-green-900/20'
: 'border-gray-200 bg-gray-50 hover:border-gray-300 dark:border-gray-700 dark:bg-gray-900/50 dark:hover:border-gray-600'
}`}
onClick={() => onPermissionModeChange('auto_edit')}
>
<label className="flex items-start gap-3 cursor-pointer">
<label className="flex cursor-pointer items-start gap-3">
<input
type="radio"
name="geminiPermissionMode"
checked={permissionMode === 'auto_edit'}
onChange={() => onPermissionModeChange('auto_edit')}
className="mt-1 w-4 h-4 text-green-600"
className="mt-1 h-4 w-4 text-green-600"
/>
<div>
<div className="font-medium text-green-900 dark:text-green-100">{t('gemini.modes.autoEdit.title')}</div>
@@ -653,24 +652,24 @@ function GeminiPermissions({ permissionMode, onPermissionModeChange }: Omit<Gemi
{/* YOLO Mode */}
<div
className={`border rounded-lg p-4 cursor-pointer transition-all ${permissionMode === 'yolo'
? 'bg-orange-50 dark:bg-orange-900/20 border-orange-400 dark:border-orange-600'
: 'bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600'
className={`cursor-pointer rounded-lg border p-4 transition-all ${permissionMode === 'yolo'
? 'border-orange-400 bg-orange-50 dark:border-orange-600 dark:bg-orange-900/20'
: 'border-gray-200 bg-gray-50 hover:border-gray-300 dark:border-gray-700 dark:bg-gray-900/50 dark:hover:border-gray-600'
}`}
onClick={() => onPermissionModeChange('yolo')}
>
<label className="flex items-start gap-3 cursor-pointer">
<label className="flex cursor-pointer items-start gap-3">
<input
type="radio"
name="geminiPermissionMode"
checked={permissionMode === 'yolo'}
onChange={() => onPermissionModeChange('yolo')}
className="mt-1 w-4 h-4 text-orange-600"
className="mt-1 h-4 w-4 text-orange-600"
/>
<div>
<div className="font-medium text-orange-900 dark:text-orange-100 flex items-center gap-2">
<div className="flex items-center gap-2 font-medium text-orange-900 dark:text-orange-100">
{t('gemini.modes.yolo.title')}
<AlertTriangle className="w-4 h-4" />
<AlertTriangle className="h-4 w-4" />
</div>
<div className="text-sm text-orange-700 dark:text-orange-300">
{t('gemini.modes.yolo.description')}