Prune files not in the deploy set (stale build context)
Browse files
web/src/customer-grid/GridPager.tsx
DELETED
|
@@ -1,57 +0,0 @@
|
|
| 1 |
-
/**
|
| 2 |
-
* ⭐⭐ HOTFIX 2026-09-23 — the read-through grid's pager.
|
| 3 |
-
*
|
| 4 |
-
* Owner, verbatim: *"I want fucking either pagination or next page and only load 50 at a time to
|
| 5 |
-
* be fucking back."* This revokes SDLC 62 R3 (virtualise only). A read-through table holds ONE
|
| 6 |
-
* page of `size` rows; Previous and Next move it. `total` is the server's count of everything the
|
| 7 |
-
* predicate matches, so every row stays reachable and the count is never `rows.length`.
|
| 8 |
-
*/
|
| 9 |
-
export function pageLabel(offset: number, size: number, total: number): string {
|
| 10 |
-
if (total <= 0) return "No records";
|
| 11 |
-
const from = Math.min(total, offset + 1);
|
| 12 |
-
const to = Math.min(total, offset + size);
|
| 13 |
-
return `${from.toLocaleString()} to ${to.toLocaleString()} of ${total.toLocaleString()}`;
|
| 14 |
-
}
|
| 15 |
-
|
| 16 |
-
export function GridPager({
|
| 17 |
-
offset,
|
| 18 |
-
size,
|
| 19 |
-
total,
|
| 20 |
-
pending,
|
| 21 |
-
onPage,
|
| 22 |
-
}: {
|
| 23 |
-
offset: number;
|
| 24 |
-
size: number;
|
| 25 |
-
total: number;
|
| 26 |
-
pending: boolean;
|
| 27 |
-
onPage: (offset: number) => void;
|
| 28 |
-
}) {
|
| 29 |
-
const pages = Math.max(1, Math.ceil(total / size));
|
| 30 |
-
const page = Math.min(pages, Math.floor(offset / size) + 1);
|
| 31 |
-
const hasPrev = offset > 0;
|
| 32 |
-
const hasNext = offset + size < total;
|
| 33 |
-
return (
|
| 34 |
-
<nav className="cg-pager" aria-label="Pages" aria-busy={pending || undefined}>
|
| 35 |
-
<button
|
| 36 |
-
type="button"
|
| 37 |
-
className="cg-btn"
|
| 38 |
-
disabled={!hasPrev}
|
| 39 |
-
onClick={() => onPage(Math.max(0, offset - size))}
|
| 40 |
-
>
|
| 41 |
-
Previous
|
| 42 |
-
</button>
|
| 43 |
-
<span className="cg-pager-label">
|
| 44 |
-
{pageLabel(offset, size, total)}
|
| 45 |
-
<span className="cg-pager-page">Page {page.toLocaleString()} of {pages.toLocaleString()}</span>
|
| 46 |
-
</span>
|
| 47 |
-
<button
|
| 48 |
-
type="button"
|
| 49 |
-
className="cg-btn"
|
| 50 |
-
disabled={!hasNext}
|
| 51 |
-
onClick={() => onPage(offset + size)}
|
| 52 |
-
>
|
| 53 |
-
Next
|
| 54 |
-
</button>
|
| 55 |
-
</nav>
|
| 56 |
-
);
|
| 57 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|