-
-
Notifications
You must be signed in to change notification settings - Fork 796
preview updates (mock electron api, wos checks) #2986
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
dba46ec
99bb4a6
189338b
c53ef4a
d8063d8
433f3c8
59612f4
13bed12
00a1d26
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| // Copyright 2026, Command Line Inc. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| const previewElectronApi: ElectronApi = { | ||
| getAuthKey: () => "", | ||
| getIsDev: () => false, | ||
| getCursorPoint: () => ({ x: 0, y: 0 } as Electron.Point), | ||
| getPlatform: () => "darwin", | ||
| getEnv: (_varName: string) => "", | ||
| getUserName: () => "", | ||
| getHostName: () => "", | ||
| getDataDir: () => "", | ||
| getConfigDir: () => "", | ||
| getHomeDir: () => "", | ||
| getWebviewPreload: () => "", | ||
| getAboutModalDetails: () => ({} as AboutModalDetails), | ||
| getZoomFactor: () => 1.0, | ||
| showWorkspaceAppMenu: (_workspaceId: string) => {}, | ||
| showBuilderAppMenu: (_builderId: string) => {}, | ||
| showContextMenu: (_workspaceId: string, _menu: ElectronContextMenuItem[]) => {}, | ||
| onContextMenuClick: (_callback: (id: string | null) => void) => {}, | ||
| onNavigate: (_callback: (url: string) => void) => {}, | ||
| onIframeNavigate: (_callback: (url: string) => void) => {}, | ||
| downloadFile: (_path: string) => {}, | ||
| openExternal: (_url: string) => {}, | ||
| onFullScreenChange: (_callback: (isFullScreen: boolean) => void) => {}, | ||
| onZoomFactorChange: (_callback: (zoomFactor: number) => void) => {}, | ||
| onUpdaterStatusChange: (_callback: (status: UpdaterStatus) => void) => {}, | ||
| getUpdaterStatus: () => "up-to-date", | ||
| getUpdaterChannel: () => "", | ||
| installAppUpdate: () => {}, | ||
| onMenuItemAbout: (_callback: () => void) => {}, | ||
| updateWindowControlsOverlay: (_rect: Dimensions) => {}, | ||
| onReinjectKey: (_callback: (waveEvent: WaveKeyboardEvent) => void) => {}, | ||
| setWebviewFocus: (_focusedId: number) => {}, | ||
| registerGlobalWebviewKeys: (_keys: string[]) => {}, | ||
| onControlShiftStateUpdate: (_callback: (state: boolean) => void) => {}, | ||
| createWorkspace: () => {}, | ||
| switchWorkspace: (_workspaceId: string) => {}, | ||
| deleteWorkspace: (_workspaceId: string) => {}, | ||
| setActiveTab: (_tabId: string) => {}, | ||
| createTab: () => {}, | ||
| closeTab: (_workspaceId: string, _tabId: string, _confirmClose: boolean) => Promise.resolve(false), | ||
| setWindowInitStatus: (_status: "ready" | "wave-ready") => {}, | ||
| onWaveInit: (_callback: (initOpts: WaveInitOpts) => void) => {}, | ||
| onBuilderInit: (_callback: (initOpts: BuilderInitOpts) => void) => {}, | ||
| sendLog: (_log: string) => {}, | ||
| onQuicklook: (_filePath: string) => {}, | ||
| openNativePath: (_filePath: string) => {}, | ||
| captureScreenshot: (_rect: Electron.Rectangle) => Promise.resolve(""), | ||
| setKeyboardChordMode: () => {}, | ||
| clearWebviewStorage: (_webContentsId: number) => Promise.resolve(), | ||
| setWaveAIOpen: (_isOpen: boolean) => {}, | ||
| closeBuilderWindow: () => {}, | ||
| incrementTermCommands: (_opts?: { isRemote?: boolean; isWsl?: boolean; isDurable?: boolean }) => {}, | ||
| nativePaste: () => {}, | ||
| openBuilder: (_appId?: string) => {}, | ||
| setBuilderWindowAppId: (_appId: string) => {}, | ||
| doRefresh: () => {}, | ||
| saveTextFile: (_fileName: string, _content: string) => Promise.resolve(false), | ||
| }; | ||
|
|
||
| function installPreviewElectronApi() { | ||
| (window as any).api = previewElectronApi; | ||
| } | ||
|
|
||
| export { installPreviewElectronApi }; | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,11 +2,13 @@ | |||||||||||||||||||
| // SPDX-License-Identifier: Apache-2.0 | ||||||||||||||||||||
|
|
||||||||||||||||||||
| import Logo from "@/app/asset/logo.svg"; | ||||||||||||||||||||
| import { ClientModel } from "@/app/store/client-model"; | ||||||||||||||||||||
| import { setWaveWindowType } from "@/app/store/windowtype"; | ||||||||||||||||||||
| import { getAtoms, initGlobalAtoms } from "@/app/store/global-atoms"; | ||||||||||||||||||||
| import { GlobalModel } from "@/app/store/global-model"; | ||||||||||||||||||||
| import { globalStore } from "@/app/store/jotaiStore"; | ||||||||||||||||||||
| import { loadFonts } from "@/util/fontutil"; | ||||||||||||||||||||
| import React, { lazy, Suspense } from "react"; | ||||||||||||||||||||
| import { createRoot } from "react-dom/client"; | ||||||||||||||||||||
| import { installPreviewElectronApi } from "./preview-electron-api"; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| import "../app/app.scss"; | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
|
@@ -118,10 +120,23 @@ function PreviewApp() { | |||||||||||||||||||
| return <PreviewIndex />; | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| const PreviewTabId = crypto.randomUUID(); | ||||||||||||||||||||
| const PreviewWindowId = crypto.randomUUID(); | ||||||||||||||||||||
| const PreviewClientId = crypto.randomUUID(); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| function initPreview() { | ||||||||||||||||||||
| setWaveWindowType("preview"); | ||||||||||||||||||||
| // Preview mode has no connected backend client object, but onboarding previews read clientAtom. | ||||||||||||||||||||
| ClientModel.getInstance().initialize(null); | ||||||||||||||||||||
| installPreviewElectronApi(); | ||||||||||||||||||||
| const initOpts = { | ||||||||||||||||||||
| tabId: PreviewTabId, | ||||||||||||||||||||
| windowId: PreviewWindowId, | ||||||||||||||||||||
| clientId: PreviewClientId, | ||||||||||||||||||||
| environment: "renderer", | ||||||||||||||||||||
| platform: "darwin", | ||||||||||||||||||||
| isPreview: true, | ||||||||||||||||||||
| } as GlobalInitOptions; | ||||||||||||||||||||
| initGlobalAtoms(initOpts); | ||||||||||||||||||||
| globalStore.set(getAtoms().fullConfigAtom, {} as FullConfigType); | ||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Initialize Line 138 sets 🔧 Proposed fix- globalStore.set(getAtoms().fullConfigAtom, {} as FullConfigType);
+ globalStore.set(
+ getAtoms().fullConfigAtom,
+ {
+ settings: {},
+ presets: {},
+ connections: {},
+ } as FullConfigType
+ );📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||
| GlobalModel.getInstance().initialize(initOpts); | ||||||||||||||||||||
| loadFonts(); | ||||||||||||||||||||
| const root = createRoot(document.getElementById("main")!); | ||||||||||||||||||||
| root.render(<PreviewApp />); | ||||||||||||||||||||
|
|
||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: wavetermdev/waveterm
Length of output: 158
🏁 Script executed:
Repository: wavetermdev/waveterm
Length of output: 14237
🏁 Script executed:
Repository: wavetermdev/waveterm
Length of output: 46
Implement missing
setIsActivemethod inpreviewElectronApi.The object declared as type
ElectronApiat line 4 is missing thesetIsActive: () => Promise<void>method required by the type contract infrontend/types/custom.d.ts.Fix
const previewElectronApi: ElectronApi = { doRefresh: () => {}, saveTextFile: (_fileName: string, _content: string) => Promise.resolve(false), + setIsActive: () => Promise.resolve(), };📝 Committable suggestion
🤖 Prompt for AI Agents