surshar / claude-code
Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.
Built by Anthropic · github.com/anthropics
| 1 | /* @jsxRuntime classic */ |
| 2 | /* @jsx h */ |
| 3 | /* @jsxFrag Fragment */ |
| 4 | import type { RenderElement } from 'claude-code' |
| 5 | |
| 6 | import type PaneState from '../../pane-state' |
| 7 | import type { Kit } from '../kit' |
| 8 | import Layout from '../layout' |
| 9 | import { diffStat } from './diff-stat' |
| 10 | |
| 11 | /** |
| 12 | * The pane's first line: `N files changed +A -R`, or the empty headline in |
| 13 | * its place when there is nothing to count (ReplDiffSidebar's header). |
| 14 | * |
| 15 | * The headline may name a branch the repository chose, so it is drawn as |
| 16 | * a name: no control or format character survives. |
| 17 | * |
| 18 | * @param kit the drawing's kit; its elements draw the line |
| 19 | * @param headline the empty headline, or null to draw the counts |
| 20 | * @param totals the header's counts |
| 21 | * @returns the line |
| 22 | */ |
| 23 | export function headerView( |
| 24 | kit: Kit, |
| 25 | headline: string | null, |
| 26 | totals: PaneState.HeaderTotals, |
| 27 | ): RenderElement { |
| 28 | const { Text } = kit.ui |
| 29 | const empty = ( |
| 30 | <Text dimColor wrap="truncate-end"> |
| 31 | {Layout.sanitizeName(headline ?? '')} |
| 32 | </Text> |
| 33 | ) |
| 34 | const counts = ( |
| 35 | <Text wrap="truncate-end"> |
| 36 | <Text bold>{Layout.plural(totals.filesCount, 'file')}</Text> |
| 37 | {' changed '} |
| 38 | {diffStat(kit, totals.linesAdded, totals.linesRemoved)} |
| 39 | </Text> |
| 40 | ) |
| 41 | |
| 42 | return headline === null ? counts : empty |
| 43 | } |