Skip to content

Commit 03d1145

Browse files
fix(web): CSV/TSV and large-text previews say "1 row", "1 column" and "1 line"
The streaming preview status line appended fixed plural nouns after the counts. Choose singular or plural per count. AI-assisted; verified with the tests and tools listed above.
1 parent 961df0a commit 03d1145

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

‎apps/web/src/components/files/LargeTextViewer.tsx‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ import VirtualTablePreview from "./VirtualTablePreview";
88

99
const FIRST_SCREEN_BYTES = 16 * 1024;
1010

11+
function countLabel(count: number, noun: string) {
12+
return `${count.toLocaleString()} ${noun}${count === 1 ? "" : "s"}`;
13+
}
14+
1115
function firstScreen(text: string, delimiter: "," | "\t" | null, complete: boolean) {
1216
if (!text || text.includes("\0")) return [];
1317
const rows = delimiter
@@ -216,9 +220,9 @@ export default function LargeTextViewer(props: {
216220
className="flex min-h-10 shrink-0 flex-wrap items-center gap-x-1 border-b border-border/60 px-3 py-2 text-xs text-muted-foreground tabular-nums"
217221
role="status"
218222
>
219-
{Math.max(0, meta.count - (props.delimiter && meta.count ? 1 : 0)).toLocaleString()}{" "}
220-
{props.delimiter ? "rows" : "lines"}
221-
{props.delimiter ? ` · ${meta.count ? meta.columns.toLocaleString() : 0} columns` : ""}
223+
{props.delimiter
224+
? `${countLabel(Math.max(0, meta.count - 1), "row")} · ${countLabel(meta.count ? meta.columns : 0, "column")}`
225+
: countLabel(meta.count, "line")}
222226
{meta.complete && meta.sizeBytes !== undefined
223227
? ` · ${meta.sizeBytes === 0 ? "0 bytes" : formatAttachmentSize(meta.sizeBytes)}`
224228
: " · Indexing…"}

0 commit comments

Comments
 (0)