Commit Graph

10 Commits

  • feat(gemini): add Gemini provider integration (#202)
    * feat(gemini): add Gemini provider integration
    
    - Add gemini_config.rs module for .env file parsing
    - Extend AppType enum to support Gemini
    - Implement GeminiConfigEditor and GeminiFormFields components
    - Add GeminiIcon with standardized 1024x1024 viewBox
    - Add Gemini provider presets configuration
    - Update i18n translations for Gemini support
    - Extend ProviderService and McpService for Gemini
    
    * fix(gemini): resolve TypeScript errors, add i18n support, and fix MCP logic
    
    **Critical Fixes:**
    - Fix TS2741 errors in tests/msw/state.ts by adding missing Gemini type definitions
    - Fix ProviderCard.extractApiUrl to support GOOGLE_GEMINI_BASE_URL display
    - Add missing apps.gemini i18n keys (zh/en) for proper app name display
    - Fix MCP service Gemini cross-app duplication logic to prevent self-copy
    
    **Technical Details:**
    - tests/msw/state.ts: Add gemini default providers, current ID, and MCP config
    - ProviderCard.tsx: Check both ANTHROPIC_BASE_URL and GOOGLE_GEMINI_BASE_URL
    - services/mcp.rs: Skip Gemini in sync_other_side logic with unreachable!() guards
    - Run pnpm format to auto-fix code style issues
    
    **Verification:**
    -  pnpm typecheck passes
    -  pnpm format completed
    
    * feat(gemini): enhance authentication and config parsing
    
    - Add strict and lenient .env parsing modes
    - Implement PackyCode partner authentication detection
    - Support Google OAuth official authentication
    - Auto-configure security.auth.selectedType for PackyCode
    - Add comprehensive test coverage for all auth types
    - Update i18n for OAuth hints and Gemini config
    
    ---------
    
    Co-authored-by: Jason <farion1231@gmail.com>
  • feat(editor): add JSON format button to editors
    Add one-click format functionality for JSON editors with toast notifications:
    
    - Add format button to JsonEditor (CodeMirror)
    - Add format button to CodexAuthSection (auth.json)
    - Add format button to CommonConfigEditor (settings + modal)
    - Add formatJSON utility function
    - Add i18n keys: format, formatSuccess, formatError
    
    Note: TOML formatting was intentionally NOT added to avoid losing comments
    during parse/stringify operations. TOML validation remains available via
    the existing useCodexTomlValidation hook.
  • fix(provider): add footer and improve layout spacing for common config editor dialog
    - Add DialogFooter with Cancel and Save buttons to match Codex common config modal
    - Improve dialog layout spacing with proper padding (px-6, py-4)
    - Add flex layout with overflow handling for better responsiveness
    - Fix content being too close to dialog edges
  • refactor: unify focus styles across all input fields
    Replace inconsistent focus border styles with a unified soft blue ring effect
    across all input and textarea components.
    
    Changes:
    - Add consistent focus:ring styles to Input and Textarea components
    - Use focus:ring-blue-500/20 (light) and focus:ring-blue-400/20 (dark)
    - Remove focus border color changes for a more subtle design
    - Update ApiKeyInput to match the unified focus style
    - Update all manual textarea elements (Codex and Claude configs)
    
    Benefits:
    - Consistent visual feedback across all form inputs
    - Soft, elegant focus indication with blue glow effect
    - No jarring border color changes
    - Better user experience with subtle, professional styling
    
    The focus effect now uses only a soft blue ring (20% opacity) without
    changing border colors, creating a more refined and less distracting
    interaction pattern.
  • refactor: replace CodeMirror with plain textarea in config editors
    Replace JsonEditor (CodeMirror) with plain HTML textarea elements in Claude
    config editors to maintain consistency with Codex config editors and eliminate
    theme conflicts.
    
    Changes:
    - Replace JsonEditor with textarea in ClaudeConfigEditor.tsx
    - Replace JsonEditor with textarea in CommonConfigEditor.tsx
    - Remove unnecessary dark mode detection logic
    - Remove wrapper div with border class that caused double borders
    - Apply unified border design system (border-border-default)
    - Keep JsonEditor in UsageScriptModal for JavaScript code editing
    
    Benefits:
    - Eliminates CodeMirror theme conflicts with oneDark
    - Simplifies codebase by removing unnecessary abstractions
    - Consistent styling across all config input fields
    - Automatic theme adaptation via CSS variables
  • refactor: implement unified border design system
    - Define custom border utilities in @layer utilities for consistent theming
    - Add border-default (1px gray), border-active (2px primary), border-hover (40% primary), and border-dragging (60% primary) classes
    - Update all UI components (Input, Select, TextArea, Button, Dialog, Dropdown) to use unified border classes
    - Replace hardcoded border colors (gray-200/300/600/700) with theme-responsive border-border-default
    - Update provider cards, MCP components, settings, and forms with new border system
    - Remove dark mode border overrides to simplify CSS and improve maintainability
    - Ensure all borders automatically adapt to light/dark themes via CSS variables
  • i18n: complete internationalization for provider and usage query panels
    - Add 45+ new translation keys for usage query and usage script features
    - Fix duplicate provider object in translation files that caused missing translations
    - Remove all hardcoded Chinese text and defaultValue fallbacks from components
    - Add proper translations for:
      * Usage footer (query status, plan usage display)
      * Usage script modal (script editor, validation, test controls)
      * Provider forms (basic fields, endpoints, model selectors)
      * Provider dialogs (add/edit hints and titles)
    
    Modified 16 files:
    - 2 translation files (zh.json, en.json)
    - 14 component files (removed defaultValue, added t() calls)
    
    All UI text now properly supports Chinese/English switching.
  • fix: unify dialog layout and fix content padding issues
    - Fix negative margin overflow in all dialog content areas
    - Standardize dialog structure with flex-col layout
    - Add consistent py-4 spacing to all content areas
    - Ensure proper spacing between header, content, and footer
    
    Affected components:
    - AddProviderDialog, EditProviderDialog
    - McpFormModal, McpPanel
    - UsageScriptModal
    - SettingsDialog
    
    All dialogs now follow unified layout pattern:
    - DialogContent: flex flex-col max-h-[90vh]
    - Content area: flex-1 overflow-y-auto px-6 py-4
    - No negative margins that cause content overflow
  • feat: add Claude common config snippet functionality
    - Create useCommonConfigSnippet hook to manage common config state
    - Create CommonConfigEditor component with modal for editing
    - Support merging/removing common config snippets from provider configs
    - Persist common config to localStorage for reuse across providers
    - Auto-detect if provider config contains common snippet
    - Replace JSON editor with CommonConfigEditor in ProviderForm