From 05309cdb692ffdf629ba8deda2edef883c84dd29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Sat, 28 Nov 2026 21:06:21 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84=20style:=20login=20server=20toggle?= =?UTF-8?q?=20shows=20only=20the=20host;=20chevron=20turns=20and=20server?= =?UTF-8?q?=20fields=20slide=20in?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/client/src/gui/auth.rs | 37 +++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/crates/client/src/gui/auth.rs b/crates/client/src/gui/auth.rs index 3202acc..7d63ebd 100644 --- a/crates/client/src/gui/auth.rs +++ b/crates/client/src/gui/auth.rs @@ -1,6 +1,6 @@ use gpui_kit::prelude::FluentBuilder as _; use gpui_kit::{ - AnyElement, Context, Div, Entity, FontWeight, IntoElement, ParentElement, + AnimationExt as _, AnyElement, Context, Div, Entity, FontWeight, IntoElement, ParentElement, StatefulInteractiveElement, Styled, Window, assets::IconName, component::{ @@ -144,17 +144,30 @@ fn server_toggle( .gap(px(space::XS)) .text_size(text(text::CAPTION)) .text_color(palette.muted) - .child(address.to_string()) + .child(host(address).to_string()) .child( - Icon::new(if open { - IconName::ChevronDown - } else { - IconName::ChevronRight - }) - .size(px(size::ICON_SM)), + Icon::new(IconName::ChevronRight) + .size(px(size::ICON_SM)) + .with_animation( + ("server_chevron", open as u64), + super::parts::motion(), + move |icon, delta| { + let turn = if open { delta } else { 1. - delta }; + icon.rotate(gpui_kit::radians(std::f32::consts::FRAC_PI_2 * turn)) + }, + ), ) } +fn host(address: &str) -> &str { + match address.rsplit_once(':') { + Some((host, port)) if port.chars().all(|c| c.is_ascii_digit()) => { + host.trim_start_matches('[').trim_end_matches(']') + } + _ => address, + } +} + fn password_field(palette: Palette, input: &Entity) -> Div { frame(palette, Input::new(input).mask_toggle()) } @@ -237,6 +250,7 @@ impl Yumush { )) .child( div() + .relative() .when(!self.auth.server_open, |this| this.invisible()) .flex() .flex_col() @@ -265,6 +279,13 @@ impl Yumush { } }, )), + ) + .with_animation( + ("server_fields", self.auth.server_open as u64), + super::parts::motion(), + |fields, delta| { + fields.opacity(delta).top(px(space::SM * (delta - 1.))) + }, ), ), )