Initialize toggle chat panel action
This commit is contained in:
parent
049314e84e
commit
e4bc346723
2 changed files with 11 additions and 4 deletions
|
@ -36,6 +36,15 @@ mod message_editor;
|
||||||
const MESSAGE_LOADING_THRESHOLD: usize = 50;
|
const MESSAGE_LOADING_THRESHOLD: usize = 50;
|
||||||
const CHAT_PANEL_KEY: &'static str = "ChatPanel";
|
const CHAT_PANEL_KEY: &'static str = "ChatPanel";
|
||||||
|
|
||||||
|
pub fn init(cx: &mut AppContext) {
|
||||||
|
cx.observe_new_views(|workspace: &mut Workspace, _| {
|
||||||
|
workspace.register_action(|workspace, _: &ToggleFocus, cx| {
|
||||||
|
workspace.toggle_panel_focus::<ChatPanel>(cx);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.detach();
|
||||||
|
}
|
||||||
|
|
||||||
pub struct ChatPanel {
|
pub struct ChatPanel {
|
||||||
client: Arc<Client>,
|
client: Arc<Client>,
|
||||||
channel_store: Model<ChannelStore>,
|
channel_store: Model<ChannelStore>,
|
||||||
|
@ -259,12 +268,10 @@ impl ChatPanel {
|
||||||
.justify_between()
|
.justify_between()
|
||||||
.z_index(1)
|
.z_index(1)
|
||||||
.bg(cx.theme().colors().background)
|
.bg(cx.theme().colors().background)
|
||||||
.border()
|
|
||||||
.border_color(gpui::red())
|
|
||||||
.child(Label::new(
|
.child(Label::new(
|
||||||
self.active_chat
|
self.active_chat
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.and_then(|c| Some(c.0.read(cx).channel(cx)?.name.clone()))
|
.and_then(|c| Some(format!("#{}", c.0.read(cx).channel(cx)?.name)))
|
||||||
.unwrap_or_default(),
|
.unwrap_or_default(),
|
||||||
))
|
))
|
||||||
.child(
|
.child(
|
||||||
|
|
|
@ -35,7 +35,7 @@ pub fn init(app_state: &Arc<AppState>, cx: &mut AppContext) {
|
||||||
collab_titlebar_item::init(cx);
|
collab_titlebar_item::init(cx);
|
||||||
collab_panel::init(cx);
|
collab_panel::init(cx);
|
||||||
channel_view::init(cx);
|
channel_view::init(cx);
|
||||||
// chat_panel::init(cx);
|
chat_panel::init(cx);
|
||||||
notifications::init(&app_state, cx);
|
notifications::init(&app_state, cx);
|
||||||
|
|
||||||
// cx.add_global_action(toggle_screen_sharing);
|
// cx.add_global_action(toggle_screen_sharing);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue