chore: improve message fetching

This commit is contained in:
2025-08-03 20:34:35 +07:00
parent c8c5a6668d
commit 493223276c
13 changed files with 231 additions and 117 deletions

View File

@@ -4,7 +4,7 @@ use gpui::prelude::FluentBuilder;
use gpui::{
actions, canvas, div, px, AnyElement, AnyView, App, AppContext, Axis, Bounds, Context, Edges,
Entity, EntityId, EventEmitter, Focusable, InteractiveElement as _, IntoElement,
ParentElement as _, Pixels, Render, Styled, Subscription, WeakEntity, Window,
ParentElement as _, Pixels, Render, SharedString, Styled, Subscription, WeakEntity, Window,
};
use crate::dock_area::dock::{Dock, DockPlacement};
@@ -195,6 +195,25 @@ impl DockItem {
}
}
/// Returns all panel ids
pub fn panel_ids(&self, cx: &App) -> Vec<SharedString> {
match self {
Self::Tabs { view, .. } => view.read(cx).panel_ids(cx),
Self::Split { items, .. } => {
let mut total = vec![];
for item in items.iter() {
if let DockItem::Tabs { view, .. } = item {
total.extend(view.read(cx).panel_ids(cx));
}
}
total
}
Self::Panel { .. } => vec![],
}
}
/// Returns the views of the dock item.
pub fn view(&self) -> Arc<dyn PanelView> {
match self {
@@ -252,6 +271,7 @@ impl DockItem {
}
}
/// Set the collapsed state of the dock area
pub fn set_collapsed(&self, collapsed: bool, window: &mut Window, cx: &mut App) {
match self {
DockItem::Tabs { view, .. } => {

View File

@@ -384,6 +384,11 @@ impl TabPanel {
})
}
/// Return all panel ids
pub fn panel_ids<'a>(&'a self, cx: &'a App) -> Vec<SharedString> {
self.panels.iter().map(|panel| panel.panel_id(cx)).collect()
}
/// Return true if the tab panel is draggable.
///
/// E.g. if the parent and self only have one panel, it is not draggable.