mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-18 14:25:51 +00:00
style: 完成所有文件的lint
This commit is contained in:
@@ -1,36 +1,32 @@
|
||||
import * as React from 'react'
|
||||
import { useEffect, useRef } from 'react'
|
||||
import { KeyboardShortcutHint } from '@anthropic/ink'
|
||||
import { Box, Text } from '@anthropic/ink'
|
||||
import { useKeybinding } from '../keybindings/useKeybinding.js'
|
||||
import * as React from 'react';
|
||||
import { useEffect, useRef } from 'react';
|
||||
import { KeyboardShortcutHint } from '@anthropic/ink';
|
||||
import { Box, Text } from '@anthropic/ink';
|
||||
import { useKeybinding } from '../keybindings/useKeybinding.js';
|
||||
|
||||
type Props = {
|
||||
onRun: () => void
|
||||
onCancel: () => void
|
||||
reason: string
|
||||
}
|
||||
onRun: () => void;
|
||||
onCancel: () => void;
|
||||
reason: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Component that shows a notification about running /issue command
|
||||
* with the ability to cancel via ESC key
|
||||
*/
|
||||
export function AutoRunIssueNotification({
|
||||
onRun,
|
||||
onCancel,
|
||||
reason,
|
||||
}: Props): React.ReactNode {
|
||||
const hasRunRef = useRef(false)
|
||||
export function AutoRunIssueNotification({ onRun, onCancel, reason }: Props): React.ReactNode {
|
||||
const hasRunRef = useRef(false);
|
||||
|
||||
// Handle ESC key to cancel
|
||||
useKeybinding('confirm:no', onCancel, { context: 'Confirmation' })
|
||||
useKeybinding('confirm:no', onCancel, { context: 'Confirmation' });
|
||||
|
||||
// Run /issue immediately on mount
|
||||
useEffect(() => {
|
||||
if (!hasRunRef.current) {
|
||||
hasRunRef.current = true
|
||||
onRun()
|
||||
hasRunRef.current = true;
|
||||
onRun();
|
||||
}
|
||||
}, [onRun])
|
||||
}, [onRun]);
|
||||
|
||||
return (
|
||||
<Box flexDirection="column" marginTop={1}>
|
||||
@@ -46,10 +42,10 @@ export function AutoRunIssueNotification({
|
||||
<Text dimColor>Reason: {reason}</Text>
|
||||
</Box>
|
||||
</Box>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export type AutoRunIssueReason = 'feedback_survey_bad' | 'feedback_survey_good'
|
||||
export type AutoRunIssueReason = 'feedback_survey_bad' | 'feedback_survey_good';
|
||||
|
||||
/**
|
||||
* Determines if /issue should auto-run for Ant users
|
||||
@@ -57,16 +53,16 @@ export type AutoRunIssueReason = 'feedback_survey_bad' | 'feedback_survey_good'
|
||||
export function shouldAutoRunIssue(reason: AutoRunIssueReason): boolean {
|
||||
// Only for Ant users
|
||||
if (process.env.USER_TYPE !== 'ant') {
|
||||
return false
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (reason) {
|
||||
case 'feedback_survey_bad':
|
||||
return false
|
||||
return false;
|
||||
case 'feedback_survey_good':
|
||||
return false
|
||||
return false;
|
||||
default:
|
||||
return false
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,9 +73,9 @@ export function shouldAutoRunIssue(reason: AutoRunIssueReason): boolean {
|
||||
export function getAutoRunCommand(reason: AutoRunIssueReason): string {
|
||||
// Only ant builds have the /good-claude command
|
||||
if (process.env.USER_TYPE === 'ant' && reason === 'feedback_survey_good') {
|
||||
return '/good-claude'
|
||||
return '/good-claude';
|
||||
}
|
||||
return '/issue'
|
||||
return '/issue';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,10 +84,10 @@ export function getAutoRunCommand(reason: AutoRunIssueReason): string {
|
||||
export function getAutoRunIssueReasonText(reason: AutoRunIssueReason): string {
|
||||
switch (reason) {
|
||||
case 'feedback_survey_bad':
|
||||
return 'You responded "Bad" to the feedback survey'
|
||||
return 'You responded "Bad" to the feedback survey';
|
||||
case 'feedback_survey_good':
|
||||
return 'You responded "Good" to the feedback survey'
|
||||
return 'You responded "Good" to the feedback survey';
|
||||
default:
|
||||
return 'Unknown reason'
|
||||
return 'Unknown reason';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user