From 6e5ad75c5cfaf909b138e55ea1f27ed68aa9c1d9 Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Thu, 12 Oct 2023 16:52:32 -0400 Subject: [PATCH] Use `Workspace::view` to construct the view --- crates/ui2/src/components/workspace.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/ui2/src/components/workspace.rs b/crates/ui2/src/components/workspace.rs index 807ce215ae..6faaa164d7 100644 --- a/crates/ui2/src/components/workspace.rs +++ b/crates/ui2/src/components/workspace.rs @@ -23,10 +23,6 @@ pub struct Workspace { bottom_panel_scroll_state: ScrollState, } -fn workspace(cx: &mut WindowContext) -> View { - view(cx.entity(|cx| Workspace::new()), Workspace::render) -} - impl Workspace { pub fn new() -> Self { Self { @@ -109,6 +105,10 @@ impl Workspace { cx.notify(); } + pub fn view(cx: &mut WindowContext) -> View { + view(cx.entity(|cx| Self::new()), Self::render) + } + pub fn render(&mut self, cx: &mut ViewContext) -> impl Element { let theme = theme(cx).clone(); @@ -285,7 +285,7 @@ mod stories { pub fn view(cx: &mut WindowContext) -> View { view( cx.entity(|cx| Self { - workspace: workspace(cx), + workspace: Workspace::view(cx), }), |view, cx| view.workspace.clone(), )