fix(ui): inconsistencies in cards

This commit is contained in:
Suyog Tandel
2026-02-08 16:43:09 +05:30
parent 1814a36c23
commit 9aac13c8b5
11 changed files with 56 additions and 24 deletions
+2
View File
@@ -0,0 +1,2 @@
[alias]
run-watch = "watch -c -x check -x run"
-3
View File
@@ -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"
+1
View File
@@ -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))
+2 -2
View File
@@ -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();
+1 -1
View File
@@ -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();
+1
View File
@@ -173,6 +173,7 @@ impl<V: 'static> AppSidebar<V> {
.w_full()
.bg(rgb(0x111113))
.border_r_1()
.border_t_1()
.border_color(border_color)
.p_2()
.gap_3()
+6 -3
View File
@@ -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| {
+5 -2
View File
@@ -627,7 +627,7 @@ impl ConfigView {
}
impl Render for ConfigView {
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> 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)
+10 -4
View File
@@ -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,
))
+7 -8
View File
@@ -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,
)
+21 -1
View File
@@ -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()),
),
),