spacehub

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

claude-code / mods / diff / hooks / views / pane-view.tsx
39 lines · 1.2 KBRaw
1/* @jsxRuntime classic */
2/* @jsx h */
3/* @jsxFrag Fragment */
4import type { RenderElement } from 'claude-code'
5
6import Names from '../names'
7import PaneState from '../pane-state'
8import { currentPane } from './current-pane'
9import type { Kit } from './kit'
10import Sections from './sections'
11import { turnPane } from './turn-pane'
12
13/**
14 * The diff pane's body for one `ui.render`: the repository's diff now, or
15 * the picked turn's edits while that turn still exists (a rewind drops it).
16 *
17 * Seated inline (no room beside the transcript), only the built-in's line
18 * asking for a wider terminal, as the built-in shows no panel there.
19 *
20 * @param kit the elements, the handlers, the width
21 * @param model the pane's state
22 * @param placement where the surface seated the pane (`props.placement`)
23 * @returns the tree
24 */
25export function paneView(
26 kit: Kit,
27 model: PaneState.PaneModel,
28 placement: 'dock' | 'inline',
29): RenderElement {
30 const { Box } = kit.ui
31 const turn = PaneState.pickedTurnOf(model)
32 const isCurrent = turn === undefined
33
34 if (placement === 'inline') {
35 return <Box>{Sections.dimNote(kit, Names.RESIZE_TERMINAL_TEXT)}</Box>
36 }
37
38 return isCurrent ? currentPane(kit, model) : turnPane(kit, model, turn)
39}