Remember Window state #199

This commit is contained in:
Prayag Prajapati committed 2023-10-07 16:56:30 +05:30
1 parent 1125ef2539
commit 8c9e5aec18
5 files changed
+32 -31

No files matched your search

+23
View File
@@ -6,9 +6,32 @@
<link rel="icon" type="image/svg+xml" href="/icon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Jellyplayer</title>
<style>
.app-loading {
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
background: hsl(256, 100%, 4%);
z-index: 100000;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
.app-loading-logo {
width: 65vw;
}
</style>
</head>
<body>
<div class="app-loading">
<img src="./public/assetsStatic/LogoBig.svg" class="app-loading-logo" />
</div>
<div id="root"></div>
<svg style="width:0;height:0;position:absolute;" aria-hidden="true" focusable="false">
<linearGradient id="clr-gradient-default" x2="1" y2="1">
+1
View File
@@ -22,6 +22,7 @@ tauri = { version = "1.5.1", features = [ "http-all", "devtools", "process-exit"
tauri-plugin-store = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
tauri-plugin-localhost = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1" }
tauri-plugin-log = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev", features = ["colored"] }
tauri-plugin-window-state = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1" }
portpicker = "0.1" # used in the example to pick a random free port
[features]
+1 -17
View File
@@ -1,20 +1,7 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
use tauri::Manager;
use tauri::{utils::config::AppUrl, WindowUrl};
use tauri_plugin_log::{fern::colors::ColoredLevelConfig, LogTarget};
// Create the command:
// This command must be async so that it doesn't run on the main thread.
#[tauri::command]
async fn close_splashscreen(window: tauri::Window) {
// Close splashscreen
if let Some(splashscreen) = window.get_window("splashscreen") {
splashscreen.close().unwrap();
}
// Show main window
window.get_window("main").unwrap().show().unwrap();
}
// Tauri by default uses HTTPS, so use the localhost plugin to downgrade back to
// HTTP. However, when running tauri dev, we already have a localhost server
// provided by vite, so don't enable it
@@ -52,10 +39,7 @@ fn main() {
.build(),
)
.plugin(tauri_plugin_store::Builder::default().build())
.invoke_handler(tauri::generate_handler![close_splashscreen])
.plugin(tauri_plugin_window_state::Builder::default().build())
.run(context)
.expect("error while running JellyPlayer");
// tauri::Builder::default()
// .run(tauri::generate_context!())
// .expect("error while running tauri application");
}
+1 -14
View File
@@ -96,26 +96,13 @@
"active": false
},
"windows": [
{
"width": 800,
"height": 300,
"center": true,
"decorations": false,
"resizable": false,
"url": "splash.html",
"label": "splashscreen",
"title": "JellyPlayer",
"visible": true,
"transparent": true
},
{
"fullscreen": false,
"height": 600,
"width": 800,
"resizable": true,
"title": "JellyPlayer",
"visible": false,
"visible": true,
"center": true,
"label": "main"
}
+6
View File
@@ -167,6 +167,12 @@ const AnimationWrapper = () => {
function App() {
const navigate = useNavigate();
useEffect(() => {
document
.querySelector(".app-loading")
.setAttribute("style", "display:none");
}, []);
const [serverReachable, setServerReachable] = useState(true);
const [playbackDataLoading] = usePlaybackDataLoadStore((state) => [