Search and paging on lists, Settings in tabs, pinned sidebar (1.3.0)

- Installs, Customers, Alerts and the audit log get a search box and
  25-per-page paging (Installs also a health filter); install History pages too.
- Settings is split into Releases and alerts / Email / Login and security /
  Audit log tabs, remembered in the URL hash.
- The side navigation is sticky at window height, so Sign out no longer
  scrolls off long pages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-28 07:51:32 +02:00
co-authored by Claude Opus 5.5
parent e22fa5369b
commit d235ae6c95
13 changed files with 271 additions and 92 deletions
+22
View File
@@ -0,0 +1,22 @@
import { useEffect, useMemo, useState } from "react";
/** True when every word of the query appears in one of the fields (case-insensitive). */
export function matches(query: string, ...fields: (string | number | null | undefined)[]) {
const words = query.toLowerCase().split(/\s+/).filter(Boolean);
if (!words.length) return true;
const hay = fields.filter(f => f != null).join(" ").toLowerCase();
return words.every(w => hay.includes(w));
}
/**
* One page of a list. Goes back to the first page when `resetKey` changes (the search or filter),
* but not when the same list is reloaded.
*/
export function usePaged<T>(items: T[], resetKey: unknown, pageSize = 25) {
const [page, setPage] = useState(1);
const pages = Math.max(1, Math.ceil(items.length / pageSize));
useEffect(() => { setPage(1); }, [resetKey]);
const current = Math.min(page, pages);
const rows = useMemo(() => items.slice((current - 1) * pageSize, current * pageSize), [items, current, pageSize]);
return { rows, page: current, pages, setPage, total: items.length, pageSize };
}