chore: update gpui-component
This commit is contained in:
@@ -423,7 +423,7 @@ impl Render for ChatSpace {
|
||||
.child(self.dock.clone()),
|
||||
)
|
||||
// Notifications
|
||||
.child(div().absolute().top_8().children(notification_layer))
|
||||
.children(notification_layer)
|
||||
// Modals
|
||||
.children(modal_layer)
|
||||
}
|
||||
|
||||
@@ -177,6 +177,7 @@ impl Login {
|
||||
|
||||
fn ask_for_password(&mut self, content: String, window: &mut Window, cx: &mut Context<Self>) {
|
||||
let current_view = cx.entity().downgrade();
|
||||
let is_ncryptsec = content.starts_with("ncryptsec1");
|
||||
|
||||
let pwd_input = cx.new(|cx| InputState::new(window, cx).masked(true));
|
||||
let weak_pwd_input = pwd_input.downgrade();
|
||||
@@ -191,13 +192,13 @@ impl Login {
|
||||
let view_cancel = current_view.clone();
|
||||
let view_ok = current_view.clone();
|
||||
|
||||
let label: SharedString = if content.starts_with("nsec1") {
|
||||
let label: SharedString = if !is_ncryptsec {
|
||||
t!("login.set_password").into()
|
||||
} else {
|
||||
t!("login.password_to_decrypt").into()
|
||||
};
|
||||
|
||||
let description: SharedString = if content.starts_with("ncryptsec1") {
|
||||
let description: SharedString = if is_ncryptsec {
|
||||
t!("login.password_description").into()
|
||||
} else {
|
||||
t!("login.password_description_full").into()
|
||||
@@ -226,7 +227,7 @@ impl Login {
|
||||
|
||||
view_ok
|
||||
.update(cx, |this, cx| {
|
||||
this.verify_password(value, confirm, window, cx);
|
||||
this.verify_password(value, confirm, is_ncryptsec, window, cx);
|
||||
})
|
||||
.ok();
|
||||
true
|
||||
@@ -273,6 +274,7 @@ impl Login {
|
||||
&mut self,
|
||||
password: Option<SharedString>,
|
||||
confirm: Option<SharedString>,
|
||||
is_ncryptsec: bool,
|
||||
window: &mut Window,
|
||||
cx: &mut Context<Self>,
|
||||
) {
|
||||
@@ -286,8 +288,8 @@ impl Login {
|
||||
return;
|
||||
}
|
||||
|
||||
// Skip verification if password starts with "ncryptsec1"
|
||||
if password.starts_with("ncryptsec1") {
|
||||
// Skip verification if key is ncryptsec
|
||||
if is_ncryptsec {
|
||||
self.login_with_keys(password.to_string(), window, cx);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -568,13 +568,15 @@ impl Sidebar {
|
||||
let desc = SharedString::new(t!("sidebar.loading_modal_description"));
|
||||
|
||||
window.open_modal(cx, move |this, _window, cx| {
|
||||
this.title(title.clone()).child(
|
||||
this.child(
|
||||
div()
|
||||
.pt_8()
|
||||
.px_4()
|
||||
.pb_4()
|
||||
.flex()
|
||||
.flex_col()
|
||||
.gap_2()
|
||||
.child(div().font_semibold().child(title.clone()))
|
||||
.child(
|
||||
div()
|
||||
.flex()
|
||||
|
||||
@@ -3,9 +3,9 @@ use std::time::Duration;
|
||||
|
||||
use gpui::prelude::FluentBuilder;
|
||||
use gpui::{
|
||||
anchored, div, point, px, relative, Animation, AnimationExt as _, AnyElement, App, Bounds,
|
||||
ClickEvent, Div, FocusHandle, InteractiveElement, IntoElement, KeyBinding, MouseButton,
|
||||
ParentElement, Pixels, Point, RenderOnce, SharedString, Styled, Window,
|
||||
anchored, div, hsla, point, px, relative, Animation, AnimationExt as _, AnyElement, App,
|
||||
Bounds, BoxShadow, ClickEvent, Div, FocusHandle, InteractiveElement, IntoElement, KeyBinding,
|
||||
MouseButton, ParentElement, Pixels, Point, RenderOnce, SharedString, Styled, Window,
|
||||
};
|
||||
use theme::ActiveTheme;
|
||||
|
||||
@@ -366,6 +366,9 @@ impl RenderOnce for Modal {
|
||||
let y = self.margin_top.unwrap_or(view_size.height / 10.) + offset_top;
|
||||
let x = bounds.center().x - self.width / 2.;
|
||||
|
||||
let animation = Animation::new(Duration::from_secs_f64(0.25))
|
||||
.with_easing(cubic_bezier(0.32, 0.72, 0., 1.));
|
||||
|
||||
anchored()
|
||||
.position(point(window_paddings.left, window_paddings.top))
|
||||
.snap_to_window()
|
||||
@@ -487,16 +490,27 @@ impl RenderOnce for Modal {
|
||||
)),
|
||||
)
|
||||
})
|
||||
.with_animation(
|
||||
"slide-down",
|
||||
Animation::new(Duration::from_secs_f64(0.25))
|
||||
.with_easing(cubic_bezier(0.32, 0.72, 0., 1.)),
|
||||
move |this, delta| {
|
||||
let y_offset = px(0.) + delta * px(30.);
|
||||
this.top(y + y_offset)
|
||||
},
|
||||
),
|
||||
),
|
||||
.with_animation("slide-down", animation.clone(), move |this, delta| {
|
||||
let y_offset = px(0.) + delta * px(30.);
|
||||
// This is equivalent to `shadow_xl` with an extra opacity.
|
||||
let shadow = vec![
|
||||
BoxShadow {
|
||||
color: hsla(0., 0., 0., 0.1 * delta),
|
||||
offset: point(px(0.), px(20.)),
|
||||
blur_radius: px(25.),
|
||||
spread_radius: px(-5.),
|
||||
},
|
||||
BoxShadow {
|
||||
color: hsla(0., 0., 0., 0.1 * delta),
|
||||
offset: point(px(0.), px(8.)),
|
||||
blur_radius: px(10.),
|
||||
spread_radius: px(-6.),
|
||||
},
|
||||
];
|
||||
this.top(y + y_offset).shadow(shadow)
|
||||
}),
|
||||
)
|
||||
.with_animation("fade-in", animation, move |this, delta| this.opacity(delta)),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -364,26 +364,16 @@ impl Render for NotificationList {
|
||||
let size = window.viewport_size();
|
||||
let items = self.notifications.iter().rev().take(10).rev().cloned();
|
||||
|
||||
div()
|
||||
.absolute()
|
||||
.flex()
|
||||
.top_4()
|
||||
.bottom_4()
|
||||
.right_4()
|
||||
.justify_end()
|
||||
.child(
|
||||
v_flex()
|
||||
.id("notification-list")
|
||||
.gap_3()
|
||||
.absolute()
|
||||
.relative()
|
||||
.right_0()
|
||||
.h(size.height - px(8.))
|
||||
.children(items)
|
||||
.on_hover(cx.listener(|view, hovered, _window, cx| {
|
||||
view.expanded = *hovered;
|
||||
cx.notify();
|
||||
})),
|
||||
)
|
||||
div().absolute().top_4().right_4().child(
|
||||
v_flex()
|
||||
.id("notification-list")
|
||||
.h(size.height - px(8.))
|
||||
.on_hover(cx.listener(|view, hovered, _, cx| {
|
||||
view.expanded = *hovered;
|
||||
cx.notify()
|
||||
}))
|
||||
.gap_3()
|
||||
.children(items),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,7 +188,13 @@ impl Root {
|
||||
) -> Option<impl IntoElement> {
|
||||
let root = window.root::<Root>()??;
|
||||
|
||||
Some(div().child(root.read(cx).notification.clone()))
|
||||
Some(
|
||||
div()
|
||||
.absolute()
|
||||
.top_0()
|
||||
.right_0()
|
||||
.child(root.read(cx).notification.clone()),
|
||||
)
|
||||
}
|
||||
|
||||
/// Render the Modal layer.
|
||||
|
||||
Reference in New Issue
Block a user