Skip to content

Commit fcb8b9b

Browse files
refactor(constants): extract ellipsis character into UI.ELLIPSIS constant
1 parent 158e3a5 commit fcb8b9b

4 files changed

Lines changed: 8 additions & 4 deletions

File tree

src/components/SessionManager.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Box, Text, useStdout } from 'ink';
22
import { useCallback, useState } from 'react';
33

4+
import { UI } from '../constants';
45
import { listSessions, type SessionMetadata } from '../utils/session';
56
import { SelectPrompt, SelectPromptHint } from './SelectPrompt';
67

@@ -32,7 +33,7 @@ const SESSION_LABEL_PADDING = 4;
3233

3334
function truncate(value: string, maxLength: number): string {
3435
return value.length > maxLength
35-
? `${value.slice(0, maxLength - 1).trimEnd()}`
36+
? `${value.slice(0, maxLength - 1).trimEnd()}${UI.ELLIPSIS}`
3637
: value;
3738
}
3839

src/constants/ui.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ export const PROMPT_PREFIX = '> ';
33
export const AGENT_MARGIN_X = 2;
44
export const MARKDOWN_HR_CHARACTER = '─';
55
export const DIAMOND = '❖';
6+
export const ELLIPSIS = '…';

src/utils/session.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { join } from 'node:path';
1111

1212
import { v7 as uuidv7 } from 'uuid';
1313

14-
import { CONFIG, ROLE } from '../constants';
14+
import { CONFIG, ROLE, UI } from '../constants';
1515
import type { Message } from './ollama';
1616

1717
const SESSIONS_DIRECTORY = join(CONFIG.DIRECTORY, 'sessions');
@@ -110,7 +110,7 @@ function deriveTitle(message: Message): string {
110110
}
111111

112112
return normalized.length > TITLE_MAX_LENGTH
113-
? normalized.slice(0, TITLE_MAX_LENGTH - 1).trimEnd() + '…'
113+
? normalized.slice(0, TITLE_MAX_LENGTH - 1).trimEnd() + UI.ELLIPSIS
114114
: normalized;
115115
}
116116

src/utils/tools/web/utils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { UI } from '../../../constants';
2+
13
/**
24
* Strip HTML tags from a string
35
*/
@@ -31,6 +33,6 @@ export function cleanText(value: string): string {
3133
*/
3234
export function truncate(value: string, maxLength: number): string {
3335
return value.length > maxLength
34-
? `${value.slice(0, maxLength - 1).trimEnd()}`
36+
? `${value.slice(0, maxLength - 1).trimEnd()}${UI.ELLIPSIS}`
3537
: value;
3638
}

0 commit comments

Comments
 (0)