/** * ThinkingTextItem - Single thinking text item with expandable breakdown. */ import React, { useState } from 'react'; import { useAppTranslation } from '@features/localization/renderer'; import { COLOR_TEXT_MUTED, COLOR_TEXT_SECONDARY } from '@renderer/constants/cssVariables'; import { Brain, ChevronRight } from 'lucide-react'; import { formatTokens } from '../utils/formatting'; import type { ThinkingTextInjection } from '@renderer/types/contextInjection'; interface ThinkingTextItemProps { injection: ThinkingTextInjection; onNavigateToTurn?: (turnIndex: number) => void; } export const ThinkingTextItem = ({ injection, onNavigateToTurn, }: Readonly): React.ReactElement => { const { t } = useAppTranslation('common'); const [expanded, setExpanded] = useState(false); const turnIndex = injection.turnIndex; const isClickable = onNavigateToTurn && turnIndex >= 0; return (
{expanded && injection.breakdown.length > 0 && (
{injection.breakdown.map((item, idx) => (
{item.type === 'thinking' ? t('sessionContext.items.thinking') : t('sessionContext.items.text')} ~{formatTokens(item.tokenCount)}
))}
)}
); };