/** * UserMessageItem - Single user message item showing turn link, tokens, and preview. */ import React from 'react'; import { COLOR_TEXT_MUTED, COLOR_TEXT_SECONDARY } from '@renderer/constants/cssVariables'; import { MessageSquare } from 'lucide-react'; import { formatTokens } from '../utils/formatting'; import type { UserMessageInjection } from '@renderer/types/contextInjection'; interface UserMessageItemProps { injection: UserMessageInjection; onNavigateToTurn?: (turnIndex: number) => void; } export const UserMessageItem = ({ injection, onNavigateToTurn, }: Readonly): React.ReactElement => { const turnIndex = injection.turnIndex; const isClickable = onNavigateToTurn && turnIndex >= 0; return (
{isClickable ? ( onNavigateToTurn(turnIndex)} onKeyDown={(e) => { if (e.key === 'Enter' || e.key === ' ') { onNavigateToTurn(turnIndex); } }} > @Turn {turnIndex + 1} ) : ( @Turn {turnIndex + 1} )} ~{formatTokens(injection.estimatedTokens)} tokens
{injection.textPreview && (
{injection.textPreview}
)}
); };