mirror of
https://github.com/librekeys/picoforge.git
synced 2026-07-28 08:01:19 -07:00
chore(ui): Improve logs view line spacing and set max terminal height
This commit is contained in:
@@ -46,6 +46,7 @@ fn main() {
|
||||
traffic_light_position: Some(gpui::point(px(12.0), px(12.0))),
|
||||
}),
|
||||
|
||||
// Render our own window decorations(shadows and resize attack area) for linux/bsd.
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
|
||||
window_background: gpui::WindowBackgroundAppearance::Transparent,
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// NOTE: This module is work in progress and more colors will be added. Also I am thinking of storing these as HSLA instead of u32 RGB values.
|
||||
// Reference: https://ui.shadcn.com/colors
|
||||
pub mod zinc {
|
||||
#![allow(unused)]
|
||||
pub const ZINC50: u32 = 0xfafafa;
|
||||
|
||||
+26
-14
@@ -102,21 +102,33 @@ impl Render for LogsView {
|
||||
.overflow_y_scrollbar()
|
||||
.flex_1()
|
||||
.h(px(500.0))
|
||||
.child(div().p_4().font_family("Mono").text_sm().child(
|
||||
v_flex().gap_0().children(self.logs.iter().map(|log| {
|
||||
let color = if log.contains("ERROR") {
|
||||
gpui::red()
|
||||
} else if log.contains("WARN") {
|
||||
gpui::yellow()
|
||||
} else if log.contains("INFO") {
|
||||
gpui::green()
|
||||
} else {
|
||||
theme.foreground
|
||||
};
|
||||
.child(
|
||||
div()
|
||||
.overflow_y_scrollbar()
|
||||
.max_h(px(500.0))
|
||||
.p_4()
|
||||
.font_family("Mono")
|
||||
.text_sm()
|
||||
.child(v_flex().gap_neg_4().children(
|
||||
self.logs.iter().map(|log| {
|
||||
// TODO: Convert these values to constants in colors.rs
|
||||
let color = if log.contains("ERROR") {
|
||||
rgb(0xef4444)
|
||||
} else if log.contains("WARN") {
|
||||
rgb(0xfde047)
|
||||
} else if log.contains("INFO") {
|
||||
rgb(0x4ade80)
|
||||
} else {
|
||||
theme.foreground.to_rgb()
|
||||
};
|
||||
|
||||
div().text_color(color).child(log.clone())
|
||||
})),
|
||||
))
|
||||
div()
|
||||
.text_color(color)
|
||||
.child(log.clone())
|
||||
.cursor_text()
|
||||
}),
|
||||
)),
|
||||
)
|
||||
.into_any_element()
|
||||
}),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user