diff --git a/zed/assets/themes/_base.toml b/zed/assets/themes/_base.toml index 06b6346531..08d618aaed 100644 --- a/zed/assets/themes/_base.toml +++ b/zed/assets/themes/_base.toml @@ -24,9 +24,11 @@ color = "$text.0.color" [chat_panel] padding = { top = 10.0, bottom = 10.0, left = 10.0, right = 10.0 } +channel_name = { extends = "$text.0", weight = "bold" } +channel_name_hash = { text = "$text.2", padding.right = 5.0 } [chat_panel.message] -body = "$text.0" +body = "$text.1" sender.margin.right = 10.0 sender.text = { extends = "$text.0", weight = "bold" } timestamp.text = "$text.2" diff --git a/zed/assets/themes/dark.toml b/zed/assets/themes/dark.toml index ce44b87e96..9a8ac975bf 100644 --- a/zed/assets/themes/dark.toml +++ b/zed/assets/themes/dark.toml @@ -6,7 +6,7 @@ extends = "_base" 2 = "#131415" [text] -base = { family = "Helvetica", size = 12.0 } +base = { family = "Helvetica", size = 14.0 } 0 = { extends = "$text.base", color = "#ffffff" } 1 = { extends = "$text.base", color = "#b3b3b3" } 2 = { extends = "$text.base", color = "#7b7d80" } diff --git a/zed/src/channel.rs b/zed/src/channel.rs index 02352ec00d..f1f2e07607 100644 --- a/zed/src/channel.rs +++ b/zed/src/channel.rs @@ -237,6 +237,10 @@ impl Channel { } } + pub fn name(&self) -> &str { + &self.details.name + } + pub fn send_message(&mut self, body: String, cx: &mut ModelContext) -> Result<()> { let channel_id = self.details.id; let current_user_id = self.current_user_id()?; diff --git a/zed/src/chat_panel.rs b/zed/src/chat_panel.rs index d3b4260482..03630ac6c8 100644 --- a/zed/src/chat_panel.rs +++ b/zed/src/chat_panel.rs @@ -99,6 +99,28 @@ impl ChatPanel { cx.notify(); } + fn render_channel_name(&self, cx: &RenderContext) -> ElementBox { + let settings = self.settings.borrow(); + let theme = &settings.theme.chat_panel; + if let Some((channel, _)) = self.active_channel.as_ref() { + let channel = channel.read(cx); + Flex::row() + .with_child( + Container::new( + Label::new("#".to_string(), theme.channel_name_hash.label.clone()).boxed(), + ) + .with_style(&theme.channel_name_hash.container) + .boxed(), + ) + .with_child( + Label::new(channel.name().to_string(), theme.channel_name.clone()).boxed(), + ) + .boxed() + } else { + Empty::new().boxed() + } + } + fn render_active_channel_messages(&self, cx: &RenderContext) -> ElementBox { let messages = if let Some((channel, _)) = self.active_channel.as_ref() { let channel = channel.read(cx); @@ -184,6 +206,7 @@ impl View for ChatPanel { let theme = &self.settings.borrow().theme; Container::new( Flex::column() + .with_child(self.render_channel_name(cx)) .with_child(self.render_active_channel_messages(cx)) .with_child(self.render_input_box()) .boxed(), diff --git a/zed/src/theme.rs b/zed/src/theme.rs index 0346eba0e8..bb9b4b97ab 100644 --- a/zed/src/theme.rs +++ b/zed/src/theme.rs @@ -62,6 +62,8 @@ pub struct ChatPanel { #[serde(flatten)] pub container: ContainerStyle, pub message: ChatMessage, + pub channel_name: TextStyle, + pub channel_name_hash: ContainedLabel, } #[derive(Deserialize)]