Jason
|
d9c56511b1
|
refactor: split CodexConfigEditor into specialized components
Before optimization:
- CodexConfigEditor.tsx: 675 lines (monolithic component)
After optimization:
- CodexConfigEditor.tsx: 131 lines (-81%, orchestration only)
- CodexQuickWizardModal.tsx: 325 lines (quick wizard modal)
- CodexCommonConfigModal.tsx: 126 lines (common config modal)
- CodexConfigSections.tsx: 150 lines (auth & config sections)
- Total: 732 lines (+57 lines, but highly modular)
Benefits:
✅ Single Responsibility: each component has one clear purpose
✅ Maintainability: reduced file size makes code easier to understand
✅ Reusability: modal components can be used independently
✅ Testability: isolated components are easier to test
✅ Readability: main component is now just orchestration logic
✅ Consistency: follows same modal patterns across app
Component breakdown:
- CodexConfigEditor: orchestration + state management (131 lines)
- CodexQuickWizardModal: step-by-step wizard for quick config (325 lines)
- CodexCommonConfigModal: common TOML configuration editor (126 lines)
- CodexAuthSection: auth.json editor UI (70 lines)
- CodexConfigSection: config.toml editor UI (80 lines)
|
2025-10-17 18:38:49 +08:00 |
|