update sidebar
This commit is contained in:
@@ -56,6 +56,7 @@ pub enum IconName {
|
||||
Message,
|
||||
Moon,
|
||||
Plus,
|
||||
PlusChat,
|
||||
PlusCircle,
|
||||
Profile,
|
||||
Reset,
|
||||
@@ -139,6 +140,7 @@ impl IconNamed for IconName {
|
||||
Self::Message => "icons/message.svg",
|
||||
Self::Moon => "icons/moon.svg",
|
||||
Self::Plus => "icons/plus.svg",
|
||||
Self::PlusChat => "icons/plus-chat.svg",
|
||||
Self::PlusCircle => "icons/plus-circle.svg",
|
||||
Self::Profile => "icons/profile.svg",
|
||||
Self::Reset => "icons/reset.svg",
|
||||
|
||||
@@ -990,7 +990,7 @@ impl PopupMenu {
|
||||
|
||||
let this = MenuItemElement::new(ix, &group_name)
|
||||
.relative()
|
||||
.text_sm()
|
||||
.text_xs()
|
||||
.py_0()
|
||||
.px(INNER_PADDING)
|
||||
.rounded(radius)
|
||||
@@ -1063,7 +1063,7 @@ impl PopupMenu {
|
||||
})
|
||||
.disabled(*disabled)
|
||||
.h(item_height)
|
||||
.gap_x_1()
|
||||
.gap_x_1p5()
|
||||
.children(Self::render_icon(
|
||||
has_left_icon,
|
||||
is_left_check,
|
||||
@@ -1110,7 +1110,7 @@ impl PopupMenu {
|
||||
.min_h(item_height)
|
||||
.size_full()
|
||||
.items_center()
|
||||
.gap_x_1()
|
||||
.gap_x_1p5()
|
||||
.children(Self::render_icon(
|
||||
has_left_icon,
|
||||
false,
|
||||
|
||||
@@ -394,7 +394,6 @@ impl Sidebar {
|
||||
let profile = persons.read(cx).get(current_user, cx);
|
||||
let avatar = profile.avatar();
|
||||
let avatar_seed = profile.avatar_seed();
|
||||
let name = profile.name();
|
||||
|
||||
h_flex()
|
||||
.id("sidebar-user")
|
||||
@@ -419,47 +418,19 @@ impl Sidebar {
|
||||
.compact()
|
||||
.transparent()
|
||||
.dropdown_menu(move |this, _window, _cx| {
|
||||
let avatar = avatar.clone();
|
||||
let avatar_seed = avatar_seed.clone();
|
||||
let name = name.clone();
|
||||
|
||||
this.min_w(px(256.))
|
||||
.item(PopupMenuItem::element(move |_window, cx| {
|
||||
h_flex()
|
||||
.gap_1p5()
|
||||
.text_xs()
|
||||
.text_color(cx.theme().text_muted)
|
||||
.child(
|
||||
Avatar::new(avatar.clone())
|
||||
.seed(avatar_seed.clone())
|
||||
.xsmall(),
|
||||
)
|
||||
.child(name.clone())
|
||||
}))
|
||||
.separator()
|
||||
.menu_with_icon("Inbox", IconName::Inbox, Box::new(Command::ShowInbox))
|
||||
.menu_with_icon(
|
||||
"Search",
|
||||
IconName::Search,
|
||||
Box::new(Command::ShowSearch),
|
||||
)
|
||||
.menu_with_icon(
|
||||
"Profile",
|
||||
IconName::Profile,
|
||||
Box::new(Command::ShowProfile),
|
||||
)
|
||||
.menu_with_icon(
|
||||
"Contact List",
|
||||
IconName::Book,
|
||||
Box::new(Command::ShowContactList),
|
||||
"Relays",
|
||||
IconName::Relay,
|
||||
Box::new(Command::ShowRelayList),
|
||||
)
|
||||
.menu_with_icon(
|
||||
"Backup",
|
||||
IconName::UserKey,
|
||||
Box::new(Command::ShowBackup),
|
||||
)
|
||||
.menu_with_icon("Themes", IconName::Sun, Box::new(Command::ToggleTheme))
|
||||
.separator()
|
||||
.menu_with_icon("Themes", IconName::Sun, Box::new(Command::ToggleTheme))
|
||||
.menu_with_icon(
|
||||
"Settings",
|
||||
IconName::Settings,
|
||||
@@ -467,28 +438,29 @@ impl Sidebar {
|
||||
)
|
||||
}),
|
||||
)
|
||||
.child(div().flex_1())
|
||||
.when_some(updater, |this, updater| {
|
||||
this.child(self.render_updater(updater, cx))
|
||||
})
|
||||
.child(
|
||||
Button::new("sidebar-new")
|
||||
.icon(IconName::PlusCircle)
|
||||
.icon(IconName::PlusChat)
|
||||
.tooltip("New")
|
||||
.ghost()
|
||||
.small()
|
||||
.dropdown_menu(|menu, _window, _cx| {
|
||||
menu.menu_with_icon(
|
||||
"New Group",
|
||||
IconName::Group,
|
||||
Box::new(Command::NewGroup),
|
||||
)
|
||||
.menu_with_icon("Join Group", IconName::Door, Box::new(Command::JoinGroup))
|
||||
.separator()
|
||||
.menu_with_icon(
|
||||
"New Chat",
|
||||
IconName::Message,
|
||||
Box::new(Command::NewChat),
|
||||
)
|
||||
.menu_with_icon("New Group", IconName::Group, Box::new(Command::NewGroup))
|
||||
.separator()
|
||||
.menu_with_icon(
|
||||
"Join Group",
|
||||
IconName::Door,
|
||||
Box::new(Command::JoinGroup),
|
||||
)
|
||||
}),
|
||||
)
|
||||
.when(self.group_open, |this| {
|
||||
@@ -841,16 +813,19 @@ impl Sidebar {
|
||||
.h_10()
|
||||
.w_full()
|
||||
.px_1p5()
|
||||
.py_1()
|
||||
.justify_center()
|
||||
.border_1()
|
||||
.border_dashed()
|
||||
.border_color(cx.theme().border)
|
||||
.rounded(cx.theme().radius)
|
||||
.justify_center()
|
||||
.text_xs()
|
||||
.text_color(cx.theme().text_placeholder)
|
||||
.child(*text)
|
||||
.child(
|
||||
h_flex()
|
||||
.h_9()
|
||||
.w_full()
|
||||
.justify_center()
|
||||
.border_1()
|
||||
.border_dashed()
|
||||
.border_color(cx.theme().border)
|
||||
.rounded(cx.theme().radius)
|
||||
.text_xs()
|
||||
.text_color(cx.theme().text_placeholder)
|
||||
.child(*text),
|
||||
)
|
||||
.into_any_element(),
|
||||
SidebarRow::Room { room } => {
|
||||
let name = room.read(cx).display_name(cx);
|
||||
|
||||
Reference in New Issue
Block a user