From 373e61f0bd094c92d8bfe216e502b2536628b369 Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Thu, 15 Jan 2026 23:55:45 -0600 Subject: [PATCH] Fix offline mode toggle and add network verification - Change OfflinePlaceholder icon to use offline.svg instead of Power icon - Add flex-shrink protection to Toggle component to prevent collapsing - Add network verification when disabling offline mode: - Check network connectivity before switching to online - Show semi-transparent overlay during check - Revert to offline and show toast if no internet available - Add check_network Tauri command to verify connectivity - Add i18n strings for noNetworkToast and checkingNetwork (en/es) --- src-tauri/src/lib.rs | 1 + src-tauri/src/offline/mod.rs | 6 ++ src/lib/components/OfflinePlaceholder.svelte | 22 +++---- src/lib/components/Toggle.svelte | 2 + src/lib/components/views/SettingsView.svelte | 62 +++++++++++++++++++- src/lib/i18n/locales/en.json | 4 +- src/lib/i18n/locales/es.json | 4 +- src/lib/stores/offlineStore.ts | 12 ++++ 8 files changed, 95 insertions(+), 18 deletions(-) diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 86ffa9beb..ae39fc3c8 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -512,6 +512,7 @@ pub fn run() { offline::commands::get_offline_settings, offline::commands::set_manual_offline, offline::commands::set_show_partial_playlists, + offline::commands::check_network, // Offline playlist sync queue commands offline::commands::create_pending_playlist, offline::commands::get_pending_playlists, diff --git a/src-tauri/src/offline/mod.rs b/src-tauri/src/offline/mod.rs index 0923055f5..690de751d 100644 --- a/src-tauri/src/offline/mod.rs +++ b/src-tauri/src/offline/mod.rs @@ -488,6 +488,12 @@ pub mod commands { store.set_show_partial_playlists(enabled) } + /// Check if network connectivity is available + #[tauri::command] + pub async fn check_network() -> bool { + super::check_network_connectivity().await + } + // === Pending Playlist Sync Commands === /// Create a playlist while offline (queued for sync) diff --git a/src/lib/components/OfflinePlaceholder.svelte b/src/lib/components/OfflinePlaceholder.svelte index 640cc7a4a..432f9087f 100644 --- a/src/lib/components/OfflinePlaceholder.svelte +++ b/src/lib/components/OfflinePlaceholder.svelte @@ -1,5 +1,5 @@