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 Names from '../../names' |
| 7 | import type PaneState from '../../pane-state' |
| 8 | import DialogPane from '../dialog-pane' |
| 9 | import type { Kit } from '../kit' |
| 10 | import Sections from '../sections' |
| 11 | |
| 12 | /** |
| 13 | * What the pane draws before it has a diff to lay out: the line saying the |
| 14 | * directory is in no repository, or the first fetch's `Loading diff…`. |
| 15 | * |
| 16 | * Null once a fetch settled (or a turn is picked), when the layout draws. |
| 17 | * |
| 18 | * @param kit the elements, the width, the rows |
| 19 | * @param model the pane's state |
| 20 | * @returns the early tree, or null |
| 21 | */ |
| 22 | export function preludeOf( |
| 23 | kit: Kit, |
| 24 | model: Pick< |
| 25 | PaneState.PaneModel, |
| 26 | 'isOutsideRepository' | 'data' | 'hasSettled' | 'source' | 'turns' |
| 27 | >, |
| 28 | ): RenderElement | null { |
| 29 | const { Box } = kit.ui |
| 30 | const isLoading = model.data === null && !model.hasSettled |
| 31 | |
| 32 | const outside = ( |
| 33 | <Box>{Sections.dimNote(kit, Names.NOT_IN_REPOSITORY_TEXT)}</Box> |
| 34 | ) |
| 35 | |
| 36 | const loadingOf = (): RenderElement => |
| 37 | DialogPane.messagePaneOf(kit, { |
| 38 | top: [Sections.headerView(kit, null, null)], |
| 39 | message: ['Loading diff…'], |
| 40 | controls: null, |
| 41 | earlier: null, |
| 42 | rest: [], |
| 43 | }) |
| 44 | |
| 45 | const settled = isLoading ? loadingOf() : null |
| 46 | |
| 47 | return model.isOutsideRepository ? outside : settled |
| 48 | } |