feat: implement/migrate about page in gpui

This commit is contained in:
Suyog Tandel
2026-01-29 11:45:24 +05:30
parent 3226e35cd3
commit 7e58d58d55
6 changed files with 147 additions and 16 deletions
-6
View File
@@ -1,6 +0,0 @@
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
fn main() {
picoforge_lib::run()
}
+3
View File
@@ -1,3 +1,6 @@
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
use gpui::*;
use gpui_component::Root;
use gpui_component::{Theme, ThemeMode};
-6
View File
@@ -68,12 +68,10 @@ impl<V: 'static> AppSidebar<V> {
pub fn render(self, cx: &mut Context<V>) -> impl IntoElement {
let width = self.width;
let collapsed = self.collapsed;
// active_view was unused
let device_status = self.device_status.clone();
let device_error = self.device_error.clone();
let border_color = cx.theme().sidebar_border;
// bg_color was unused
let muted_foreground = cx.theme().muted_foreground;
v_flex()
@@ -97,15 +95,11 @@ impl<V: 'static> AppSidebar<V> {
let header = header.justify_start().pl(padding_left);
// Icon Animation: Stays 48px until width drops below 120px, then shrinks to 32px
// Range: [48px ... 120px] -> [32px ... 48px]
let width_icon_start = px(120.);
let t_icon =
((current_width - px(48.)) / (width_icon_start - px(48.))).clamp(0.0, 1.0);
let icon_size = px(32.) + (px(48.) - px(32.)) * t_icon;
// Text Animation: Fades out first, before icon starts shrinking
// Range: [200px ... 255px] -> [0.0 ... 1.0]
let width_text_start = px(200.);
let text_opacity: f32 = if current_width > width_text_start {
((current_width - width_text_start) / (px(255.) - width_text_start))
+3 -1
View File
@@ -125,7 +125,9 @@ impl Render for ApplicationRoot {
SecurityView::build().into_any_element()
}
ActiveView::Logs => LogsView::build().into_any_element(),
ActiveView::About => AboutView::build().into_any_element(),
ActiveView::About => {
AboutView::build(cx.theme()).into_any_element()
}
}),
),
),
+140 -2
View File
@@ -1,10 +1,148 @@
// src/views/about.rs
use gpui::*;
use gpui_component::{Icon, StyledExt, Theme, badge::Badge, button::Button, h_flex, v_flex};
pub struct AboutView;
impl AboutView {
pub fn build() -> impl IntoElement {
div().size_full().p_8().child("About goes here...")
pub fn build(theme: &Theme) -> impl IntoElement {
div()
.size_full()
.bg(theme.background)
.flex()
.flex_col()
.items_center()
.child(
div().w_full().max_w(px(1200.0)).px_10().py_5().child(
v_flex()
.gap_8()
.child(
v_flex()
.child(
div()
.text_3xl()
.font_extrabold()
.text_color(theme.foreground)
.child("About"),
)
.child(
div().text_sm().text_color(theme.muted_foreground).child(
"Information about the application and its development.",
),
),
)
.child(
div()
.w_full()
.flex()
.justify_center()
.child(
div()
.max_w(px(1200.0))
.w_full()
.bg(rgb(0x18181b))
.border_1()
.border_color(theme.border)
.rounded_xl()
.p_6()
.child(
v_flex()
.items_center()
.justify_center()
.gap_4()
.py_8()
.text_center()
.child(
img("appIcons/in.suyogtandel.picoforge.svg")
.w(px(256.0))
.h(px(256.0))
)
.child(
div()
.text_2xl()
.font_bold()
.text_color(theme.foreground)
.child("PicoForge"),
)
.child(
Badge::new()
.child("v0.4.0")
.color(theme.secondary),
)
.child(
div()
.text_color(theme.muted_foreground)
.max_w(px(450.0))
.child(
"An open source commissioning tool for Pico FIDO security keys. Developed with Rust and GPUI.",
),
)
.child(
div()
.text_sm()
.text_color(theme.muted_foreground)
.gap_1()
.pt_4()
.border_t_1()
.border_color(theme.border)
.border_t_1()
.border_color(theme.border)
.w(px(320.0))
.child(
h_flex()
.justify_between()
.child("Code By:")
.child(
div()
.font_medium()
.text_color(theme.foreground)
.child("Suyog Tandel"),
),
)
.child(
h_flex()
.justify_between()
.items_center()
.pt_2()
.mt_2()
.child(
h_flex()
.items_center()
.gap_1()
.child("Copyright:"),
)
.child(
div()
.font_medium()
.text_color(theme.foreground)
.child("© 2026 Suyog Tandel"),
),
),
)
.child(
h_flex()
.gap_4()
.pt_6()
.child(
Button::new("github_btn")
.outline()
.child(
h_flex()
.gap_2()
.child(
Icon::default().path("icons/github.svg").size_4()
)
.child("GitHub")
)
.on_click(|_, _, cx| {
cx.open_url("https://github.com/librekeys/picoforge")
}),
),
),
),
),
),
),
)
}
}
+1 -1
View File
@@ -90,7 +90,7 @@ impl HomeView {
.flex_col()
.items_center()
.child(
div().w_full().max_w(px(1400.0)).px_10().py_5().child(
div().w_full().max_w(px(1200.0)).px_10().py_5().child(
v_flex()
.gap_8()
.child(