diff --git a/crates/ui2/src/components/title_bar.rs b/crates/ui2/src/components/title_bar.rs index 4472c8cc6e7e0eec34b94316e42bb23d4859f82c..6d2a3164314c14a9a5457a99568ea22d8fb87b0e 100644 --- a/crates/ui2/src/components/title_bar.rs +++ b/crates/ui2/src/components/title_bar.rs @@ -6,7 +6,7 @@ use gpui3::{view, Context, View}; use crate::prelude::*; use crate::settings::user_settings; use crate::{ - random_players_with_call_status, theme, Avatar, Button, Icon, IconButton, IconColor, MicStatus, + theme, Avatar, Button, Icon, IconButton, IconColor, MicStatus, PlayerStack, PlayerWithCallStatus, ScreenShareStatus, ToolDivider, TrafficLights, }; @@ -80,14 +80,9 @@ impl TitleBar { cx.notify(); } - pub fn view(cx: &mut WindowContext) -> View { + pub fn view(cx: &mut WindowContext, livestream: Option) -> View { view( - cx.entity(|cx| { - Self::new(cx).set_livestream(Some(Livestream { - players: random_players_with_call_status(7), - channel: Some("gpui2-ui".to_string()), - })) - }), + cx.entity(|cx| Self::new(cx).set_livestream(livestream)), Self::render, ) } @@ -133,7 +128,7 @@ impl TitleBar { .child(Button::new("zed")) .child(Button::new("nate/gpui2-ui-components")), ) - // .children(player_list.map(|p| PlayerStack::new(p))) + .children(player_list.map(|p| PlayerStack::new(p))) .child(IconButton::new(Icon::Plus)), ) .child( @@ -204,7 +199,7 @@ mod stories { pub fn view(cx: &mut WindowContext) -> View { view( cx.entity(|cx| Self { - title_bar: TitleBar::view(cx), + title_bar: TitleBar::view(cx, None), }), Self::render, ) diff --git a/crates/ui2/src/components/workspace.rs b/crates/ui2/src/components/workspace.rs index 856244f6a1799697444f7b49f18c68b4e943b3a9..596dd1aa7cf5a802d5a486453ac481a2bd441711 100644 --- a/crates/ui2/src/components/workspace.rs +++ b/crates/ui2/src/components/workspace.rs @@ -3,12 +3,12 @@ use std::sync::Arc; use chrono::DateTime; use gpui3::{px, relative, rems, view, Context, Size, View}; -use crate::settings::FakeSettings; -use crate::{prelude::*, user_settings_mut, Button, SettingValue}; +use crate::prelude::*; use crate::{ - theme, v_stack, AssistantPanel, ChatMessage, ChatPanel, CollabPanel, EditorPane, Label, - LanguageSelector, Pane, PaneGroup, Panel, PanelAllowedSides, PanelSide, ProjectPanel, - SplitDirection, StatusBar, Terminal, TitleBar, Toast, ToastOrigin, + static_livestream, theme, user_settings_mut, v_stack, AssistantPanel, Button, ChatMessage, + ChatPanel, CollabPanel, EditorPane, FakeSettings, Label, LanguageSelector, Livestream, Pane, + PaneGroup, Panel, PanelAllowedSides, PanelSide, ProjectPanel, SettingValue, SplitDirection, + StatusBar, Terminal, TitleBar, Toast, ToastOrigin, }; #[derive(Clone)] @@ -50,7 +50,7 @@ pub struct Workspace { impl Workspace { pub fn new(cx: &mut ViewContext) -> Self { Self { - title_bar: TitleBar::view(cx), + title_bar: TitleBar::view(cx, None), editor_1: EditorPane::view(cx), show_project_panel: true, show_collab_panel: false, @@ -159,20 +159,19 @@ impl Workspace { } pub fn debug_toggle_livestream(&mut self, cx: &mut ViewContext) { - if self.debug.in_livestream { - self.debug.in_livestream = false; - } else { - self.debug.in_livestream = true; - } + self.debug.in_livestream = !self.debug.in_livestream; + + self.title_bar = TitleBar::view( + cx, + Some(static_livestream()).filter(|_| self.debug.in_livestream), + ); + cx.notify(); } pub fn debug_toggle_toast(&mut self, cx: &mut ViewContext) { - if self.debug.show_toast { - self.debug.show_toast = false; - } else { - self.debug.show_toast = true; - } + self.debug.show_toast = !self.debug.show_toast; + cx.notify(); }