feat(processing-image): displaying initial status from response

This commit is contained in:
2025-04-26 11:41:44 +01:00
parent e2a4b85d15
commit b27e191e5c
4 changed files with 41 additions and 21 deletions

View File

@@ -1,14 +1,14 @@
import { listen } from "@tauri-apps/api/event";
import { getCurrentWindow } from "@tauri-apps/api/window";
import { createEffect, createSignal } from "solid-js";
import { type Component, createEffect } 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() {
type ImageViewerProps = {
onSendImage: (
processingImage: Awaited<ReturnType<typeof sendImage>>,
) => void;
};
export const ImageViewer: Component<ImageViewerProps> = (props) => {
// const [latestImage, setLatestImage] = createSignal<string | null>(null);
createEffect(async () => {
@@ -26,6 +26,9 @@ export function ImageViewer() {
const result = await sendImage("test-image.png", base64Data);
props.onSendImage(result);
window.location.reload();
console.log("DBG: ", result);
});
@@ -50,4 +53,4 @@ export function ImageViewer() {
// )}
// </div>
// );
}
};

View File

@@ -0,0 +1,22 @@
import { Show, type Accessor, type Component } from "solid-js";
import type { sendImage } from "../../network";
type ImageStatusProps = {
processingImage: Accessor<
Awaited<ReturnType<typeof sendImage>> | undefined
>;
};
export const ImageStatus: Component<ImageStatusProps> = (props) => {
return (
<Show when={props.processingImage()}>
{(image) => (
<div>
<p>
{image().ImageID} - {image().Status}
</p>
</div>
)}
</Show>
);
};