waveterm/frontend/builder/store/builder-focusmanager.ts
Mike Sawka ba573c4bcb
tsunami builder 3 (checkpoint) (#2487)
Got preview hooked up, log output hooked up, environment tab hooked
up... the controller, restarting the apps. it is actually working! still
lots to do and lots of hard coding to fix, but it is coming together...
2025-10-28 13:59:02 -07:00

34 lines
905 B
TypeScript

// Copyright 2025, Command Line Inc.
// SPDX-License-Identifier: Apache-2.0
import { globalStore } from "@/app/store/jotaiStore";
import { atom, type PrimitiveAtom } from "jotai";
export type BuilderFocusType = "waveai" | "app";
export class BuilderFocusManager {
private static instance: BuilderFocusManager | null = null;
focusType: PrimitiveAtom<BuilderFocusType> = atom("app");
private constructor() {}
static getInstance(): BuilderFocusManager {
if (!BuilderFocusManager.instance) {
BuilderFocusManager.instance = new BuilderFocusManager();
}
return BuilderFocusManager.instance;
}
setWaveAIFocused() {
globalStore.set(this.focusType, "waveai");
}
setAppFocused() {
globalStore.set(this.focusType, "app");
}
getFocusType(): BuilderFocusType {
return globalStore.get(this.focusType);
}
}