Refactor dashboard cards

This commit is contained in:
James Babcock committed 2026-06-01 12:45:27 -07:00
1 parent 7afb98f7f7
commit 8d99ea97b5
5 files changed
+179 -153

No files matched your search

+15
View File
@@ -1,4 +1,5 @@
import { BdfFont, Glyph } from "./bdffont";
import { wrapText } from "./textwrap";
export const G2_LENS_WIDTH = 576;
export const G2_LENS_HEIGHT = 288;
@@ -130,6 +131,20 @@ export class GrayImage {
}
}
drawTextWrapped({font, x, y, width, text, value }: {
font: BdfFont;
x: number;
y: number;
width: number;
text: string;
value: number;
}): void {
const lines = wrapText(font, text, this.width);
for (let i = 0; i < lines.length; i++) {
this.drawText(font, x, y + i * font.lineHeight, lines[i]!, value);
}
}
bitBlt(
source: GrayImage,
dx: number,
+16
View File
@@ -0,0 +1,16 @@
import { GrayImage } from "./image";
import { loadPngAsGrayImage } from "./imagefile";
let cachedDashboardLogo: GrayImage | null | undefined;
export function getDashboardLogo(): GrayImage | null {
if (cachedDashboardLogo !== undefined) {
return cachedDashboardLogo;
}
try {
cachedDashboardLogo = loadPngAsGrayImage("images/faceclaw-logo-dashboard.png");
} catch {
cachedDashboardLogo = null;
}
return cachedDashboardLogo;
}