From e735aca16893b194330ebdbab03c5cde08b1c81c Mon Sep 17 00:00:00 2001 From: Dmytro Kondakov Date: Tue, 22 Apr 2025 22:13:40 +0200 Subject: [PATCH] refactor(image-viewer): update ImageViewer component structure and remove commented code --- frontend/src-tauri/src/screenshot.rs | 13 +++---------- frontend/src/components/ImageViewer.tsx | 4 +--- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/frontend/src-tauri/src/screenshot.rs b/frontend/src-tauri/src/screenshot.rs index 8d58e68..1b78861 100644 --- a/frontend/src-tauri/src/screenshot.rs +++ b/frontend/src-tauri/src/screenshot.rs @@ -1,7 +1,7 @@ use base64::{engine::general_purpose::STANDARD as BASE64, Engine as _}; use std::fs; use std::process::Command; -use tauri::{AppHandle, Runtime}; +use tauri::{AppHandle, Emitter, Runtime}; /// Takes a screenshot of a selected area and returns the image data as base64 pub fn take_area_screenshot(app: &AppHandle) -> Result { @@ -39,15 +39,8 @@ pub fn take_area_screenshot(app: &AppHandle) -> Result 100 { - println!( - "Screenshot base64 (truncated): {}...", - &base64_string[..100] - ); - } else { - println!("Screenshot base64: {}", base64_string); - } + app.emit("png-processed", base64_string.clone()) + .map_err(|e| format!("Failed to emit event: {}", e))?; Ok(base64_string) } diff --git a/frontend/src/components/ImageViewer.tsx b/frontend/src/components/ImageViewer.tsx index 65e491d..2931f21 100644 --- a/frontend/src/components/ImageViewer.tsx +++ b/frontend/src/components/ImageViewer.tsx @@ -37,9 +37,7 @@ export function ImageViewer() { return null; // return ( - //
- // - + //
// {latestImage() && ( //
//

Latest Processed Image: