ui: share truncate and firstLine from text.ts
This commit is contained in:
1 parent
12e1e0ba7a
commit
a6cfb9a2cd
8 files changed
+47
-30
No files matched your search
@@ -13,6 +13,7 @@ import { CommandOutput } from "./CommandOutput.tsx";
|
||||
import type { T3Session, ThreadHistory } from "../client/session.ts";
|
||||
import { liveWorkEntryLabel, workEntryDisplayLabel, type MessagesTimelineRow, type Timeline, type WorkLogEntry } from "../model/timeline.ts";
|
||||
import { blockFor } from "../model/transcript.ts";
|
||||
import { firstLine } from "./text.ts";
|
||||
import { colors, getMarkdownStyle, toneColor } from "./theme.ts";
|
||||
|
||||
/** What a right-click in the conversation was on. */
|
||||
@@ -337,8 +338,3 @@ function glyphFor(entry: WorkLogEntry): string {
|
||||
if (entry.itemType === "todo_list") return "☐";
|
||||
return "·";
|
||||
}
|
||||
|
||||
function firstLine(text: string): string {
|
||||
const line = (text.trim().split("\n")[0] ?? "").replace(/\s+/g, " ");
|
||||
return line.length > 200 ? `${line.slice(0, 197)}…` : line;
|
||||
}
|
||||
Reference in new issue
Block a user