GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(web): the SQLite, archive and notebook previews say "1 row", "1 e… · aorwall/t3code@2370e33

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/web/src/components/files
    • AttachmentFilePreview.browser.test.tsx
    • BinaryViewer.tsx
    • NotebookPreview.tsx
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/web/src/components/files/AttachmentFilePreview.browser.test.tsx‎

Copy file name to clipboardExpand all lines: apps/web/src/components/files/AttachmentFilePreview.browser.test.tsx
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ describe("bounded binary previews", () => {
365365
await act(() => trigger.focus());
366366
await userEvent.keyboard("{Enter}");
367367
await expect
368-
.element(page.getByRole("option", { name: "zzInventory (1 rows)" }))
368+
.element(page.getByRole("option", { name: "zzInventory (1 row)" }))
369369
.toBeVisible();
370370
await userEvent.keyboard("{ArrowDown}{Enter}");
371371
await vi.waitFor(() =>
@@ -376,7 +376,7 @@ describe("bounded binary previews", () => {
376376
await vi.waitFor(() => expect(document.activeElement).toBe(trigger));
377377
await userEvent.keyboard("{Enter}");
378378
await expect
379-
.element(page.getByRole("option", { name: "zzInventory (1 rows)" }))
379+
.element(page.getByRole("option", { name: "zzInventory (1 row)" }))
380380
.toBeVisible();
381381
await userEvent.keyboard("{Escape}");
382382
} finally {
Collapse file

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

Copy file name to clipboardExpand all lines: apps/web/src/components/files/BinaryViewer.tsx
+8-4Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ type Archive = Extract<BinaryWorkerResult, { type: "archive" }>;
3535
type Database = Extract<BinaryWorkerResult, { type: "sqlite" }>;
3636
type Rows = Extract<BinaryWorkerResult, { type: "rows" }>;
3737

38+
const countLabel = (count: number, one: string, many: string) =>
39+
`${count.toLocaleString()} ${count === 1 ? one : many}`;
40+
3841
function ArchiveFile(props: { readonly path: string; readonly bytes: Uint8Array<ArrayBuffer> }) {
3942
const [url, setUrl] = useState<string | null>(null);
4043
const kind = filePreviewKind({ name: props.path });
@@ -210,7 +213,7 @@ export default function BinaryViewer(props: {
210213
{selectedPath ?? (folder || "Archive contents")}
211214
</span>
212215
<span className="shrink-0 text-muted-foreground">
213-
{archive.entries.length.toLocaleString()} entries
216+
{countLabel(archive.entries.length, "entry", "entries")}
214217
{sizeBytes !== null ? ` · ${formatAttachmentSize(sizeBytes)}` : ""}
215218
</span>
216219
</div>
@@ -227,13 +230,13 @@ export default function BinaryViewer(props: {
227230
>
228231
<SelectTrigger aria-label="Table" aria-disabled={busy} aria-busy={busy} size="xs">
229232
<SelectValue>
230-
{table.name} ({table.count.toLocaleString()} rows)
233+
{table.name} ({countLabel(table.count, "row", "rows")})
231234
</SelectValue>
232235
</SelectTrigger>
233236
<SelectPopup>
234237
{database.tables.map((item) => (
235238
<SelectItem key={item.name} value={item.name}>
236-
{item.name} ({item.count.toLocaleString()} rows)
239+
{item.name} ({countLabel(item.count, "row", "rows")})
237240
</SelectItem>
238241
))}
239242
</SelectPopup>
@@ -263,7 +266,8 @@ export default function BinaryViewer(props: {
263266
className="border-b border-border/60 px-3 py-2 text-xs text-muted-foreground tabular-nums"
264267
role="status"
265268
>
266-
{table.count.toLocaleString()} rows · {rows?.columns.length ?? "…"} columns
269+
{countLabel(table.count, "row", "rows")} ·{" "}
270+
{rows ? countLabel(rows.columns.length, "column", "columns") : "… columns"}
267271
{sizeBytes !== null ? ` · ${formatAttachmentSize(sizeBytes)}` : ""}
268272
</div>
269273
<FileSurfaceNotice>
Collapse file

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

Copy file name to clipboardExpand all lines: apps/web/src/components/files/NotebookPreview.tsx
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ export default function NotebookPreview(props: {
9898
className="border-b border-border/60 px-3 py-2 text-xs text-muted-foreground tabular-nums"
9999
role="status"
100100
>
101-
{props.notebook.cells.length.toLocaleString()} cells · {props.notebook.language}
101+
{props.notebook.cells.length.toLocaleString()}{" "}
102+
{props.notebook.cells.length === 1 ? "cell" : "cells"} · {props.notebook.language}
102103
{props.sizeBytes !== undefined
103104
? ` · ${props.sizeBytes === 0 ? "0 bytes" : formatAttachmentSize(props.sizeBytes)}`
104105
: ""}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.