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 / entries / detail-model-of / detail-model-of.ts
24 lines · 727 BRaw
1import type PaneState from '../../../pane-state'
2import type Detail from '../../detail'
3import type { BodyEntry } from '../body-entry'
4
5/**
6 * A listed file as its detail draws it: the entry, whether it is the armed
7 * one, and the backend's words for its notes.
8 *
9 * @param entry the file
10 * @param model which file is armed, and the backend's words
11 * @returns the detail model
12 */
13export const detailModelOf = (
14 entry: BodyEntry,
15 model: Pick<PaneState.PaneModel, 'armedPath' | 'words'>,
16): Detail.DetailModel => ({
17 words: model.words,
18 path: entry.path,
19 displayPath: entry.displayPath,
20 isUntracked: entry.isUntracked,
21 isBinary: entry.isBinary,
22 body: entry.body,
23 isArmed: model.armedPath === entry.path,
24})