Toasts, logo icons, shared table toolbar with search, and a density toggle
Feedback: toasts confirm common actions, and a page's error or success message that appears out of view is also shown as a toast. Icons: the tab, app and home-screen icons are the house from the logo; a dev instance gets a coloured dot on its tab icon. Tables: Secrets, Admin Links, IP Addresses and Alerts share one toolbar (search, filters, row count, actions, Export CSV); twelve more tables get a multi-word search box; long tables keep their column headings in view on wide screens. Density: Compact / Normal / Roomy in the user menu, remembered per browser. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7d56ad18b7
commit
617dc1ea2f
56 files changed
+757
-158
No files matched your search
@@ -41,6 +41,39 @@ function applyEnvironment(look: EnvironmentLook | null): void {
|
||||
root.setAttribute("data-env", look.name || "custom");
|
||||
document.title = look.name ? `[${look.name}] ${BASE_TITLE}` : BASE_TITLE;
|
||||
document.querySelector('meta[name="theme-color"]')?.setAttribute("content", look.color);
|
||||
tintFavicon(look.color);
|
||||
}
|
||||
|
||||
/** The tab icon gets a dot in the environment's colour in its corner, so this tab stands out among several. */
|
||||
function tintFavicon(color: string): void {
|
||||
const links = document.querySelectorAll<HTMLLinkElement>('link[rel~="icon"]');
|
||||
if (links.length === 0) return;
|
||||
const image = new Image();
|
||||
image.onload = () => {
|
||||
try {
|
||||
const size = 64;
|
||||
const canvas = document.createElement("canvas");
|
||||
canvas.width = canvas.height = size;
|
||||
const ctx = canvas.getContext("2d");
|
||||
if (!ctx) return;
|
||||
ctx.drawImage(image, 0, 0, size, size);
|
||||
ctx.beginPath();
|
||||
ctx.arc(size - 19, size - 19, 18, 0, Math.PI * 2);
|
||||
ctx.fillStyle = color;
|
||||
ctx.fill();
|
||||
ctx.lineWidth = 5;
|
||||
ctx.strokeStyle = "#ffffff";
|
||||
ctx.stroke();
|
||||
const href = canvas.toDataURL("image/png");
|
||||
links.forEach((link) => {
|
||||
link.href = href;
|
||||
link.removeAttribute("sizes");
|
||||
});
|
||||
} catch {
|
||||
// The plain icon stays; this is only a nicety.
|
||||
}
|
||||
};
|
||||
image.src = "/icon-192.png";
|
||||
}
|
||||
|
||||
/** Whether white text on this colour would be hard to read. */
|
||||
|
||||
Reference in new issue
Block a user