From b14278dda8b9063155a53461f809442c4c27132d Mon Sep 17 00:00:00 2001 From: Emilia Date: Mon, 5 Jun 2023 14:56:01 -0400 Subject: [PATCH] Avoid export of an empty file --- src/components/main_window.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/main_window.rs b/src/components/main_window.rs index ae45ab6..948016c 100644 --- a/src/components/main_window.rs +++ b/src/components/main_window.rs @@ -72,6 +72,10 @@ pub fn MainWindow() -> Html { let save_button_callback = { let main_state = main_state.clone(); Callback::from(move |_| { + if main_state.transfers.len() == 0 { + web_sys::window().unwrap().alert_with_message("No transfers to export.").unwrap(); + return () + } if let Ok(csv) = state_to_csv(&main_state) { let csv: &str = &csv; let blob = Blob::new_with_str_sequence(