mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-17 22:05:50 +00:00
style: 完成所有文件的lint
This commit is contained in:
@@ -1,19 +1,19 @@
|
||||
import React, { useCallback, useState } from 'react'
|
||||
import type { Workflow } from '../commands/install-github-app/types.js'
|
||||
import type { ExitState } from '../hooks/useExitOnCtrlCDWithKeybindings.js'
|
||||
import { Box, Link, Text, Byline, Dialog, KeyboardShortcutHint } from '@anthropic/ink'
|
||||
import { ConfigurableShortcutHint } from './ConfigurableShortcutHint.js'
|
||||
import { SelectMulti } from './CustomSelect/SelectMulti.js'
|
||||
import React, { useCallback, useState } from 'react';
|
||||
import type { Workflow } from '../commands/install-github-app/types.js';
|
||||
import type { ExitState } from '../hooks/useExitOnCtrlCDWithKeybindings.js';
|
||||
import { Box, Link, Text, Byline, Dialog, KeyboardShortcutHint } from '@anthropic/ink';
|
||||
import { ConfigurableShortcutHint } from './ConfigurableShortcutHint.js';
|
||||
import { SelectMulti } from './CustomSelect/SelectMulti.js';
|
||||
|
||||
type WorkflowOption = {
|
||||
value: Workflow
|
||||
label: string
|
||||
}
|
||||
value: Workflow;
|
||||
label: string;
|
||||
};
|
||||
|
||||
type Props = {
|
||||
onSubmit: (selectedWorkflows: Workflow[]) => void
|
||||
defaultSelections: Workflow[]
|
||||
}
|
||||
onSubmit: (selectedWorkflows: Workflow[]) => void;
|
||||
defaultSelections: Workflow[];
|
||||
};
|
||||
|
||||
const WORKFLOWS: WorkflowOption[] = [
|
||||
{
|
||||
@@ -24,53 +24,45 @@ const WORKFLOWS: WorkflowOption[] = [
|
||||
value: 'claude-review' as const,
|
||||
label: 'Claude Code Review - Automated code review on new PRs',
|
||||
},
|
||||
]
|
||||
];
|
||||
|
||||
function renderInputGuide(exitState: ExitState): React.ReactNode {
|
||||
if (exitState.pending) {
|
||||
return <Text>Press {exitState.keyName} again to exit</Text>
|
||||
return <Text>Press {exitState.keyName} again to exit</Text>;
|
||||
}
|
||||
return (
|
||||
<Byline>
|
||||
<KeyboardShortcutHint shortcut="↑↓" action="navigate" />
|
||||
<KeyboardShortcutHint shortcut="Space" action="toggle" />
|
||||
<KeyboardShortcutHint shortcut="Enter" action="confirm" />
|
||||
<ConfigurableShortcutHint
|
||||
action="confirm:no"
|
||||
context="Confirmation"
|
||||
fallback="Esc"
|
||||
description="cancel"
|
||||
/>
|
||||
<ConfigurableShortcutHint action="confirm:no" context="Confirmation" fallback="Esc" description="cancel" />
|
||||
</Byline>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export function WorkflowMultiselectDialog({
|
||||
onSubmit,
|
||||
defaultSelections,
|
||||
}: Props): React.ReactNode {
|
||||
const [showError, setShowError] = useState(false)
|
||||
export function WorkflowMultiselectDialog({ onSubmit, defaultSelections }: Props): React.ReactNode {
|
||||
const [showError, setShowError] = useState(false);
|
||||
|
||||
const handleSubmit = useCallback(
|
||||
(selectedValues: Workflow[]) => {
|
||||
if (selectedValues.length === 0) {
|
||||
setShowError(true)
|
||||
return
|
||||
setShowError(true);
|
||||
return;
|
||||
}
|
||||
setShowError(false)
|
||||
onSubmit(selectedValues)
|
||||
setShowError(false);
|
||||
onSubmit(selectedValues);
|
||||
},
|
||||
[onSubmit],
|
||||
)
|
||||
);
|
||||
|
||||
const handleChange = useCallback(() => {
|
||||
setShowError(false)
|
||||
}, [])
|
||||
setShowError(false);
|
||||
}, []);
|
||||
|
||||
// Cancel just shows the error - user must select at least one workflow
|
||||
const handleCancel = useCallback(() => {
|
||||
setShowError(true)
|
||||
}, [])
|
||||
setShowError(true);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
@@ -102,11 +94,9 @@ export function WorkflowMultiselectDialog({
|
||||
|
||||
{showError && (
|
||||
<Box>
|
||||
<Text color="error">
|
||||
You must select at least one workflow to continue
|
||||
</Text>
|
||||
<Text color="error">You must select at least one workflow to continue</Text>
|
||||
</Box>
|
||||
)}
|
||||
</Dialog>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user