Sidebar uses icons for apps

This commit is contained in:
James Babcock committed 2026-07-08 10:45:56 -07:00
1 parent d0c30f9ca9
commit 22c779553c
27 files changed
+379 -37

No files matched your search

+5 -4
View File
@@ -2,6 +2,8 @@ import { getDefaultSmallFont } from "../../graphics/bdffont";
import { GrayImage } from "../../graphics/image";
import { clamp } from "../../util/numeric-util";
import { Layer, type DashboardInputEvent, type LayerActions, type LayerContext } from "../layers";
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK, GESTURE_SCROLL } from "../gestures";
import { drawSelectionHighlight } from "../menu";
import {
buildSoundSequencePayload,
CFW_SEQ_MAX,
@@ -36,7 +38,7 @@ export class BuzzerDemoLayer implements Layer {
const image = new GrayImage(width, height, 0);
image.drawText(font, 20, 8, "Buzzer demo", 220);
const status = this.playing ? `Playing: ${this.playing}` : "Click to play";
const status = this.playing ? `Playing: ${this.playing}` : `${GESTURE_CLICK} play`;
image.drawText(font, width - 24 - font.measureText(status), 8, status, 140);
const listHeight = height - HEADER_HEIGHT - FOOTER_HEIGHT;
@@ -54,14 +56,13 @@ export class BuzzerDemoLayer implements Layer {
const y = HEADER_HEIGHT + (index - this.scrollRow) * ROW_HEIGHT;
const selected = index === this.selectedIndex;
if (selected) {
image.fillRoundedRect(LIST_X - 6, y - 1, width - 2 * LIST_X + 12, ROW_HEIGHT - 1, 15, 4);
image.drawRoundedRect(LIST_X - 6, y - 1, width - 2 * LIST_X + 12, ROW_HEIGHT - 1, 45, 4);
drawSelectionHighlight(image, LIST_X - 6, y - 1, width - 2 * LIST_X + 12, ROW_HEIGHT - 1, ctx.stack.isFocused(), 4);
}
image.drawText(font, LIST_X, y + 1, effect.name, selected ? 255 : 200);
image.drawText(font, LIST_X + 110, y + 1, effect.desc, selected ? 180 : 120);
}
image.drawText(font, 20, height - 16, "Scroll: select Click: play Double-click: back", 110);
image.drawText(font, 20, height - 16, `${GESTURE_SCROLL} select ${GESTURE_CLICK} play ${GESTURE_DOUBLE_CLICK} back`, 110);
return image;
}
+4 -3
View File
@@ -1,6 +1,8 @@
import { getDefaultSmallFont, type BdfFont } from "../../graphics/bdffont";
import { GrayImage } from "../../graphics/image";
import { clamp } from "../../util/numeric-util";
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK } from "../gestures";
import { drawSelectionHighlight } from "../menu";
import {
hasAllFilesAccess,
listDirectory,
@@ -70,14 +72,13 @@ export class FileBrowserLayer implements Layer {
const y = HEADER_HEIGHT + (index - this.scrollRow) * ROW_HEIGHT;
const selected = index === this.selectedIndex;
if (selected) {
image.fillRoundedRect(LIST_X - 6, y - 1, width - 2 * LIST_X + 12, ROW_HEIGHT - 1, 15, 4);
image.drawRoundedRect(LIST_X - 6, y - 1, width - 2 * LIST_X + 12, ROW_HEIGHT - 1, 45, 4);
drawSelectionHighlight(image, LIST_X - 6, y - 1, width - 2 * LIST_X + 12, ROW_HEIGHT - 1, ctx.stack.isFocused(), 4);
}
const value = rowValue(row, selected);
image.drawText(font, LIST_X, y + 1, truncateRight(font, row.label, width - 2 * LIST_X), value);
}
image.drawText(font, 20, height - 16, "Click: open Double-click: up / back", 110);
image.drawText(font, 20, height - 16, `${GESTURE_CLICK} open ${GESTURE_DOUBLE_CLICK} up / back`, 110);
return image;
}
+3 -3
View File
@@ -5,6 +5,7 @@ import { nightscoutBridge, type NightscoutState } from "../../native/nightscout-
import { isNightscoutSettingsConfigured } from "../dashboard-settings";
import { formatAgeShortFromTimestamp, formatTimestamp } from "~/util/date-util";
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK } from "../gestures";
const nightscoutLargeFont = getDefaultLargeFont();
const NIGHTSCOUT_STALE_MS = 15 * 60 * 1000;
const NIGHTSCOUT_GRAPH_WINDOW_MS = 2 * 60 * 60 * 1000;
@@ -294,7 +295,6 @@ export class NightscoutLayer implements Layer {
const nightscout = nightscoutBridge.snapshot();
const nowMs = Date.now();
const footerY = height - 26;
image.drawRect(12, 12, width - 24, height - 24, 52);
image.drawText(font, 22, 16, "Nightscout", 220);
if (!isNightscoutSettingsConfigured() || nightscout.configurationMissing) {
@@ -306,7 +306,7 @@ export class NightscoutLayer implements Layer {
if (!nightscout.available || !nightscout.latest) {
image.drawText(font, 22, 44, "No Nightscout data available.", 180);
image.drawText(font, 22, 58, truncateLine(nightscout.status, 60), 140);
image.drawText(font, 22, footerY, "Click: refresh Double-click: back", 110);
image.drawText(font, 22, footerY, `${GESTURE_CLICK} refresh ${GESTURE_DOUBLE_CLICK} back`, 110);
return image;
}
@@ -340,7 +340,7 @@ export class NightscoutLayer implements Layer {
const graphHeight = Math.max(40, height - 128 - 48);
drawNightscoutGraph(image, { x: 22, y: 128, width: width - 44, height: graphHeight }, nightscout, nowMs, font);
image.drawText(font, 22, height - 42, "2-hour glucose history with basal / carbs / boluses", 130);
image.drawText(font, 22, footerY, "Click: refresh Double-click: back", 110);
image.drawText(font, 22, footerY, `${GESTURE_CLICK} refresh ${GESTURE_DOUBLE_CLICK} back`, 110);
return image;
}
-1
View File
@@ -31,7 +31,6 @@ export class TelepromptLayer implements Layer {
const image = new GrayImage(width, height, 0);
const footerY = height - FOOTER_MARGIN;
this.bodyLineCount = Math.max(1, Math.floor((footerY - BODY_Y) / LINE_STEP));
image.drawRect(12, 12, width - 24, height - 24, 52);
image.drawText(font, MARGIN_X + 4, TITLE_Y, truncateToWidth(font, this.title, width - 2 * MARGIN_X - 8), 220);
const lines = this.getLines(font, width);
+2 -2
View File
@@ -9,6 +9,7 @@ import { Layer, type DashboardInputEvent, type LayerContext } from "../layers";
* (createTranscribeAppWindow); this layer accumulates the transcript, shows
* it, and saves it to Downloads on click.
*/
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK } from "../gestures";
export class TranscribeLayer implements Layer {
private status = "Listening...";
// Finalized utterances, plus the live (replace-semantics) partial appended
@@ -37,7 +38,6 @@ export class TranscribeLayer implements Layer {
const text = this.displayText() || "Listening...";
const wrapped = wrapTranscribeText(font, text, width - 64);
image.drawRect(12, 12, width - 24, height - 24, 52);
image.drawText(font, 24, 20, "Transcribe", 200);
image.drawText(font, 24, 40, this.saveNotice || this.status, 110);
@@ -50,7 +50,7 @@ export class TranscribeLayer implements Layer {
image.drawText(font, 32, y, wrapped[index]!, 230);
}
image.drawText(font, 24, footerY, "Click: save Double-click: back", 110);
image.drawText(font, 24, footerY, `${GESTURE_CLICK} save ${GESTURE_DOUBLE_CLICK} back`, 110);
return image;
}