Port Transcribe to new UI; remove legacy dashboard

This commit is contained in:
James Babcock committed 2026-07-07 22:11:28 -07:00
1 parent 56d0f8c351
commit d0c30f9ca9
21 files changed
+392 -1291

No files matched your search

+1 -2
View File
@@ -1,7 +1,6 @@
import { getDefaultSmallFont } from "../../graphics/bdffont";
import { GrayImage } from "../../graphics/image";
import { nightscoutBridge, type NightscoutState } from "../../native/nightscout-bridge";
import { getPluginState } from "../dashboard";
import { NightscoutLayer } from "../apps/nightscout";
import {
createInProcessWindow,
@@ -35,7 +34,7 @@ export function createNightscoutAppWindow(options: InProcessAppOptions): InProce
iconLetter: "Ns",
closeable: true,
actions: options.actions,
baseLayer: new YieldAtRootLayer(new NightscoutLayer(getPluginState)),
baseLayer: new YieldAtRootLayer(new NightscoutLayer()),
submitFrame: options.submitFrame,
setSurfaceVisible: options.setSurfaceVisible,
removeSurface: options.removeSurface,
+2 -1
View File
@@ -66,9 +66,10 @@ const noopActions: LayerActions = {
disconnect: () => {},
startTextSettingEdit: () => {},
endTextSettingEdit: () => {},
setTranscribeRenderActive: () => {},
startVoiceCapture: () => {},
stopVoiceCapture: () => {},
startContinuousVoiceCapture: () => {},
stopContinuousVoiceCapture: () => {},
playBuzzerSequence: () => {},
};
+77
View File
@@ -0,0 +1,77 @@
import { imageFromAsciiArt } from "../../graphics/image";
import { TranscribeLayer } from "../apps/transcribe";
import type { LayerActions } from "../layers";
import {
createInProcessWindow,
YieldAtRootLayer,
type InProcessAppOptions,
type InProcessWindow,
} from "./in-process-window";
import { shell } from "./shell";
export const TRANSCRIBE_WINDOW_ID = "transcribe";
export const TRANSCRIBE_SURFACE_ID = "window:transcribe";
const TRAY_ICON_ID = "transcribe";
// 16x18 microphone glyph for the top-bar tray.
const MIC_ICON = imageFromAsciiArt(
[
" #### ",
" ###### ",
" # # ",
" # # ",
" # # ",
" # # ",
" # # ",
" # # # # ",
" # # # # ",
" # #### # ",
" # # ",
" ###### ",
" # ",
" # ",
" ###### ",
],
220,
);
export type TranscribeAppOptions = InProcessAppOptions & {
/** Begin continuous mic capture (kept on while the window is open). */
startContinuousVoiceCapture: () => void;
stopContinuousVoiceCapture: () => void;
};
/**
* The Transcribe app: live speech-to-text in its own window. While open it
* holds continuous mic capture (so push-to-talk can share the stream) and
* shows a microphone tray icon in the top bar.
*/
export function createTranscribeAppWindow(options: TranscribeAppOptions): InProcessWindow {
const layer = new TranscribeLayer();
const actions: LayerActions = { ...options.actions };
const app = createInProcessWindow({
appId: "transcribe",
windowId: TRANSCRIBE_WINDOW_ID,
title: "Transcribe",
iconLetter: "Tr",
closeable: true,
actions,
baseLayer: new YieldAtRootLayer(layer),
submitFrame: options.submitFrame,
setSurfaceVisible: options.setSurfaceVisible,
removeSurface: options.removeSurface,
onClosed: () => {
options.stopContinuousVoiceCapture();
shell.setTrayIcon(TRAY_ICON_ID, null);
options.onClosed();
},
});
// start() wires the layer's transcript/status subscriptions; the LayerStack
// exposes its context through a paint, but the layer needs it up front, so
// build a minimal context here.
layer.start({ stack: app.stack, actions });
options.startContinuousVoiceCapture();
shell.setTrayIcon(TRAY_ICON_ID, MIC_ICON);
return app;
}