// React port of paneTitle.ts: a pane header's session identity — the name, // then the command as its tool mark when recognised, same as the sidebar // card's own CommandFragment (SessionCard.tsx). JSX escapes text nodes, so // unlike the vanilla string-builder this needs no manual HTML escaping. import { splitCommand, toolIconSvg } from "../../toolIcon.js"; import { sessionName, type Session, type Uuid } from "../../types.js"; export interface PaneTitleProps { sessionId: Uuid; session?: Session; className?: string; } export function PaneTitle({ sessionId, session, className }: PaneTitleProps) { if (!session) { return ( session {sessionId.slice(0, 8)} ); } const name = sessionName(session); const showCommand = Boolean(session.command) && session.command !== name; const { tool, program } = splitCommand(session.command); const icon = tool ? toolIconSvg(tool) : null; return ( {name} {showCommand && ( {icon ? : {program}} )} ); }