claude-code-best/src/components/InvalidSettingsDialog.tsx
2026-05-01 21:39:30 +08:00

43 lines
1.2 KiB
TypeScript

import React from 'react';
import { Text, Dialog } from '@anthropic/ink';
import type { ValidationError } from '../utils/settings/validation.js';
import { Select } from './CustomSelect/index.js';
import { ValidationErrorsList } from './ValidationErrorsList.js';
type Props = {
settingsErrors: ValidationError[];
onContinue: () => void;
onExit: () => void;
};
/**
* Dialog shown when settings files have validation errors.
* User must choose to continue (skipping invalid files) or exit to fix them.
*/
export function InvalidSettingsDialog({ settingsErrors, onContinue, onExit }: Props): React.ReactNode {
function handleSelect(value: string): void {
if (value === 'exit') {
onExit();
} else {
onContinue();
}
}
return (
<Dialog title="Settings Error" onCancel={onExit} color="warning">
<ValidationErrorsList errors={settingsErrors} />
<Text dimColor>Files with errors are skipped entirely, not just the invalid settings.</Text>
<Select
options={[
{ label: 'Exit and fix manually', value: 'exit' },
{
label: 'Continue without these settings',
value: 'continue',
},
]}
onChange={handleSelect}
/>
</Dialog>
);
}