From 8b9990837cadbe1feb717d5f3d5d9907dbff38bc 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 03:19:17 +0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20pen=20next=20to=20your=20st?= =?UTF-8?q?atus=20in=20the=20profile=20card=20edits=20it=20in=20place=20(u?= =?UTF-8?q?nderlined=20input,=20Enter=20saves)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/client/src/gui/chat.rs | 1 + crates/client/src/gui/profile.rs | 86 ++++++++++++++++++++++++-- crates/client/src/gui/settings_page.rs | 2 + 3 files changed, 83 insertions(+), 6 deletions(-) diff --git a/crates/client/src/gui/chat.rs b/crates/client/src/gui/chat.rs index 0ff541d..33fed31 100644 --- a/crates/client/src/gui/chat.rs +++ b/crates/client/src/gui/chat.rs @@ -127,6 +127,7 @@ pub enum CardMenu { More, Accounts, Presence, + Status, } pub struct Chat { diff --git a/crates/client/src/gui/profile.rs b/crates/client/src/gui/profile.rs index a8ba6e1..f3e14ae 100644 --- a/crates/client/src/gui/profile.rs +++ b/crates/client/src/gui/profile.rs @@ -1,4 +1,5 @@ use common::model::Id; +use gpui_kit::prelude::FluentBuilder as _; use std::collections::VecDeque; use std::{collections::HashMap, sync::Arc}; @@ -28,8 +29,8 @@ use super::social::Relation; use super::style::{radius, size, space, stroke, text}; use super::widget::spawn_done; use super::{ - DAY_YEAR, Palette, Trigger, Yumush, avatar, clickable, entity_action, input_dialog, - millis_time, notify_error, palette, presence_color, rank_tag, text, + DAY_YEAR, Palette, Tooltip as _, Trigger, Yumush, avatar, clickable, entity_action, + input_dialog, millis_time, notify_error, palette, presence_color, rank_tag, text, }; const ACCOUNTS_MAX_H: f32 = 180.; @@ -105,6 +106,7 @@ pub(super) fn profile_popover( confirming: yumush.chat.pending_user_delete == Some(user.id), reporting: yumush.chat.report == Some(ReportTarget::User(user.id)), reason: yumush.chat.report_reason.clone(), + status: yumush.chat.status_input.clone(), others: yumush .accounts .others() @@ -146,6 +148,7 @@ struct Card { confirming: bool, reporting: bool, reason: Entity, + status: Entity, others: Vec<(Id, String)>, volume: Option<(Entity, f32)>, } @@ -308,6 +311,7 @@ impl Card { ) .child( stack(space::XXS) + .flex_1() .min_w_0() .child( band(space::SM) @@ -322,9 +326,52 @@ impl Card { ) .children(rank_tag(self.target, palette)), ) - .children((!self.user.status.is_empty()).then(|| { - words(self.user.status.clone(), Text::Caption, Ink::Dim, t) - })), + .map(|names| { + if !is_self { + return names.children((!self.user.status.is_empty()).then( + || { + words( + self.user.status.clone(), + Text::Caption, + Ink::Dim, + t, + ) + }, + )); + } + if self.card_menu == CardMenu::Status { + return names.child( + div() + .border_b(px(stroke::LINE)) + .border_color(t.paper()) + .child( + super::widget::bare_input( + palette, + gpui_kit::component::input::Input::new( + &self.status, + ), + ) + .text_size(text(text::CAPTION)) + .px_0() + .w_full(), + ), + ); + } + names.child( + band(space::XS) + .children((!self.user.status.is_empty()).then(|| { + words( + self.user.status.clone(), + Text::Caption, + Ink::Dim, + t, + ) + .min_w_0() + .truncate() + })) + .child(edit_status(entity, &self.user.status, palette)), + ) + }), ), ) .children(self.call.is_some().then(|| { @@ -469,7 +516,9 @@ fn self_rows( palette: Palette, ) -> Vec { match card_menu { - CardMenu::Main | CardMenu::More => main_self_rows(presence, entity, popover, palette), + CardMenu::Main | CardMenu::More | CardMenu::Status => { + main_self_rows(presence, entity, popover, palette) + } CardMenu::Accounts => accounts_rows(others, entity, popover, palette), CardMenu::Presence => presence_rows(entity, palette), } @@ -604,6 +653,31 @@ fn presence_rows(entity: &Entity, palette: Palette) -> Vec { rows } +fn edit_status(entity: &Entity, status: &str, palette: Palette) -> impl IntoElement { + let status = status.to_string(); + clickable( + "edit_status", + palette, + entity_action(entity, move |yumush, window, cx| { + yumush.chat.card_menu = CardMenu::Status; + yumush.chat.status_input.update(cx, |input, cx| { + input.set_value(status.clone(), window, cx); + input.focus(window, cx); + }); + cx.notify(); + }), + ) + .tip("Edit status") + .flex_none() + .p(px(space::XXS)) + .rounded(px(radius::SM)) + .child( + Icon::new(IconName::Pencil) + .size(px(size::ICON_SM)) + .text_color(palette.tokens.faint()), + ) +} + fn card_menu_action( entity: &Entity, menu: CardMenu, diff --git a/crates/client/src/gui/settings_page.rs b/crates/client/src/gui/settings_page.rs index 3996d99..4d472e4 100644 --- a/crates/client/src/gui/settings_page.rs +++ b/crates/client/src/gui/settings_page.rs @@ -249,6 +249,8 @@ impl Yumush { pub(super) fn save_status(&mut self, window: &mut Window, cx: &mut Context) { let status = self.chat.status_input.read(cx).text().to_string(); let network = self.network.clone(); + self.chat.card_menu = super::chat::CardMenu::Main; + cx.notify(); cx.spawn_in(window, async move |this, cx| { let result = network.call(UpdateStatus { status }).await;