File size: 1,051 Bytes
c9c900b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | /* @jsxRuntime classic */
/* @jsx h */
/* @jsxFrag Fragment */
import type { RenderElement } from 'claude-code'
import Limits from '../../limits'
import type Entries from '../entries'
import type { Kit } from '../kit'
import Layout from '../layout'
import { diffStat } from './diff-stat'
/**
* One row of the open pre-session section's legend (PreSessionSection): the
* file's dim name cut from its start, its counts at the right; no press.
*
* @param kit the elements and the width
* @param entry the pre-session file
* @returns the row
*/
export function legendRow(kit: Kit, entry: Entries.BodyEntry): RenderElement {
const { Box, Text } = kit.ui
return (
<Box flexDirection="row">
{[
<Text dimColor wrap="truncate-end">
{Layout.truncateStart(
Layout.sanitizeName(entry.displayPath),
Math.max(kit.columns - Limits.STAT_CELLS, Limits.PATH_FLOOR),
)}
</Text>,
<Box flexGrow={1} />,
diffStat(kit, entry.added, entry.removed),
]}
</Box>
)
}
|