mirror of
https://github.com/librekeys/picoforge.git
synced 2026-07-28 08:01:19 -07:00
refactor: rename GlobalDeviceState to DeviceConnectionState
This commit is contained in:
@@ -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<V: 'static> {
|
||||
active_view: ActiveView,
|
||||
width: Pixels,
|
||||
collapsed: bool,
|
||||
state: GlobalDeviceState,
|
||||
state: DeviceConnectionState,
|
||||
on_select: SelectHandler<V>,
|
||||
on_refresh: RefreshHandler<V>,
|
||||
}
|
||||
@@ -28,7 +28,7 @@ impl<V: 'static> AppSidebar<V> {
|
||||
active_view: ActiveView,
|
||||
width: Pixels,
|
||||
collapsed: bool,
|
||||
state: GlobalDeviceState,
|
||||
state: DeviceConnectionState,
|
||||
) -> Self {
|
||||
Self {
|
||||
active_view,
|
||||
|
||||
+3
-3
@@ -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,
|
||||
|
||||
+2
-2
@@ -12,13 +12,13 @@ pub enum ActiveView {
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct GlobalDeviceState {
|
||||
pub struct DeviceConnectionState {
|
||||
pub device_status: Option<FullDeviceStatus>,
|
||||
pub fido_info: Option<FidoDeviceInfo>,
|
||||
pub error: Option<String>,
|
||||
}
|
||||
|
||||
impl GlobalDeviceState {
|
||||
impl DeviceConnectionState {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
device_status: None,
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user