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 | |
| 9 | /** |
| 10 | * The pick between the working tree and a turn's edits (`Current`, then |
| 11 | * `T<n>` per turn, newest first), drawn only when a turn exists. |
| 12 | * |
| 13 | * As DiffDialog hides its tabs with one source. |
| 14 | * |
| 15 | * @param kit the elements and the handlers |
| 16 | * @param model what is picked now and the turns to pick from |
| 17 | * @returns the picker, or null without turns |
| 18 | */ |
| 19 | export function sourcePicker( |
| 20 | kit: Kit, |
| 21 | model: Pick<PaneState.PaneModel, 'source' | 'turns'>, |
| 22 | ): RenderElement | null { |
| 23 | const { Select } = kit.ui |
| 24 | const { source, turns } = model |
| 25 | const hasTurns = turns.length > 0 |
| 26 | |
| 27 | return hasTurns ? ( |
| 28 | <Select |
| 29 | key="source" |
| 30 | label="source" |
| 31 | options={[ |
| 32 | { value: 'current', label: 'Current' }, |
| 33 | ...turns.map(turn => ({ |
| 34 | value: String(turn.index), |
| 35 | label: `T${turn.index}`, |
| 36 | })), |
| 37 | ]} |
| 38 | value={source.kind === 'current' ? 'current' : String(source.index)} |
| 39 | onSelect={value => kit.actions.chooseSource(value)} |
| 40 | /> |
| 41 | ) : null |
| 42 | } |