waveterm/frontend/app/tab/tabbar-model.ts
Mike Sawka 2463e54479
Make Block Close / Cmd-W more consistent (#2417)
Don't allow tabs with active Wave AI sessions to get closed when we
close the last block. Have Cmd-W close Wave AI if it is focused (rather
than a random node). Also fixes some lurking bugs with the pinned tab
functionality (and adds some nice visual feedback when we try to close a
pinned tab).
2025-10-09 23:57:02 -07:00

26 lines
No EOL
666 B
TypeScript

// Copyright 2025, Command Line Inc.
// SPDX-License-Identifier: Apache-2.0
import { atom, type PrimitiveAtom } from "jotai";
import { globalStore } from "@/app/store/jotaiStore";
export class TabBarModel {
private static instance: TabBarModel | null = null;
jigglePinAtom: PrimitiveAtom<number> = atom(0);
private constructor() {
// Empty for now
}
static getInstance(): TabBarModel {
if (!TabBarModel.instance) {
TabBarModel.instance = new TabBarModel();
}
return TabBarModel.instance;
}
jiggleActivePinnedTab() {
globalStore.set(this.jigglePinAtom, (prev) => prev + 1);
}
}