Files
faceclaw/app/apps/terminal/hub-header.ts
T
James Babcock 295922effd Various UI tweaks
Fix missing submenu indicators and change their appearance. Clean up
styling in the Terminal app and move Settings to the top-level menu.
Remove right padding from the bottom bar.
2026-10-02 12:19:25 -07:00

15 lines
809 B
TypeScript

import { wrapText, type WrapFont } from '../../graphics/textwrap';
/** Left edge of the hub's title line (and of a wrapped status block under it). */
export const HUB_TITLE_X = 12;
/** Keep short status on the title row; give long errors their full width. */
export function layoutHubHeader(font: WrapFont, title: string, status: string, width: number, step: number) {
const inlineX = HUB_TITLE_X + font.measureText(title) + 16;
const inline = !/[\r\n]/.test(status) && font.measureText(status) <= Math.max(0, width - inlineX - 12);
const lines = inline ? [status] : wrapText(font, status, Math.max(1, width - HUB_TITLE_X - 12));
const x = inline ? inlineX : HUB_TITLE_X;
const y = inline ? 10 : 10 + step;
return { x, y, lines, listTop: inline ? 16 + step : 16 + step * (1 + lines.length) };
}