feat(image-viewer): enhance window focus and visibility handling in ImageViewer component
This commit is contained in:
@@ -1,7 +1,13 @@
|
||||
import { listen } from "@tauri-apps/api/event";
|
||||
import { createEffect } from "solid-js";
|
||||
|
||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
||||
import { createEffect, createSignal } from "solid-js";
|
||||
import { sendImage } from "../network";
|
||||
|
||||
// TODO: This component should focus the window and show preview of screenshot,
|
||||
// before we send it to backend, potentially we could draw and annotate
|
||||
// OR we kill this and do stuff siltently
|
||||
// anyhow keeping it like this for now
|
||||
export function ImageViewer() {
|
||||
// const [latestImage, setLatestImage] = createSignal<string | null>(null);
|
||||
|
||||
@@ -11,10 +17,15 @@ export function ImageViewer() {
|
||||
console.log("Received processed PNG", event);
|
||||
const base64Data = event.payload as string;
|
||||
|
||||
const appWindow = getCurrentWindow();
|
||||
|
||||
appWindow.show();
|
||||
appWindow.setFocus();
|
||||
|
||||
// setLatestImage(`data:image/png;base64,${base64Data}`);
|
||||
|
||||
const result = await sendImage("test-image.png", base64Data);
|
||||
|
||||
window.location.reload();
|
||||
console.log("DBG: ", result);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user