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 Limits from '../limits' |
| 7 | import Names from '../names' |
| 8 | import PaneState from '../pane-state' |
| 9 | import { currentPane } from './current-pane' |
| 10 | import type { Kit } from './kit' |
| 11 | import Sections from './sections' |
| 12 | import { turnPane } from './turn-pane' |
| 13 | |
| 14 | /** |
| 15 | * The diff pane's body for one `ui.render`: the repository's diff now, or |
| 16 | * the picked turn's edits while that turn still exists (a rewind drops it). |
| 17 | * |
| 18 | * Seated inline (no room beside the transcript), only the built-in's line |
| 19 | * asking for a wider terminal, as the built-in shows no panel there. Docked, |
| 20 | * the body keeps the built-in's blank row above the header and blank last |
| 21 | * column, so its rows sit and wrap where the built-in's do. |
| 22 | * |
| 23 | * @param kit the elements, the handlers, the width |
| 24 | * @param model the pane's state |
| 25 | * @param placement where the surface seated the pane (`props.placement`) |
| 26 | * @returns the tree |
| 27 | */ |
| 28 | export function paneView( |
| 29 | kit: Kit, |
| 30 | model: PaneState.PaneModel, |
| 31 | placement: 'dock' | 'inline', |
| 32 | ): RenderElement { |
| 33 | const { Box } = kit.ui |
| 34 | const turn = PaneState.pickedTurnOf(model) |
| 35 | const isCurrent = turn === undefined |
| 36 | |
| 37 | if (placement === 'inline') { |
| 38 | return <Box>{Sections.dimNote(kit, Names.RESIZE_TERMINAL_TEXT)}</Box> |
| 39 | } |
| 40 | |
| 41 | const right = Limits.PANE_RIGHT_PAD_COLUMNS |
| 42 | const top = Limits.PANE_TOP_PAD_ROWS |
| 43 | const inset: Kit = { |
| 44 | ...kit, |
| 45 | columns: Math.max(1, kit.columns - right), |
| 46 | rows: Math.max(0, kit.rows - top), |
| 47 | } |
| 48 | |
| 49 | return ( |
| 50 | <Box flexDirection="column" paddingTop={top} paddingRight={right}> |
| 51 | {isCurrent ? currentPane(inset, model) : turnPane(inset, model, turn)} |
| 52 | </Box> |
| 53 | ) |
| 54 | } |