From 1e706e2eef7f21ec9b9465287b5f9ace1ee78656 Mon Sep 17 00:00:00 2001 From: saboooor Date: Sun, 17 Dec 2023 19:31:11 -0700 Subject: [PATCH] update tauri --- pnpm-lock.yaml | 2 +- src-tauri/Cargo.lock | 2 +- src-tauri/Cargo.toml | 2 +- src-tauri/src/lib.rs | 31 ++++++------------------------- src-tauri/tauri.conf.json | 3 ++- src/components/Nav.tsx | 13 ++++++++----- src/routes/layout.tsx | 2 +- 7 files changed, 20 insertions(+), 35 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 19882db8..f1d798e0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -21,7 +21,7 @@ devDependencies: specifier: next version: 2.0.0-alpha.12 '@tauri-apps/cli': - specifier: 2.0.0-alpha.18 + specifier: next version: 2.0.0-alpha.18 '@tauri-apps/plugin-notification': specifier: github:tauri-apps/tauri-plugin-notification#v2 diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 0ff90486..1e418062 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -3065,7 +3065,7 @@ checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" [[package]] name = "simplymc" -version = "0.3.5" +version = "0.4.0" dependencies = [ "serde", "serde_json", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index dd0743ee..f25033b1 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "simplymc" -version = "0.3.5" +version = "0.4.0" description = "SimplyMC but an app" authors = ["LuminescentDev"] license = "AGPL-3.0-or-later" diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 3388f39b..d72389a8 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -1,38 +1,19 @@ -use tauri::{CustomMenuItem, Menu, Submenu}; +use tauri::menu::MenuBuilder; #[tauri::command] fn greet() -> &'static str { "Hello, Tauri!" } #[cfg_attr(mobile, tauri::mobile_entry_point)] pub fn run() { - let refresh: CustomMenuItem = CustomMenuItem::new("refresh".to_string(), "Refresh"); - let quit: CustomMenuItem = CustomMenuItem::new("quit".to_string(), "Quit"); - let simplymc: Submenu = Submenu::new("SimplyMC", Menu::new() - .add_item(refresh) - .add_item(quit) - ); - let en_us: CustomMenuItem = CustomMenuItem::new("en-US".to_string(), "English (US)"); - let es_es: CustomMenuItem = CustomMenuItem::new("es-ES".to_string(), "Español (Spanish - ES)"); - let nl_nl: CustomMenuItem = CustomMenuItem::new("nl-NL".to_string(), "Nederlands (Dutch - NL)"); - let pt_pt: CustomMenuItem = CustomMenuItem::new("pt-PT".to_string(), "Português (Portuguese - PT)"); - let language: Submenu = Submenu::new("Language", Menu::new() - .add_item(en_us) - .add_item(es_es) - .add_item(nl_nl) - .add_item(pt_pt) - ); - let menu: Menu = Menu::new().add_submenu(simplymc).add_submenu(language); tauri::Builder::default() - .menu(menu) - .on_menu_event(|event| { - match event.menu_item_id() { - "quit" => { std::process::exit(0); } - _ => {} - } + .setup(|app| { + let menu = MenuBuilder::new(app).copy().paste().undo().redo().build()?; + app.set_menu(menu)?; + Ok(()) }) .plugin(tauri_plugin_notification::init()) .plugin(tauri_plugin_window_state::Builder::default().build()) .invoke_handler(tauri::generate_handler![greet]) .run(tauri::generate_context!()) .expect("error while running tauri application"); -} +} \ No newline at end of file diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index da602f77..1970a471 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -10,6 +10,7 @@ "productName": "SimplyMC", "version": "0.3.5" }, + "plugins": {}, "tauri": { "bundle": { "active": true, @@ -58,4 +59,4 @@ } ] } -} +} \ No newline at end of file diff --git a/src/components/Nav.tsx b/src/components/Nav.tsx index 54abec8f..56017cec 100644 --- a/src/components/Nav.tsx +++ b/src/components/Nav.tsx @@ -16,7 +16,7 @@ import { version } from '~/../package.json'; import Luminescent from './icons/Luminescent'; import LoadingIcon from './icons/LoadingIcon'; -import { Window } from '@tauri-apps/plugin-window'; +import { Window } from '@tauri-apps/api/window'; import { sendNotification, isPermissionGranted, requestPermission } from '@tauri-apps/plugin-notification'; export default component$(({ tauriVersion }: any) => { @@ -25,7 +25,7 @@ export default component$(({ tauriVersion }: any) => { return (