diff --git a/client/src-tauri/src/telemetry/create_client.rs b/client/src-tauri/src/telemetry/create_client.rs index cfc521c..4fc5691 100644 --- a/client/src-tauri/src/telemetry/create_client.rs +++ b/client/src-tauri/src/telemetry/create_client.rs @@ -32,7 +32,7 @@ pub async fn create_client( Ok(client) => { println!("Client created"); app_handle - .emit_all("telemetry_connected", "connected") + .emit_all("telemetry_status", "connected") .expect("Failed to emit telemetry_status connected event"); break client; // Exit the loop if the client is successfully created } diff --git a/client/src-tauri/src/telemetry/mod.rs b/client/src-tauri/src/telemetry/mod.rs index f6c2d9d..206143e 100644 --- a/client/src-tauri/src/telemetry/mod.rs +++ b/client/src-tauri/src/telemetry/mod.rs @@ -28,7 +28,12 @@ pub async fn subscribe_topics( let client = create_client(&app_handle, &ntable_ip, &ntable_port).await; let mut subscription: Subscription = match create_subscription(&client).await { - Ok(subscription) => subscription, + Ok(subscription) => { + app_handle + .emit_all("telemetry_status", "connected") + .expect("Failed to emit telemetry_connected event"); + subscription + } Err(_) => { app_handle .emit_all("telemetry_status", "disconnected") @@ -40,11 +45,19 @@ pub async fn subscribe_topics( while let Some(mut message) = subscription.next().await { process_message(&mut message); - let json_message = to_string(&message).expect("Failed to serialize message"); + let json_message = match to_string(&message) { + Ok(json) => json, + Err(_) => continue, + }; + app_handle .emit_all("telemetry_data", json_message.clone()) .expect("Failed to send telemetry message"); + app_handle + .emit_all("telemetry_status", "connected") + .expect("Failed to emit telemetry_connected event"); + check_triggers( &app_handle, &message.topic_name, diff --git a/client/src/App.svelte b/client/src/App.svelte index 2bd309b..5e7ab7a 100644 --- a/client/src/App.svelte +++ b/client/src/App.svelte @@ -76,17 +76,9 @@ } .infotainment-container { - background: #2c3e50; /* fallback for old browsers */ - background: -webkit-linear-gradient( - to right, - #2c3e50, - #fd746c - ); /* Chrome 10-25, Safari 5.1-6 */ - background: linear-gradient( - to right, - #2c3e50, - #fd746c - ); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */ + background-image: url('./assets/wallpaper.jpg'); + background-repeat: no-repeat; + background-size: cover; /* hide scrollbar */ -ms-overflow-style: none; scrollbar-width: none; diff --git a/client/src/assets/wallpaper.jpg b/client/src/assets/wallpaper.jpg new file mode 100644 index 0000000..d8691f5 Binary files /dev/null and b/client/src/assets/wallpaper.jpg differ diff --git a/client/src/lib/Loading/Loading.svelte b/client/src/lib/Loading/Loading.svelte index 4b9f059..4c78fff 100644 --- a/client/src/lib/Loading/Loading.svelte +++ b/client/src/lib/Loading/Loading.svelte @@ -1,7 +1,7 @@
.bg { - background: #2c3e50; /* fallback for old browsers */ - background: -webkit-linear-gradient( - to right, - #2c3e50, - #fd746c - ); /* Chrome 10-25, Safari 5.1-6 */ - background: linear-gradient( - to right, - #2c3e50, - #fd746c - ); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */ + background-image: url('../../assets/wallpaper.jpg'); + background-repeat: no-repeat; + background-size: cover; }