refactor(image-viewer): update ImageViewer component structure and remove commented code

This commit is contained in:
2025-04-22 22:13:40 +02:00
parent dc83bdb3fb
commit 78fe25497b
2 changed files with 4 additions and 13 deletions

View File

@ -1,7 +1,7 @@
use base64::{engine::general_purpose::STANDARD as BASE64, Engine as _}; use base64::{engine::general_purpose::STANDARD as BASE64, Engine as _};
use std::fs; use std::fs;
use std::process::Command; 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 /// Takes a screenshot of a selected area and returns the image data as base64
pub fn take_area_screenshot<R: Runtime>(app: &AppHandle<R>) -> Result<String, String> { pub fn take_area_screenshot<R: Runtime>(app: &AppHandle<R>) -> Result<String, String> {
@ -39,15 +39,8 @@ pub fn take_area_screenshot<R: Runtime>(app: &AppHandle<R>) -> Result<String, St
println!("Warning: Failed to remove temporary screenshot file: {}", e); println!("Warning: Failed to remove temporary screenshot file: {}", e);
} }
// Log the base64 string (truncated for readability) app.emit("png-processed", base64_string.clone())
if base64_string.len() > 100 { .map_err(|e| format!("Failed to emit event: {}", e))?;
println!(
"Screenshot base64 (truncated): {}...",
&base64_string[..100]
);
} else {
println!("Screenshot base64: {}", base64_string);
}
Ok(base64_string) Ok(base64_string)
} }

View File

@ -37,9 +37,7 @@ export function ImageViewer() {
return null; return null;
// return ( // return (
// <div> // <div class="fixed inset-0">
// <FolderPicker />
// {latestImage() && ( // {latestImage() && (
// <div class="mt-4"> // <div class="mt-4">
// <h3>Latest Processed Image:</h3> // <h3>Latest Processed Image:</h3>