@@ -1,7 +1,7 @@
|
||||
use crate::Workspace;
|
||||
use gpui::{
|
||||
div, px, AnyView, Component, Div, EventEmitter, ParentElement, Render, StatelessInteractive,
|
||||
Styled, Subscription, View, ViewContext,
|
||||
div, px, AnyView, Component, Div, EventEmitter, ParentElement, Render, StatefulInteractivity,
|
||||
StatelessInteractive, Styled, Subscription, View, ViewContext,
|
||||
};
|
||||
use std::{any::TypeId, sync::Arc};
|
||||
use ui::v_stack;
|
||||
@@ -9,7 +9,14 @@ use ui::v_stack;
|
||||
pub struct ModalLayer {
|
||||
open_modal: Option<AnyView>,
|
||||
subscription: Option<Subscription>,
|
||||
registered_modals: Vec<(TypeId, Box<dyn Fn(Div<Workspace>) -> Div<Workspace>>)>,
|
||||
registered_modals: Vec<(
|
||||
TypeId,
|
||||
Box<
|
||||
dyn Fn(
|
||||
Div<Workspace, StatefulInteractivity<Workspace>>,
|
||||
) -> Div<Workspace, StatefulInteractivity<Workspace>>,
|
||||
>,
|
||||
)>,
|
||||
}
|
||||
|
||||
pub enum ModalEvent {
|
||||
@@ -64,8 +71,11 @@ impl ModalLayer {
|
||||
cx.notify();
|
||||
}
|
||||
|
||||
pub fn wrapper_element(&self, cx: &ViewContext<Workspace>) -> Div<Workspace> {
|
||||
let mut parent = div().relative().size_full();
|
||||
pub fn wrapper_element(
|
||||
&self,
|
||||
cx: &ViewContext<Workspace>,
|
||||
) -> Div<Workspace, StatefulInteractivity<Workspace>> {
|
||||
let mut parent = div().id("modal layer").relative().size_full();
|
||||
|
||||
for (_, action) in self.registered_modals.iter() {
|
||||
parent = (action)(parent);
|
||||
|
||||
@@ -39,8 +39,8 @@ use gpui::{
|
||||
actions, div, point, rems, size, AnyModel, AnyView, AnyWeakView, AppContext, AsyncAppContext,
|
||||
AsyncWindowContext, Bounds, Component, DispatchContext, Div, Entity, EntityId, EventEmitter,
|
||||
FocusHandle, GlobalPixels, Model, ModelContext, ParentElement, Point, Render, Size,
|
||||
StatefulInteractive, Styled, Subscription, Task, View, ViewContext, VisualContext, WeakView,
|
||||
WindowBounds, WindowContext, WindowHandle, WindowOptions,
|
||||
StatefulInteractive, StatefulInteractivity, Styled, Subscription, Task, View, ViewContext,
|
||||
VisualContext, WeakView, WindowBounds, WindowContext, WindowHandle, WindowOptions,
|
||||
};
|
||||
use item::{FollowableItem, FollowableItemHandle, Item, ItemHandle, ItemSettings, ProjectItem};
|
||||
use itertools::Itertools;
|
||||
@@ -3706,13 +3706,14 @@ fn notify_if_database_failed(workspace: WindowHandle<Workspace>, cx: &mut AsyncA
|
||||
impl EventEmitter<Event> for Workspace {}
|
||||
|
||||
impl Render for Workspace {
|
||||
type Element = Div<Self>;
|
||||
type Element = Div<Self, StatefulInteractivity<Self>>;
|
||||
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
|
||||
let mut context = DispatchContext::default();
|
||||
context.insert("Workspace");
|
||||
cx.with_key_dispatch_context(context, |cx| {
|
||||
div()
|
||||
.id("workspace")
|
||||
.relative()
|
||||
.size_full()
|
||||
.flex()
|
||||
|
||||
Reference in New Issue
Block a user