diff --git a/Cargo.lock b/Cargo.lock index ce00505..04ec3f6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3404,7 +3404,7 @@ dependencies = [ [[package]] name = "turing-machine" -version = "1.3.3" +version = "1.3.4" dependencies = [ "base64", "bincode", diff --git a/locales/ads.json b/locales/ads.json new file mode 100644 index 0000000..d1343ce --- /dev/null +++ b/locales/ads.json @@ -0,0 +1,14 @@ +{ + "lbl.ad.native": { + "en": "Please consider using the native version for a better experience.", + "es": "Por favor, considere usar la versión nativa para una mejor experiencia." + }, + "lbl.ad.exe": { + "en": "Click to download.", + "es": "Haz click aquí para descargarla." + }, + "lbl.ad.explanation": { + "en": "The native version has code autosaving, persistent configuration, and more.", + "es": "La versión nativa tiene autoguardado de código, configuración persistente, y más." + } +} diff --git a/src/window.rs b/src/window.rs index 6323349..4b627db 100644 --- a/src/window.rs +++ b/src/window.rs @@ -825,7 +825,7 @@ impl MyApp { if ui.link(t!("menu.repository", lang)).clicked() { webbrowser::open( - "https://github.com/margual56/turing-machine-2.0", + "https://github.com/turing-marcos/turing-machine", ) .unwrap(); } @@ -1167,6 +1167,38 @@ impl MyApp { } }); }); + + #[cfg(target_family = "wasm")] + { + let child_size = egui::Rect::from_center_size( + egui::pos2( + main_panel.cursor().center().x, + ctx.available_rect().center_bottom().y - 50.0, + ), + egui::Vec2::new(ctx.available_rect().width() / 2.0, 30.0), + ); + let mut popup = main_panel.child_ui(child_size, egui::Layout::default()); + ctx.set_debug_on_hover(true); + egui::Frame::popup(&ctx.style()) + .stroke(egui::Stroke::NONE) + .fill(Color32::from_rgba_unmultiplied(0, 0, 0, 0)) + .show(&mut popup, |ui| { + ui.vertical_centered(|ui| { + ui.horizontal(|ui| { + ui.label(t!("lbl.ad.native", &lang)); + + if ui.link(t!("lbl.ad.exe", &lang)).clicked() { + webbrowser::open( + "https://github.com/turing-marcos/turing-machine/releases/latest", + ) + .unwrap(); + } + }); + }); + }) + .response + .on_hover_text_at_pointer(t!("lbl.ad.explanation", &lang)); + } }); } }