From 8fd10d5b09b376facfc931bb605a602144bb7206 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Sun, 29 Nov 2026 00:06:27 +0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20grid=20view=20panels=20resi?= =?UTF-8?q?ze=20by=20dragging=20(streams=20|=20side,=20members=20/=20chat,?= =?UTF-8?q?=20with=20limits);=20drag=20the=20member=20list=20onto=20the=20?= =?UTF-8?q?chat=20to=20swap=20them?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/client/src/gui/chat.rs | 166 ++++++++++++++++++++++------------ 1 file changed, 107 insertions(+), 59 deletions(-) diff --git a/crates/client/src/gui/chat.rs b/crates/client/src/gui/chat.rs index af2e99c..54618a9 100644 --- a/crates/client/src/gui/chat.rs +++ b/crates/client/src/gui/chat.rs @@ -57,6 +57,7 @@ use gpui_kit::{ component::{ Icon, IndexPath, WindowExt, input::{InputEvent, InputState, Textarea, TextareaState}, + resizable::{h_resizable, resizable_panel, v_resizable}, searchable_list::SearchableVec, select::SelectState, slider::{SliderEvent, SliderState}, @@ -281,6 +282,7 @@ pub struct Chat { pub(super) camera_task: Option>, pub(super) stage: Stage, pub(super) grid_size: (f32, f32), + pub(super) chat_on_top: bool, pub(super) typing: HashMap>, pub(super) typing_sent: HashMap, } @@ -578,6 +580,7 @@ impl Chat { camera_task: None, stage: Stage::Strip, grid_size: (1280., 720.), + chat_on_top: false, composer: Composer::Compose { reply: None }, } } @@ -1418,71 +1421,17 @@ impl Yumush { let viewer = self.inline_viewer(entity, themed); let grid = viewer .is_none() - .then(|| self.stage_grid(entity, themed, cx)) + .then(|| { + self.stage_grid(entity, themed, cx) + .map(IntoElement::into_any_element) + }) .flatten(); - let side_chat = grid.is_some(); panel .child(self.header(entity, themed)) .children(self.stage_strip(entity, themed)) .children(self.unread_bar(entity, themed)) .children(self.poll_banner(entity, themed)) - .child( - div() - .flex_1() - .min_h_0() - .flex() - .child(div().flex_1().min_w_0().flex().flex_col().map( - |panel| { - match (viewer, grid) { - (Some(viewer), _) => panel.child(viewer), - (None, Some(grid)) => panel.child(grid), - (None, None) => panel - .child(self.message_area(entity, themed)) - .child(self.composer(entity, themed, cx)), - } - }, - )) - .children(members_column(entity, self, themed).map( - |members| { - div() - .w(px(if side_chat { - size::MARGIN_CHAT - } else { - size::MARGIN - })) - .flex_none() - .h_full() - .flex() - .flex_col() - .border_l_1() - .border_color(palette.border) - .child(if side_chat { - members - .flex_none() - .max_h(gpui_kit::relative(0.4)) - } else { - members.flex_1().min_h_0() - }) - .when(side_chat, |column| { - column.child( - div() - .flex_1() - .min_h_0() - .flex() - .flex_col() - .border_t_1() - .border_color(palette.border) - .child( - self.message_area(entity, themed), - ) - .child( - self.composer(entity, themed, cx), - ), - ) - }) - }, - )), - ) + .child(self.chat_body(entity, themed, viewer, grid, cx)) } None => panel.child(empty_state(palette)), }, @@ -1491,6 +1440,97 @@ impl Yumush { .children(self.dock(entity, palette, cx)) } + fn chat_body( + &self, + entity: &Entity, + palette: Palette, + viewer: Option
, + grid: Option, + cx: &App, + ) -> AnyElement { + let chat = || { + div() + .size_full() + .flex() + .flex_col() + .child(self.message_area(entity, palette)) + .child(self.composer(entity, palette, cx)) + }; + let members = members_column(entity, self, palette); + match (viewer, grid, members) { + (None, Some(grid), Some(members)) => h_resizable("stage_split") + .child( + resizable_panel() + .size_range(px(size::PAGE)..gpui_kit::Pixels::MAX) + .child(div().size_full().flex().flex_col().child(grid)), + ) + .child( + resizable_panel() + .size(px(size::MARGIN_CHAT)) + .size_range(px(size::MARGIN)..px(size::MARGIN * 2.)) + .fixed() + .child({ + let members = resizable_panel() + .size(px(size::THUMB * 2.)) + .size_range(px(size::ROW * 2.)..gpui_kit::Pixels::MAX) + .fixed() + .child( + members + .size_full() + .on_drag(SideSwap, |_, _, _, cx| cx.new(|_| SideSwap)), + ); + let swap = entity.clone(); + let hover = palette.tokens.hov(); + let chat = resizable_panel() + .size_range(px(size::THUMB * 2.)..gpui_kit::Pixels::MAX) + .child( + chat() + .drag_over::(move |style, _, _, _| { + style.bg(hover) + }) + .on_drop(move |_: &SideSwap, _, cx| { + swap.update(cx, |yumush, cx| { + yumush.chat.chat_on_top = !yumush.chat.chat_on_top; + cx.notify(); + }) + }), + ); + if self.chat.chat_on_top { + v_resizable("side_split_chat_top") + .child(chat) + .child(members) + } else { + v_resizable("side_split").child(members).child(chat) + } + }), + ) + .into_any_element(), + (viewer, grid, members) => div() + .flex_1() + .min_h_0() + .flex() + .child(div().flex_1().min_w_0().flex().flex_col().map(|panel| { + match (viewer, grid) { + (Some(viewer), _) => panel.child(viewer), + (None, Some(grid)) => panel.child(grid), + (None, None) => panel.child(chat()), + } + })) + .children(members.map(|members| { + div() + .w(px(size::MARGIN)) + .flex_none() + .h_full() + .flex() + .flex_col() + .border_l_1() + .border_color(palette.border) + .child(members.flex_1().min_h_0()) + })) + .into_any_element(), + } + } + fn stats_sheet(&self, palette: Palette) -> Option { let at = self .chat @@ -3743,3 +3783,11 @@ fn stage_button( }) .child(super::parts::small_icon(icon)) } + +struct SideSwap; + +impl gpui_kit::Render for SideSwap { + fn render(&mut self, _: &mut Window, _: &mut Context) -> impl IntoElement { + div() + } +}