feat: add edit profile panel
This commit is contained in:
@@ -77,7 +77,7 @@ impl Dock {
|
||||
) -> Self {
|
||||
let panel = cx.new(|cx| {
|
||||
let mut tab = TabPanel::new(None, dock_area.clone(), window, cx);
|
||||
tab.closeable = false;
|
||||
tab.closable = true;
|
||||
tab
|
||||
});
|
||||
|
||||
@@ -250,7 +250,7 @@ impl Dock {
|
||||
.when(self.placement.is_right(), |this| {
|
||||
this.cursor_col_resize()
|
||||
.top_0()
|
||||
.left(px(1.))
|
||||
.left(px(-0.5))
|
||||
.h_full()
|
||||
.w(HANDLE_SIZE)
|
||||
.pt_12()
|
||||
|
||||
@@ -21,7 +21,7 @@ use std::sync::Arc;
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
struct TabState {
|
||||
closeable: bool,
|
||||
closable: bool,
|
||||
zoomable: bool,
|
||||
draggable: bool,
|
||||
droppable: bool,
|
||||
@@ -70,7 +70,7 @@ pub struct TabPanel {
|
||||
pub(crate) active_ix: usize,
|
||||
/// If this is true, the Panel closeable will follow the active panel's closeable,
|
||||
/// otherwise this TabPanel will not able to close
|
||||
pub(crate) closeable: bool,
|
||||
pub(crate) closable: bool,
|
||||
tab_bar_scroll_handle: ScrollHandle,
|
||||
is_zoomed: bool,
|
||||
is_collapsed: bool,
|
||||
@@ -90,7 +90,7 @@ impl Panel for TabPanel {
|
||||
}
|
||||
|
||||
fn closable(&self, cx: &App) -> bool {
|
||||
if !self.closeable {
|
||||
if !self.closable {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ impl TabPanel {
|
||||
will_split_placement: None,
|
||||
is_zoomed: false,
|
||||
is_collapsed: false,
|
||||
closeable: true,
|
||||
closable: true,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -356,8 +356,6 @@ impl TabPanel {
|
||||
let view = cx.entity().clone();
|
||||
let build_popup_menu = move |this, cx: &App| view.read(cx).popup_menu(this, cx);
|
||||
|
||||
// TODO: Do not show MenuButton if there is no menu items
|
||||
|
||||
h_flex()
|
||||
.gap_2()
|
||||
.occlude()
|
||||
@@ -390,7 +388,7 @@ impl TabPanel {
|
||||
let name = if is_zoomed { "Zoom Out" } else { "Zoom In" };
|
||||
this.separator().menu(name, Box::new(ToggleZoom))
|
||||
})
|
||||
.when(state.closeable, |this| {
|
||||
.when(state.closable, |this| {
|
||||
this.separator().menu("Close", Box::new(ClosePanel))
|
||||
})
|
||||
})
|
||||
@@ -1015,14 +1013,14 @@ impl Render for TabPanel {
|
||||
let focus_handle = self.focus_handle(cx);
|
||||
|
||||
let mut state = TabState {
|
||||
closeable: self.closable(cx),
|
||||
closable: self.closable(cx),
|
||||
draggable: self.draggable(cx),
|
||||
droppable: self.droppable(cx),
|
||||
zoomable: self.zoomable(cx),
|
||||
};
|
||||
|
||||
if !state.draggable {
|
||||
state.closeable = false;
|
||||
state.closable = false;
|
||||
}
|
||||
|
||||
v_flex()
|
||||
|
||||
@@ -495,7 +495,7 @@ impl Element for TextElement {
|
||||
|
||||
// Paint selections
|
||||
if let Some(path) = prepaint.selection_path.take() {
|
||||
window.paint_path(path, cx.theme().accent.step(cx, ColorScaleStep::FIVE));
|
||||
window.paint_path(path, cx.theme().accent.step(cx, ColorScaleStep::FOUR));
|
||||
}
|
||||
|
||||
// Paint multi line text
|
||||
@@ -515,7 +515,7 @@ impl Element for TextElement {
|
||||
|
||||
for line in prepaint.lines.iter() {
|
||||
let p = point(origin.x, origin.y + offset_y);
|
||||
_ = line.paint(p, line_height, window, cx);
|
||||
_ = line.paint(p, line_height, gpui::TextAlign::Left, window, cx);
|
||||
offset_y += line.size(line_height).height;
|
||||
}
|
||||
|
||||
|
||||
@@ -237,16 +237,16 @@ impl Render for Notification {
|
||||
.shadow_md()
|
||||
.p_2()
|
||||
.gap_3()
|
||||
.child(div().absolute().top_3().left_2().child(icon))
|
||||
.child(div().absolute().top_2p5().left_2().child(icon))
|
||||
.child(
|
||||
v_flex()
|
||||
.pl_6()
|
||||
.gap_1()
|
||||
.when_some(self.title.clone(), |this, title| {
|
||||
this.child(div().text_sm().font_semibold().child(title))
|
||||
this.child(div().text_xs().font_semibold().child(title))
|
||||
})
|
||||
.overflow_hidden()
|
||||
.child(div().text_sm().child(self.message.clone())),
|
||||
.child(div().text_xs().child(self.message.clone())),
|
||||
)
|
||||
.when_some(self.on_click.clone(), |this, on_click| {
|
||||
this.cursor_pointer()
|
||||
@@ -370,16 +370,16 @@ impl Render for NotificationList {
|
||||
.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();
|
||||
}))
|
||||
.gap_3()
|
||||
.children(items),
|
||||
})),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user