chat panel ++ (#4044)

- Update chat panel with current channel
- Open chat panel for guests
- Open chat when joining a channel with guests
- Some tweaks for chat panels
- Don't lose focus on default panel state
- Make chat prettier (to my eyes at least)
- Fix multiple mentions in one message
- Show a border when scrolled in chat
- Fix re-docking chat panel
- Move settings subscription to dock

[[PR Description]]

Release Notes:

- Opens chat by default when joining a public channel
- Improves chat panel UI
This commit is contained in:
Conrad Irwin 2024-01-14 13:54:10 -07:00 committed by GitHub
commit 29ce109211
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 273 additions and 254 deletions

View file

@ -7,6 +7,7 @@ use gpui::{
};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use settings::SettingsStore;
use std::sync::Arc;
use ui::{h_stack, ContextMenu, IconButton, Tooltip};
use ui::{prelude::*, right_click_menu};
@ -14,7 +15,6 @@ use ui::{prelude::*, right_click_menu};
const RESIZE_HANDLE_SIZE: Pixels = Pixels(6.);
pub enum PanelEvent {
ChangePosition,
ZoomIn,
ZoomOut,
Activate,
@ -177,7 +177,7 @@ impl DockPosition {
struct PanelEntry {
panel: Arc<dyn PanelHandle>,
_subscriptions: [Subscription; 2],
_subscriptions: [Subscription; 3],
}
pub struct PanelButtons {
@ -321,9 +321,15 @@ impl Dock {
) {
let subscriptions = [
cx.observe(&panel, |_, _, cx| cx.notify()),
cx.subscribe(&panel, move |this, panel, event, cx| match event {
PanelEvent::ChangePosition => {
cx.observe_global::<SettingsStore>({
let workspace = workspace.clone();
let panel = panel.clone();
move |this, cx| {
let new_position = panel.read(cx).position(cx);
if new_position == this.position {
return;
}
let Ok(new_dock) = workspace.update(cx, |workspace, cx| {
if panel.is_zoomed(cx) {
@ -354,6 +360,8 @@ impl Dock {
}
});
}
}),
cx.subscribe(&panel, move |this, panel, event, cx| match event {
PanelEvent::ZoomIn => {
this.set_panel_zoomed(&panel.to_any(), true, cx);
if !panel.focus_handle(cx).contains_focused(cx) {
@ -737,7 +745,7 @@ pub mod test {
fn set_position(&mut self, position: DockPosition, cx: &mut ViewContext<Self>) {
self.position = position;
cx.emit(PanelEvent::ChangePosition);
cx.update_global::<SettingsStore, _>(|_, _| {});
}
fn size(&self, _: &WindowContext) -> Pixels {