style: 完成所有文件的lint

This commit is contained in:
claude-code-best
2026-05-01 21:39:30 +08:00
parent d136872cc9
commit 6182015005
1333 changed files with 68255 additions and 77882 deletions

View File

@@ -1,35 +1,27 @@
import figures from 'figures'
import * as React from 'react'
import { useContext } from 'react'
import { useQueuedMessage } from '../../context/QueuedMessageContext.js'
import { Box, Text } from '@anthropic/ink'
import { formatBriefTimestamp } from '../../utils/formatBriefTimestamp.js'
import {
findThinkingTriggerPositions,
getRainbowColor,
isUltrathinkEnabled,
} from '../../utils/thinking.js'
import { MessageActionsSelectedContext } from '../messageActions.js'
import figures from 'figures';
import * as React from 'react';
import { useContext } from 'react';
import { useQueuedMessage } from '../../context/QueuedMessageContext.js';
import { Box, Text } from '@anthropic/ink';
import { formatBriefTimestamp } from '../../utils/formatBriefTimestamp.js';
import { findThinkingTriggerPositions, getRainbowColor, isUltrathinkEnabled } from '../../utils/thinking.js';
import { MessageActionsSelectedContext } from '../messageActions.js';
type Props = {
text: string
useBriefLayout?: boolean
timestamp?: string
}
text: string;
useBriefLayout?: boolean;
timestamp?: string;
};
export function HighlightedThinkingText({
text,
useBriefLayout,
timestamp,
}: Props): React.ReactNode {
export function HighlightedThinkingText({ text, useBriefLayout, timestamp }: Props): React.ReactNode {
// Brief/assistant mode: chat-style "You" label instead of the highlight.
// Parent drops its backgroundColor when this is true, so no grey shows
// through. No manual wrap needed — Ink wraps inside the parent Box.
const isQueued = useQueuedMessage()?.isQueued ?? false
const isSelected = useContext(MessageActionsSelectedContext)
const pointerColor = isSelected ? 'suggestion' : 'subtle'
const isQueued = useQueuedMessage()?.isQueued ?? false;
const isSelected = useContext(MessageActionsSelectedContext);
const pointerColor = isSelected ? 'suggestion' : 'subtle';
if (useBriefLayout) {
const ts = timestamp ? formatBriefTimestamp(timestamp) : ''
const ts = timestamp ? formatBriefTimestamp(timestamp) : '';
return (
<Box flexDirection="column" paddingLeft={2}>
<Box flexDirection="row">
@@ -38,12 +30,10 @@ export function HighlightedThinkingText({
</Box>
<Text color={isQueued ? 'subtle' : 'text'}>{text}</Text>
</Box>
)
);
}
const triggers = isUltrathinkEnabled()
? findThinkingTriggerPositions(text)
: []
const triggers = isUltrathinkEnabled() ? findThinkingTriggerPositions(text) : [];
if (triggers.length === 0) {
return (
@@ -51,35 +41,35 @@ export function HighlightedThinkingText({
<Text color={pointerColor}>{figures.pointer} </Text>
<Text color="text">{text}</Text>
</Text>
)
);
}
// Static rainbow (no shimmer — transcript messages don't animate)
const parts: React.ReactNode[] = []
let cursor = 0
const parts: React.ReactNode[] = [];
let cursor = 0;
for (const t of triggers) {
if (t.start > cursor) {
parts.push(
<Text key={`plain-${cursor}`} color="text">
{text.slice(cursor, t.start)}
</Text>,
)
);
}
for (let i = t.start; i < t.end; i++) {
parts.push(
<Text key={`rb-${i}`} color={getRainbowColor(i - t.start)}>
{text[i]}
</Text>,
)
);
}
cursor = t.end
cursor = t.end;
}
if (cursor < text.length) {
parts.push(
<Text key={`plain-${cursor}`} color="text">
{text.slice(cursor)}
</Text>,
)
);
}
return (
@@ -87,5 +77,5 @@ export function HighlightedThinkingText({
<Text color={pointerColor}>{figures.pointer} </Text>
{parts}
</Text>
)
);
}