Visible visual indicator of the active profile + click-to-swap dropdown.
Closes the last small UX gap pointed out in earlier sessions.
Tauri (crates/jarvis-gui/src/tauri_commands/profile.rs)
- profile_list() → Vec<String> of available profile names
- profile_active() → {name, description, icon, greeting}
- profile_set(name) → swaps active profile, returns new active
Frontend (frontend/src/components/Header.svelte)
- Polls profile_active every 5 seconds.
- Shows a coloured chip with icon+name when profile != "default"
(orange tint, attention-grabbing). For "default" — muted star chip.
- Click opens a dropdown listing all profile names; click one → swap.
- Dropdown closes on outside-click (shared handler with lang dropdown).
- SCSS styled to match existing aesthetic.
Build: cargo build --release -p jarvis-gui green (2m).
Now the user can see at a glance which profile is active (e.g. "💼 work")
without having to ask voice or open Settings.
38 lines
828 B
Rust
38 lines
828 B
Rust
//! Tauri commands for profile switching.
|
|
|
|
use serde::Serialize;
|
|
|
|
#[derive(Serialize)]
|
|
pub struct ProfileInfo {
|
|
pub name: String,
|
|
pub description: String,
|
|
pub icon: String,
|
|
pub greeting: String,
|
|
}
|
|
|
|
#[tauri::command]
|
|
pub fn profile_list() -> Vec<String> {
|
|
jarvis_core::profiles::list()
|
|
}
|
|
|
|
#[tauri::command]
|
|
pub fn profile_active() -> ProfileInfo {
|
|
let p = jarvis_core::profiles::active();
|
|
ProfileInfo {
|
|
name: p.name,
|
|
description: p.description,
|
|
icon: p.icon,
|
|
greeting: p.greeting,
|
|
}
|
|
}
|
|
|
|
#[tauri::command]
|
|
pub fn profile_set(name: String) -> Result<ProfileInfo, String> {
|
|
let p = jarvis_core::profiles::set_active(&name)?;
|
|
Ok(ProfileInfo {
|
|
name: p.name,
|
|
description: p.description,
|
|
icon: p.icon,
|
|
greeting: p.greeting,
|
|
})
|
|
}
|