diff --git a/nym-vpn/ui/index.html b/nym-vpn/ui/index.html index eaeca159bd..a548f6417f 100644 --- a/nym-vpn/ui/index.html +++ b/nym-vpn/ui/index.html @@ -1,5 +1,5 @@ - + diff --git a/nym-vpn/ui/src-tauri/src/commands/app_data.rs b/nym-vpn/ui/src-tauri/src/commands/app_data.rs index 901726d2f4..539b3f413f 100644 --- a/nym-vpn/ui/src-tauri/src/commands/app_data.rs +++ b/nym-vpn/ui/src-tauri/src/commands/app_data.rs @@ -78,6 +78,28 @@ pub async fn set_ui_theme( Ok(()) } +#[instrument(skip(data_state))] +#[tauri::command] +pub async fn set_root_font_size( + data_state: State<'_, SharedAppData>, + size: u32, +) -> Result<(), CmdError> { + debug!("set_root_font_size"); + + let mut app_data_store = data_state.lock().await; + let mut app_data = app_data_store + .read() + .await + .map_err(|e| CmdError::new(CmdErrorSource::InternalError, e.to_string()))?; + app_data.ui_root_font_size = Some(size); + app_data_store.data = app_data; + app_data_store + .write() + .await + .map_err(|e| CmdError::new(CmdErrorSource::InternalError, e.to_string()))?; + Ok(()) +} + #[instrument(skip(data_state))] #[tauri::command] pub async fn set_entry_location_selector( diff --git a/nym-vpn/ui/src-tauri/src/fs/data.rs b/nym-vpn/ui/src-tauri/src/fs/data.rs index e6b3952316..797009af2a 100644 --- a/nym-vpn/ui/src-tauri/src/fs/data.rs +++ b/nym-vpn/ui/src-tauri/src/fs/data.rs @@ -19,6 +19,7 @@ pub struct AppData { pub killswitch: Option, pub entry_location_selector: Option, pub ui_theme: Option, + pub ui_root_font_size: Option, pub vpn_mode: Option, pub entry_node: Option, pub exit_node: Option, diff --git a/nym-vpn/ui/src-tauri/src/main.rs b/nym-vpn/ui/src-tauri/src/main.rs index 34798e19b5..6cdc3815ab 100644 --- a/nym-vpn/ui/src-tauri/src/main.rs +++ b/nym-vpn/ui/src-tauri/src/main.rs @@ -109,6 +109,7 @@ async fn main() -> Result<()> { app_data::set_ui_theme, app_data::set_entry_location_selector, app_data::get_node_countries, + app_data::set_root_font_size, node_location::set_node_location, node_location::get_default_node_location, ]) diff --git a/nym-vpn/ui/src/constants.ts b/nym-vpn/ui/src/constants.ts index 026e015917..ee33ed2fcd 100644 --- a/nym-vpn/ui/src/constants.ts +++ b/nym-vpn/ui/src/constants.ts @@ -9,3 +9,5 @@ export const AppName = 'NymVPN'; export const ConnectionEvent = 'connection-state'; export const ProgressEvent = 'connection-progress'; export const QuickConnectPrefix = 'Fastest'; +// TODO ⚠ keep this value in sync with the one declared in `index.html` +export const DefaultRootFontSize = 12; // in px diff --git a/nym-vpn/ui/src/dev/setup.ts b/nym-vpn/ui/src/dev/setup.ts index f07e3b8f18..7bedb656a7 100644 --- a/nym-vpn/ui/src/dev/setup.ts +++ b/nym-vpn/ui/src/dev/setup.ts @@ -65,6 +65,10 @@ export function mockTauriIPC() { ); } + if (cmd === 'set_root_font_size') { + return new Promise((resolve) => resolve()); + } + if (cmd === 'get_app_data') { return new Promise((resolve) => resolve({ @@ -73,6 +77,7 @@ export function mockTauriIPC() { killswitch: false, entry_location_selector: false, ui_theme: 'Dark', + ui_root_font_size: 12, vpn_mode: 'TwoHop', entry_node: { country: { diff --git a/nym-vpn/ui/src/pages/home/Home.tsx b/nym-vpn/ui/src/pages/home/Home.tsx index 7987c52066..ef6d8ede54 100644 --- a/nym-vpn/ui/src/pages/home/Home.tsx +++ b/nym-vpn/ui/src/pages/home/Home.tsx @@ -90,7 +90,9 @@ function Home() {