notification: Fix display issues caused by the taffy upgrade (#1084)
This commit is contained in:
parent
f458cb83f8
commit
6d28cce719
5 changed files with 22 additions and 28 deletions
|
|
@ -11,9 +11,9 @@ use serde::Deserialize;
|
||||||
use std::{sync::Arc, time::Duration};
|
use std::{sync::Arc, time::Duration};
|
||||||
use story::{
|
use story::{
|
||||||
AccordionStory, AppState, AppTitleBar, Assets, ButtonStory, CalendarStory, DropdownStory,
|
AccordionStory, AppState, AppTitleBar, Assets, ButtonStory, CalendarStory, DropdownStory,
|
||||||
FormStory, IconStory, ImageStory, InputStory, LabelStory, ListStory, ModalStory, Open,
|
FormStory, IconStory, ImageStory, InputStory, LabelStory, ListStory, ModalStory,
|
||||||
PopoverStory, ProgressStory, ResizableStory, ScrollableStory, SidebarStory, StoryContainer,
|
NotificationStory, Open, PopoverStory, ProgressStory, ResizableStory, ScrollableStory,
|
||||||
SwitchStory, TableStory, TooltipStory, WebViewStory,
|
SidebarStory, StoryContainer, SwitchStory, TableStory, TooltipStory, WebViewStory,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Action, Clone, PartialEq, Eq, Deserialize)]
|
#[derive(Action, Clone, PartialEq, Eq, Deserialize)]
|
||||||
|
|
@ -361,6 +361,7 @@ impl StoryWorkspace {
|
||||||
Arc::new(StoryContainer::panel::<AccordionStory>(window, cx)),
|
Arc::new(StoryContainer::panel::<AccordionStory>(window, cx)),
|
||||||
Arc::new(StoryContainer::panel::<SidebarStory>(window, cx)),
|
Arc::new(StoryContainer::panel::<SidebarStory>(window, cx)),
|
||||||
Arc::new(StoryContainer::panel::<FormStory>(window, cx)),
|
Arc::new(StoryContainer::panel::<FormStory>(window, cx)),
|
||||||
|
Arc::new(StoryContainer::panel::<NotificationStory>(window, cx)),
|
||||||
],
|
],
|
||||||
None,
|
None,
|
||||||
&dock_area,
|
&dock_area,
|
||||||
|
|
@ -522,7 +523,7 @@ impl Render for StoryWorkspace {
|
||||||
.child(self.dock_area.clone())
|
.child(self.dock_area.clone())
|
||||||
.children(drawer_layer)
|
.children(drawer_layer)
|
||||||
.children(modal_layer)
|
.children(modal_layer)
|
||||||
.child(div().absolute().top_8().children(notification_layer))
|
.children(notification_layer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -412,7 +412,7 @@ impl Render for StoryTiles {
|
||||||
.child(self.dock_area.clone())
|
.child(self.dock_area.clone())
|
||||||
.children(drawer_layer)
|
.children(drawer_layer)
|
||||||
.children(modal_layer)
|
.children(modal_layer)
|
||||||
.child(div().absolute().top_8().children(notification_layer))
|
.children(notification_layer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -245,7 +245,7 @@ impl Render for StoryRoot {
|
||||||
)
|
)
|
||||||
.children(drawer_layer)
|
.children(drawer_layer)
|
||||||
.children(modal_layer)
|
.children(modal_layer)
|
||||||
.child(div().absolute().top_8().children(notification_layer))
|
.children(notification_layer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -398,7 +398,7 @@ impl NotificationList {
|
||||||
if let Err(err) =
|
if let Err(err) =
|
||||||
notification.update_in(cx, |note, window, cx| note.dismiss(window, cx))
|
notification.update_in(cx, |note, window, cx| note.dismiss(window, cx))
|
||||||
{
|
{
|
||||||
println!("failed to auto hide notification: {:?}", err);
|
tracing::error!("failed to auto hide notification: {:?}", err);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.detach();
|
.detach();
|
||||||
|
|
@ -438,26 +438,16 @@ impl Render for NotificationList {
|
||||||
let size = window.viewport_size();
|
let size = window.viewport_size();
|
||||||
let items = self.notifications.iter().rev().take(10).rev().cloned();
|
let items = self.notifications.iter().rev().take(10).rev().cloned();
|
||||||
|
|
||||||
div()
|
div().absolute().top_4().right_4().child(
|
||||||
.absolute()
|
v_flex()
|
||||||
.flex()
|
.id("notification-list")
|
||||||
.top_4()
|
.h(size.height - px(8.))
|
||||||
.bottom_4()
|
.on_hover(cx.listener(|view, hovered, _, cx| {
|
||||||
.right_4()
|
view.expanded = *hovered;
|
||||||
.justify_end()
|
cx.notify()
|
||||||
.child(
|
}))
|
||||||
v_flex()
|
.gap_3()
|
||||||
.id("notification-list")
|
.children(items),
|
||||||
.absolute()
|
)
|
||||||
.relative()
|
|
||||||
.right_0()
|
|
||||||
.h(size.height - px(8.))
|
|
||||||
.on_hover(cx.listener(|view, hovered, _, cx| {
|
|
||||||
view.expanded = *hovered;
|
|
||||||
cx.notify()
|
|
||||||
}))
|
|
||||||
.gap_3()
|
|
||||||
.children(items),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -277,6 +277,9 @@ impl Root {
|
||||||
|
|
||||||
Some(
|
Some(
|
||||||
div()
|
div()
|
||||||
|
.absolute()
|
||||||
|
.top_0()
|
||||||
|
.right_0()
|
||||||
.when_some(mt, |this, offset| this.mt(offset))
|
.when_some(mt, |this, offset| this.mt(offset))
|
||||||
.when_some(mr, |this, offset| this.mr(offset))
|
.when_some(mr, |this, offset| this.mr(offset))
|
||||||
.child(root.read(cx).notification.clone()),
|
.child(root.read(cx).notification.clone()),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue