fix icon in dropdown
Some checks failed
Rust / build (ubuntu-latest, stable) (push) Failing after 1m46s
Rust / build (macos-latest, stable) (push) Has been cancelled
Rust / build (windows-latest, stable) (push) Has been cancelled
Some checks failed
Rust / build (ubuntu-latest, stable) (push) Failing after 1m46s
Rust / build (macos-latest, stable) (push) Has been cancelled
Rust / build (windows-latest, stable) (push) Has been cancelled
This commit is contained in:
@@ -18,7 +18,7 @@ use ui::button::{Button, ButtonVariants};
|
|||||||
use ui::dock_area::dock::DockPlacement;
|
use ui::dock_area::dock::DockPlacement;
|
||||||
use ui::dock_area::panel::PanelView;
|
use ui::dock_area::panel::PanelView;
|
||||||
use ui::dock_area::{ClosePanel, DockArea, DockItem};
|
use ui::dock_area::{ClosePanel, DockArea, DockItem};
|
||||||
use ui::menu::DropdownMenu;
|
use ui::menu::{DropdownMenu, PopupMenuItem};
|
||||||
use ui::{h_flex, v_flex, IconName, Root, Sizable, WindowExtension};
|
use ui::{h_flex, v_flex, IconName, Root, Sizable, WindowExtension};
|
||||||
|
|
||||||
use crate::dialogs::settings;
|
use crate::dialogs::settings;
|
||||||
@@ -382,17 +382,29 @@ impl Workspace {
|
|||||||
.when_some(current_user.as_ref(), |this, public_key| {
|
.when_some(current_user.as_ref(), |this, public_key| {
|
||||||
let persons = PersonRegistry::global(cx);
|
let persons = PersonRegistry::global(cx);
|
||||||
let profile = persons.read(cx).get(public_key, cx);
|
let profile = persons.read(cx).get(public_key, cx);
|
||||||
|
let avatar = profile.avatar();
|
||||||
|
let name = profile.name();
|
||||||
|
|
||||||
this.child(
|
this.child(
|
||||||
Button::new("current-user")
|
Button::new("current-user")
|
||||||
.child(Avatar::new(profile.avatar()).xsmall())
|
.child(Avatar::new(avatar.clone()).xsmall())
|
||||||
.small()
|
.small()
|
||||||
.caret()
|
.caret()
|
||||||
.compact()
|
.compact()
|
||||||
.transparent()
|
.transparent()
|
||||||
.dropdown_menu(move |this, _window, _cx| {
|
.dropdown_menu(move |this, _window, _cx| {
|
||||||
|
let avatar = avatar.clone();
|
||||||
|
let name = name.clone();
|
||||||
|
|
||||||
this.min_w(px(256.))
|
this.min_w(px(256.))
|
||||||
.label(profile.name())
|
.item(PopupMenuItem::element(move |_window, cx| {
|
||||||
|
h_flex()
|
||||||
|
.gap_1p5()
|
||||||
|
.text_xs()
|
||||||
|
.text_color(cx.theme().text_muted)
|
||||||
|
.child(Avatar::new(avatar.clone()).xsmall())
|
||||||
|
.child(name.clone())
|
||||||
|
}))
|
||||||
.separator()
|
.separator()
|
||||||
.menu_with_icon(
|
.menu_with_icon(
|
||||||
"Profile",
|
"Profile",
|
||||||
|
|||||||
@@ -1112,12 +1112,7 @@ impl PopupMenu {
|
|||||||
.border_color(cx.theme().border)
|
.border_color(cx.theme().border)
|
||||||
.disabled(true),
|
.disabled(true),
|
||||||
PopupMenuItem::Label(label) => this.disabled(true).cursor_default().child(
|
PopupMenuItem::Label(label) => this.disabled(true).cursor_default().child(
|
||||||
h_flex()
|
h_flex().cursor_default().items_center().gap_x_1().child(
|
||||||
.cursor_default()
|
|
||||||
.items_center()
|
|
||||||
.gap_x_1()
|
|
||||||
.children(Self::render_icon(has_left_icon, false, None, window, cx))
|
|
||||||
.child(
|
|
||||||
div()
|
div()
|
||||||
.flex_1()
|
.flex_1()
|
||||||
.text_xs()
|
.text_xs()
|
||||||
@@ -1127,10 +1122,7 @@ impl PopupMenu {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
PopupMenuItem::ElementItem {
|
PopupMenuItem::ElementItem {
|
||||||
render,
|
render, disabled, ..
|
||||||
icon,
|
|
||||||
disabled,
|
|
||||||
..
|
|
||||||
} => this
|
} => this
|
||||||
.when(!disabled, |this| {
|
.when(!disabled, |this| {
|
||||||
this.on_click(
|
this.on_click(
|
||||||
@@ -1144,13 +1136,6 @@ impl PopupMenu {
|
|||||||
.min_h(item_height)
|
.min_h(item_height)
|
||||||
.items_center()
|
.items_center()
|
||||||
.gap_x_2()
|
.gap_x_2()
|
||||||
.children(Self::render_icon(
|
|
||||||
has_left_icon,
|
|
||||||
is_left_check,
|
|
||||||
icon.clone(),
|
|
||||||
window,
|
|
||||||
cx,
|
|
||||||
))
|
|
||||||
.child((render)(window, cx))
|
.child((render)(window, cx))
|
||||||
.children(right_check_icon.map(|icon| icon.ml_3())),
|
.children(right_check_icon.map(|icon| icon.ml_3())),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user