mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-08-03 02:51:17 +08:00
feat(ui): add merge preview to common config editor components
Add real-time merge preview functionality to all config editor components (Claude, Codex, Gemini) that shows the final merged configuration when common config is enabled. UI changes: - Add finalConfig/finalEnv prop to display merged result - Add toggle button to show/hide merge preview (Eye/EyeOff icons) - Auto-show preview when common config is enabled - Display custom config editor with label when preview is visible - Show read-only merged preview below custom config - Add visual indicators: "只读" badge, green hint text The preview helps users understand how their custom configuration combines with the shared common config template before saving.
This commit is contained in:
@@ -30,6 +30,9 @@ interface CodexConfigEditorProps {
|
||||
onExtract?: () => void;
|
||||
|
||||
isExtracting?: boolean;
|
||||
|
||||
/** 最终合并后的配置(只读预览) */
|
||||
finalConfig?: string;
|
||||
}
|
||||
|
||||
const CodexConfigEditor: React.FC<CodexConfigEditorProps> = ({
|
||||
@@ -47,6 +50,7 @@ const CodexConfigEditor: React.FC<CodexConfigEditorProps> = ({
|
||||
configError,
|
||||
onExtract,
|
||||
isExtracting,
|
||||
finalConfig,
|
||||
}) => {
|
||||
const [isCommonConfigModalOpen, setIsCommonConfigModalOpen] = useState(false);
|
||||
|
||||
@@ -76,6 +80,7 @@ const CodexConfigEditor: React.FC<CodexConfigEditorProps> = ({
|
||||
onEditCommonConfig={() => setIsCommonConfigModalOpen(true)}
|
||||
commonConfigError={commonConfigError}
|
||||
configError={configError}
|
||||
finalConfig={finalConfig}
|
||||
/>
|
||||
|
||||
{/* Common Config Modal */}
|
||||
|
||||
Reference in New Issue
Block a user