Merge branch '12-remember-window-size-position' into 'main'

Resolve "Remember window size & position"

Closes #12

See merge request products/mindwork-ai-studio!9
This commit is contained in:
Thorsten 2024-06-01 15:41:12 +00:00
commit 230c58a42a
5 changed files with 57 additions and 0 deletions

View File

@ -0,0 +1,7 @@
@inherits ConfigurationBase
<MudField Label="@this.OptionDescription" Variant="Variant.Outlined" HelperText="@this.OptionHelp" Class="@MARGIN_CLASS">
<MudButton Variant="Variant.Filled" StartIcon="@this.TriggerIcon" OnClick="@this.Click">
@this.TriggerText
</MudButton>
</MudField>

View File

@ -0,0 +1,24 @@
using Microsoft.AspNetCore.Components;
namespace AIStudio.Components;
public partial class ConfigurationTrigger : ConfigurationBase
{
[Parameter]
public string TriggerText { get; set; } = string.Empty;
[Parameter]
public string TriggerIcon { get; set; } = Icons.Material.Filled.AddBox;
[Parameter]
public Action OnClickSync { get; set; } = () => { };
[Parameter]
public Func<Task> OnClickAsync { get; set; } = () => Task.CompletedTask;
private async Task Click()
{
this.OnClickSync();
await this.OnClickAsync();
}
}

24
runtime/Cargo.lock generated
View File

@ -326,6 +326,15 @@ version = "0.21.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567"
[[package]]
name = "bincode"
version = "1.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad"
dependencies = [
"serde",
]
[[package]]
name = "bitflags"
version = "1.3.2"
@ -2199,6 +2208,7 @@ dependencies = [
"serde_json",
"tauri",
"tauri-build",
"tauri-plugin-window-state",
"tokio",
]
@ -3909,6 +3919,20 @@ dependencies = [
"tauri-utils",
]
[[package]]
name = "tauri-plugin-window-state"
version = "0.1.1"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v1#5e3900e682e13f3759b439116ae2f77a6d389ca2"
dependencies = [
"bincode",
"bitflags 2.5.0",
"log",
"serde",
"serde_json",
"tauri",
"thiserror",
]
[[package]]
name = "tauri-runtime"
version = "0.14.2"

View File

@ -10,6 +10,7 @@ tauri-build = { version = "1.5", features = [] }
[dependencies]
tauri = { version = "1.6", features = [ "http-all", "shell-sidecar", "path-all", "shell-open"] }
tauri-plugin-window-state = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1" }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
keyring = "2"

View File

@ -187,6 +187,7 @@ fn main() {
*main_window.lock().unwrap() = Some(window);
Ok(())
})
.plugin(tauri_plugin_window_state::Builder::default().build())
.invoke_handler(tauri::generate_handler![store_secret, get_secret, delete_secret, set_clipboard])
.run(tauri::generate_context!())
.expect("Error while running Tauri application");