waveterm/frontend/app/waveenv/waveenvimpl.ts
Copilot ecccad6ea1
TabBar full preview + much more FE mocking via WaveEnv to enable it (#3028)
Large PR that extends WaveEnv mocking to fully cover the (complicated) TabBar implementation.  Also includes a full preview of the tab bar in the preview server with lots of controls to simulate different scenarios.

As a result of this mocking, also fixed a bunch of dependencies, and layout errors, random bugs, and visual UX bugs in the tab bar, making it more robust.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sawka <2722291+sawka@users.noreply.github.com>
Co-authored-by: sawka <mike@commandline.dev>
2026-03-11 13:54:12 -07:00

54 lines
1.7 KiB
TypeScript

// Copyright 2026, Command Line Inc.
// SPDX-License-Identifier: Apache-2.0
import { ContextMenuModel } from "@/app/store/contextmenu";
import { AllServiceImpls } from "@/app/store/services";
import {
atoms,
createBlock,
getBlockMetaKeyAtom,
getConnConfigKeyAtom,
getConnStatusAtom,
getLocalHostDisplayNameAtom,
getSettingsKeyAtom,
isDev,
WOS,
} from "@/app/store/global";
import { RpcApi } from "@/app/store/wshclientapi";
import { WaveEnv } from "@/app/waveenv/waveenv";
import { isMacOS, isWindows, PLATFORM } from "@/util/platformutil";
export function makeWaveEnvImpl(): WaveEnv {
return {
isMock: false,
electron: (window as any).api,
rpc: RpcApi,
getSettingsKeyAtom,
platform: PLATFORM,
isDev,
isWindows,
isMacOS,
atoms,
createBlock,
services: AllServiceImpls,
callBackendService: WOS.callBackendService,
showContextMenu: (menu: ContextMenuItem[], e: React.MouseEvent) => {
ContextMenuModel.getInstance().showContextMenu(menu, e);
},
getConnStatusAtom,
getLocalHostDisplayNameAtom,
wos: {
getWaveObjectAtom: WOS.getWaveObjectAtom,
getWaveObjectLoadingAtom: WOS.getWaveObjectLoadingAtom,
isWaveObjectNullAtom: WOS.isWaveObjectNullAtom,
useWaveObjectValue: WOS.useWaveObjectValue,
},
getBlockMetaKeyAtom,
getConnConfigKeyAtom,
mockSetWaveObj: <T extends WaveObj>(_oref: string, _obj: T) => {
throw new Error("mockSetWaveObj is only available in the preview server");
},
mockModels: new Map<any, any>(),
};
}