MCPcopy
hub / github.com/codeaashu/claude-code / buildLogLabel

Function buildLogLabel

src/components/LogSelector.tsx:110–128  ·  view source on GitHub ↗
(log: LogOption, maxLabelWidth: number, options?: {
  isGroupHeader?: boolean;
  isChild?: boolean;
  forkCount?: number;
})

Source from the content-addressed store, hash-verified

108 };
109}
110function buildLogLabel(log: LogOption, maxLabelWidth: number, options?: {
111 isGroupHeader?: boolean;
112 isChild?: boolean;
113 forkCount?: number;
114}): string {
115 const {
116 isGroupHeader = false,
117 isChild = false,
118 forkCount = 0
119 } = options || {};
120
121 // TreeSelect will add the prefix, so we just need to account for its width
122 const prefixWidth = isGroupHeader && forkCount > 0 ? PARENT_PREFIX_WIDTH : isChild ? CHILD_PREFIX_WIDTH : 0;
123 const sessionCountSuffix = isGroupHeader && forkCount > 0 ? ` (+${forkCount} other ${forkCount === 1 ? 'session' : 'sessions'})` : '';
124 const sidechainSuffix = log.isSidechain ? ' (sidechain)' : '';
125 const maxSummaryWidth = maxLabelWidth - prefixWidth - sidechainSuffix.length - sessionCountSuffix.length;
126 const truncatedSummary = normalizeAndTruncateToWidth(getLogDisplayTitle(log), maxSummaryWidth);
127 return `${truncatedSummary}${sidechainSuffix}${sessionCountSuffix}`;
128}
129function buildLogMetadata(log: LogOption, options?: {
130 isChild?: boolean;
131 showProjectPath?: boolean;

Callers 1

LogSelectorFunction · 0.85

Calls 2

getLogDisplayTitleFunction · 0.85

Tested by

no test coverage detected