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 | import { present } from './present' |
| 11 | |
| 12 | /** |
| 13 | * The pane's first line (ReplDiffSidebar's header row): `N files changed |
| 14 | * +A -R`, nothing over an empty state, and the pickers at its right edge. |
| 15 | * |
| 16 | * The pickers sit where the built-in draws its close mark, so every row |
| 17 | * below lands where the built-in's does; this pane's mark is the engine's. |
| 18 | * |
| 19 | * @param kit the drawing's kit; its elements draw the line |
| 20 | * @param totals the header's counts, or null when there is nothing to count |
| 21 | * @param controls the pickers (Sections.controlsView), or null for none |
| 22 | * @returns the line |
| 23 | */ |
| 24 | export function headerView( |
| 25 | kit: Kit, |
| 26 | totals: PaneState.HeaderTotals | null, |
| 27 | controls: RenderElement | null, |
| 28 | ): RenderElement { |
| 29 | const { Box, Text } = kit.ui |
| 30 | |
| 31 | const countOf = (counted: PaneState.HeaderTotals): RenderElement => ( |
| 32 | <Text wrap="truncate-end"> |
| 33 | <Text bold>{Layout.plural(counted.filesCount, 'file')}</Text> |
| 34 | {' changed '} |
| 35 | {diffStat(kit, counted.linesAdded, counted.linesRemoved)} |
| 36 | </Text> |
| 37 | ) |
| 38 | |
| 39 | return ( |
| 40 | <Box flexDirection="row" height={1}> |
| 41 | {present([totals && countOf(totals), <Box flexGrow={1} />, controls])} |
| 42 | </Box> |
| 43 | ) |
| 44 | } |