diff --git a/src/ui/components/sidebar.rs b/src/ui/components/sidebar.rs index 35caaca..5e3f05d 100644 --- a/src/ui/components/sidebar.rs +++ b/src/ui/components/sidebar.rs @@ -1,6 +1,6 @@ use crate::device::types::DeviceMethod; use crate::ui::components::button::PFIconButton; -use crate::ui::types::{ActiveView, GlobalDeviceState}; +use crate::ui::types::{ActiveView, DeviceConnectionState}; use gpui::*; use gpui_component::{ ActiveTheme, Icon, IconName, Side, @@ -18,7 +18,7 @@ pub struct AppSidebar { active_view: ActiveView, width: Pixels, collapsed: bool, - state: GlobalDeviceState, + state: DeviceConnectionState, on_select: SelectHandler, on_refresh: RefreshHandler, } @@ -28,7 +28,7 @@ impl AppSidebar { active_view: ActiveView, width: Pixels, collapsed: bool, - state: GlobalDeviceState, + state: DeviceConnectionState, ) -> Self { Self { active_view, diff --git a/src/ui/rootview.rs b/src/ui/rootview.rs index 498ad1a..1783208 100644 --- a/src/ui/rootview.rs +++ b/src/ui/rootview.rs @@ -1,6 +1,6 @@ use crate::device::io; use crate::ui::components::sidebar::AppSidebar; -use crate::ui::types::{ActiveView, GlobalDeviceState}; +use crate::ui::types::{ActiveView, DeviceConnectionState}; use crate::ui::views::{ about::AboutView, config::ConfigView, home::HomeView, passkeys::PasskeysEvent, passkeys::PasskeysView, security::SecurityView, @@ -19,7 +19,7 @@ pub struct ApplicationRoot { active_view: ActiveView, is_sidebar_collapsed: bool, sidebar_toggle_hovered: bool, - state: GlobalDeviceState, + state: DeviceConnectionState, device_loading: bool, // Umm, why did my past self do this? This does not belong here. sidebar_width: Pixels, @@ -34,7 +34,7 @@ impl ApplicationRoot { active_view: ActiveView::Home, is_sidebar_collapsed: false, sidebar_toggle_hovered: false, - state: GlobalDeviceState::new(), + state: DeviceConnectionState::new(), device_loading: false, sidebar_width: px(255.), config_view: None, diff --git a/src/ui/types.rs b/src/ui/types.rs index f69df55..42a473a 100644 --- a/src/ui/types.rs +++ b/src/ui/types.rs @@ -12,13 +12,13 @@ pub enum ActiveView { } #[derive(Clone, Debug, PartialEq)] -pub struct GlobalDeviceState { +pub struct DeviceConnectionState { pub device_status: Option, pub fido_info: Option, pub error: Option, } -impl GlobalDeviceState { +impl DeviceConnectionState { pub fn new() -> Self { Self { device_status: None, diff --git a/src/ui/views/home.rs b/src/ui/views/home.rs index 513a87a..1a14848 100644 --- a/src/ui/views/home.rs +++ b/src/ui/views/home.rs @@ -1,6 +1,6 @@ use crate::device::types::DeviceMethod; use crate::ui::components::{card::Card, page_view::PageView, tag::Tag}; -use crate::ui::types::GlobalDeviceState; +use crate::ui::types::DeviceConnectionState; use gpui::prelude::FluentBuilder; use gpui::*; use gpui_component::StyledExt; @@ -10,7 +10,7 @@ pub struct HomeView; impl HomeView { pub fn build( - state: &GlobalDeviceState, + state: &DeviceConnectionState, theme: &Theme, window_width: Pixels, ) -> impl IntoElement { @@ -82,7 +82,7 @@ impl HomeView { ) } - fn render_device_info(state: &GlobalDeviceState, theme: &Theme) -> impl IntoElement { + fn render_device_info(state: &DeviceConnectionState, theme: &Theme) -> impl IntoElement { let status = state.device_status.as_ref().unwrap(); let info = &status.info; let config = &status.config; @@ -159,7 +159,7 @@ impl HomeView { ) } - fn render_fido_info(state: &GlobalDeviceState, theme: &Theme) -> impl IntoElement { + fn render_fido_info(state: &DeviceConnectionState, theme: &Theme) -> impl IntoElement { Card::new() .title("FIDO2 Information") .icon(Icon::default().path("icons/shield.svg")) @@ -277,7 +277,7 @@ impl HomeView { }) } - fn render_led_config(state: &GlobalDeviceState, theme: &Theme) -> impl IntoElement { + fn render_led_config(state: &DeviceConnectionState, theme: &Theme) -> impl IntoElement { let status = state.device_status.as_ref().unwrap(); let config = &status.config; Card::new() @@ -365,7 +365,7 @@ impl HomeView { }) } - fn render_security_status(state: &GlobalDeviceState, theme: &Theme) -> impl IntoElement { + fn render_security_status(state: &DeviceConnectionState, theme: &Theme) -> impl IntoElement { let status = state.device_status.as_ref().unwrap(); Card::new() .title("Security Status")