Skip to content

Commit

Permalink
fix:prompt broken after action (#78)
Browse files Browse the repository at this point in the history
## Motivation

<!-- List motivation and changes here -->

after an action the prompt was broken
This fix blurs the prompt (as intended)

## Issues closed

<!-- List closed issues here -->
  • Loading branch information
pixelass committed Mar 15, 2024
1 parent 8c608a6 commit a00f896
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/electron/future/apps.ts
@@ -0,0 +1,4 @@
// Cache for apps that are opened
import type { BrowserWindow } from "electron";

export const apps: Record<string, BrowserWindow | null> = {};
6 changes: 5 additions & 1 deletion src/electron/future/ipc/sdk.ts
Expand Up @@ -12,6 +12,7 @@ import { buildKey } from "#/build-key";
import { ID } from "#/enums";
import type { StoryRequest } from "#/types/story";
import type { VectorStoreDocument } from "#/types/vector-store";
import { apps } from "@/apps";
import { captionImages, createStory, maxTokenMap } from "@/ipc/story";
import { userStore } from "@/stores";
import {
Expand Down Expand Up @@ -333,7 +334,10 @@ ipcMain.on(
console.log(error);
}

event.sender.close();
if (apps.prompt) {
apps.prompt.blur();
}

break;
}

Expand Down
4 changes: 1 addition & 3 deletions src/electron/future/main.ts
Expand Up @@ -13,6 +13,7 @@ import { buildKey } from "#/build-key";
import { LOCAL_PROTOCOL } from "#/constants";
import { DownloadState, ID } from "#/enums";
import { isProduction } from "#/flags";
import { apps } from "@/apps";
import { isCoreApp, isCoreView } from "@/utils/core";
import { createWindow } from "@/utils/create-window";
import { loadURL } from "@/utils/load-window";
Expand Down Expand Up @@ -221,9 +222,6 @@ async function createAppWindow(id: string, options: BrowserWindowConstructorOpti
return appWindow;
}

// Cache for apps that are opened
const apps: Record<string, BrowserWindow | null> = {};

async function runStartup() {
apps.prompt = await createPromptWindow();
apps.core = await createCoreWindow();
Expand Down

0 comments on commit a00f896

Please sign in to comment.