From 9aac13c8b506fb9351ffbe98c322529d1077cc42 Mon Sep 17 00:00:00 2001 From: Suyog Tandel Date: Sun, 8 Feb 2026 16:43:09 +0530 Subject: [PATCH] fix(ui): inconsistencies in cards --- .cargo/config.toml | 2 ++ Cargo.toml | 3 --- src/logging.rs | 1 + src/main.rs | 4 ++-- src/ui/components/button.rs | 2 +- src/ui/components/sidebar.rs | 1 + src/ui/rootview.rs | 9 ++++++--- src/ui/views/config.rs | 7 +++++-- src/ui/views/home.rs | 14 ++++++++++---- src/ui/views/logs.rs | 15 +++++++-------- src/ui/views/passkeys.rs | 22 +++++++++++++++++++++- 11 files changed, 56 insertions(+), 24 deletions(-) create mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..e565974 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +[alias] +run-watch = "watch -c -x check -x run" \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 85fd529..43e0a4e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,6 +43,3 @@ lto = true # Enables link-time-optimizations however is not stable. opt-level = 3 # Prioritizes speed. Use `z` if you prefer small binary size. panic = "abort" # Higher performance by disabling panic handlers. strip = true # Ensures debug symbols are removed. - -[alias] -run-watch = "watch -c -x check -x run" diff --git a/src/logging.rs b/src/logging.rs index 7586cf1..dd85049 100644 --- a/src/logging.rs +++ b/src/logging.rs @@ -127,6 +127,7 @@ pub fn logger_init() { .logger( Logger::builder() .appenders(["stdout", "logfile", "buffer"]) + .additive(false) .build("picoforge", app_level), ) .logger(Logger::builder().build("gpui", LevelFilter::Error)) diff --git a/src/main.rs b/src/main.rs index f25424c..3e12f68 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,9 +11,9 @@ pub mod logging; mod ui; // NOTE: Hey this is me lockedmutex, right now the code quality of the entire ui module is shit okay, and this is because -// AI has been used to convert most of the frontend code from svelte+typescript to GPUI, while it has done most of the conversion +// AI has been used to convert most of the frontend code from svelte+typescript to GPUI, while it has done most of the conversion, // due to lack in complete context of code and the way it is structured, it has done a shit job. I did make a lot of changes to -// the code by myself so it is not complete AI slop. Right now I am trading development time with code quality, I will later +// the code by myself, so it is not complete AI slop. Right now I am trading development time with code quality, I will later // improve the code quality and correctly categorize the code into individial components. fn main() { logging::logger_init(); diff --git a/src/ui/components/button.rs b/src/ui/components/button.rs index d8d3175..7a5e4ae 100644 --- a/src/ui/components/button.rs +++ b/src/ui/components/button.rs @@ -241,7 +241,7 @@ impl RenderOnce for PFIconButton { .active(self.bg_color_active.into()) .border(cx.theme().border), ) - .border_t_1(); + .border_t_2(); if self.width_full { btn = btn.w_full(); diff --git a/src/ui/components/sidebar.rs b/src/ui/components/sidebar.rs index 025f9d3..63aab00 100644 --- a/src/ui/components/sidebar.rs +++ b/src/ui/components/sidebar.rs @@ -173,6 +173,7 @@ impl AppSidebar { .w_full() .bg(rgb(0x111113)) .border_r_1() + .border_t_1() .border_color(border_color) .p_2() .gap_3() diff --git a/src/ui/rootview.rs b/src/ui/rootview.rs index fef01b4..0a7dcd6 100644 --- a/src/ui/rootview.rs +++ b/src/ui/rootview.rs @@ -155,9 +155,12 @@ impl Render for ApplicationRoot { .flex_grow() .bg(cx.theme().background) .child(match self.active_view { - ActiveView::Home => { - HomeView::build(&self.state, cx.theme()).into_any_element() - } + ActiveView::Home => HomeView::build( + &self.state, + cx.theme(), + window.bounds().size.width, + ) + .into_any_element(), ActiveView::Passkeys => { let view = self.passkeys_view.get_or_insert_with(|| { let view = cx.new(|cx| { diff --git a/src/ui/views/config.rs b/src/ui/views/config.rs index 0206a5d..282a76e 100644 --- a/src/ui/views/config.rs +++ b/src/ui/views/config.rs @@ -627,7 +627,7 @@ impl ConfigView { } impl Render for ConfigView { - fn render(&mut self, _window: &mut Window, cx: &mut Context) -> impl IntoElement { + fn render(&mut self, window: &mut Window, cx: &mut Context) -> impl IntoElement { let theme = cx.theme(); if self.device_status.is_none() { return PageView::build( @@ -655,6 +655,9 @@ impl Render for ConfigView { let identity_card = self.render_identity_card(theme).into_any_element(); let touch_card = self.render_touch_card(theme).into_any_element(); + let is_wide = window.bounds().size.width > px(1100.0); + let columns = if is_wide { 2 } else { 1 }; + PageView::build( "Configuration", "Customize device settings and behavior.", @@ -663,7 +666,7 @@ impl Render for ConfigView { .child( div() .grid() - .grid_cols(2) + .grid_cols(columns) .gap_6() .child(identity_card) .child(led_card) diff --git a/src/ui/views/home.rs b/src/ui/views/home.rs index 3fc0cd5..bbd2975 100644 --- a/src/ui/views/home.rs +++ b/src/ui/views/home.rs @@ -8,8 +8,14 @@ use gpui_component::{Icon, IconName, Theme, badge::Badge, h_flex, progress::Prog pub struct HomeView; impl HomeView { - pub fn build(state: &GlobalDeviceState, theme: &Theme) -> impl IntoElement { + pub fn build( + state: &GlobalDeviceState, + theme: &Theme, + window_width: Pixels, + ) -> impl IntoElement { let connected = state.device_status.is_some(); + let is_wide = window_width > px(1100.0); + let columns = if is_wide { 2 } else { 1 }; PageView::build( "Device Overview", @@ -31,10 +37,10 @@ impl HomeView { ) .into_any_element() } else { - // 4 Card Grid + // Card Grid div() .grid() - .grid_cols(2) + .grid_cols(columns) .gap_6() .child(Self::render_device_info(state, theme)) .child(Self::render_fido_info(state, theme)) @@ -107,7 +113,7 @@ impl HomeView { )) .child(Self::render_kv( "VID:PID", - format!("{}, {}", config.vid, config.pid), + format!("{}:{}", config.vid, config.pid), theme, true, )) diff --git a/src/ui/views/logs.rs b/src/ui/views/logs.rs index bcc6c94..ac29765 100644 --- a/src/ui/views/logs.rs +++ b/src/ui/views/logs.rs @@ -70,13 +70,6 @@ impl Render for LogsView { v_flex() .gap_4() .h_full() - .child( - h_flex().justify_end().child( - Button::new("clear_logs") - .label("Clear Logs") - .on_click(clear_listener), - ), - ) .child( div() .flex_1() @@ -111,7 +104,6 @@ impl Render for LogsView { .h(px(500.0)) .child(div().p_4().font_family("Mono").text_sm().child( v_flex().gap_1().children(self.logs.iter().map(|log| { - // Simple heuristic for color let color = if log.contains("ERROR") { gpui::red() } else if log.contains("WARN") { @@ -125,6 +117,13 @@ impl Render for LogsView { )) .into_any_element() }), + ) + .child( + h_flex().justify_end().child( + Button::new("clear_logs") + .label("Clear Logs") + .on_click(clear_listener), + ), ), theme, ) diff --git a/src/ui/views/passkeys.rs b/src/ui/views/passkeys.rs index 7b3fdd4..04b4f21 100644 --- a/src/ui/views/passkeys.rs +++ b/src/ui/views/passkeys.rs @@ -889,6 +889,8 @@ impl PasskeysView { h_flex() .gap_3() .items_center() + .flex_1() + .min_w_0() .child( div() .size_10() @@ -906,11 +908,29 @@ impl PasskeysView { ) .child( v_flex() - .child(div().font_semibold().child(cred.rp_name.clone())) + .min_w_0() + .overflow_hidden() + .child( + div() + .font_semibold() + .whitespace_nowrap() + .overflow_hidden() + .text_ellipsis() + .child(if !cred.rp_name.is_empty() { + cred.rp_name.clone() + } else if !cred.rp_id.is_empty() { + cred.rp_id.clone() + } else { + "Unknown Service".to_string() + }), + ) .child( div() .text_sm() .text_color(theme.muted_foreground) + .whitespace_nowrap() + .overflow_hidden() + .text_ellipsis() .child(cred.user_name.clone()), ), ),