This commit is contained in:
2026-10-22 15:58:24 +07:00
parent 49f2d9edc1
commit bebb4cebbf
25 changed files with 147 additions and 100 deletions
+1
View File
@@ -1155,6 +1155,7 @@ impl ChatPanel {
.avatar(
Avatar::new(author.avatar())
.seed(author.avatar_seed())
.small()
.flex_shrink_0()
.relative()
.dropdown_menu(move |this, _window, _cx| {
+3 -4
View File
@@ -10,7 +10,6 @@ use gpui_kit::component::{
ActiveTheme, InteractiveElementExt as _, StyledExt as _, h_flex, v_flex,
};
use smallvec::SmallVec;
pub use ui::Avatar;
type MouseDownListener = Box<dyn Fn(&MouseDownEvent, &mut Window, &mut App) + 'static>;
@@ -191,10 +190,10 @@ impl RenderOnce for MessageRow {
if show_author {
match avatar {
Some(avatar) => this.child(avatar),
None => this.child(div().flex_shrink_0().w(px(32.))),
None => this.child(div().flex_shrink_0().w(px(24.))),
}
} else {
this.child(div().flex_shrink_0().w(px(32.)))
this.child(div().flex_shrink_0().w(px(24.)))
}
})
.child(
@@ -229,7 +228,7 @@ impl RenderOnce for MessageRow {
.when_some(on_double_click, |this, listener| {
this.on_double_click(listener)
})
.hover(|this| this.bg(cx.theme().accent))
.hover(|this| this.bg(cx.theme().list_hover))
.into_any_element()
}
}
+2 -1
View File
@@ -61,6 +61,7 @@ pub(crate) fn render(
.avatar(
Avatar::new(author.avatar())
.seed(author.avatar_seed())
.small()
.flex_shrink_0(),
)
.author(author.name())
@@ -218,7 +219,7 @@ pub(crate) fn render_activity(
.gap_2()
.py_1()
.px_3()
.hover(|this| this.bg(cx.theme().primary))
.hover(|this| this.bg(cx.theme().list_hover))
.child(badge(activity, cx))
.when(!hide_avatar, |this| {
this.child(
+45
View File
@@ -0,0 +1,45 @@
use gpui::SharedString;
use gpui_kit::assets::IconNamed;
/// Coop icons kept from before the gpui-kit migration; absent from the kit bundle.
#[derive(Clone, Copy)]
pub enum IconName {
ArrowDownCircle,
ArrowLeft,
Book,
CaretDown,
CaretRight,
Compass,
Door,
Group,
Invite,
Message,
PlusChat,
Profile,
Relay,
Search,
Settings,
}
impl IconNamed for IconName {
fn path(self) -> SharedString {
match self {
Self::ArrowDownCircle => "icons/arrow-down-circle.svg",
Self::ArrowLeft => "icons/arrow-left.svg",
Self::Book => "icons/book.svg",
Self::CaretDown => "icons/caret-down.svg",
Self::CaretRight => "icons/caret-right.svg",
Self::Compass => "icons/compass.svg",
Self::Door => "icons/door.svg",
Self::Group => "icons/group.svg",
Self::Invite => "icons/invite.svg",
Self::Message => "icons/message.svg",
Self::PlusChat => "icons/plus-chat.svg",
Self::Profile => "icons/profile.svg",
Self::Relay => "icons/relay.svg",
Self::Search => "icons/search.svg",
Self::Settings => "icons/settings.svg",
}
.into()
}
}
+2
View File
@@ -1,5 +1,7 @@
pub use avatar::Avatar;
pub use icon::IconName;
pub use window_drag::title_bar_drag_handlers;
pub mod avatar;
pub mod icon;
pub mod window_drag;
+8 -6
View File
@@ -231,7 +231,7 @@ impl GreeterPanel {
.gap_2()
.rounded(cx.theme().radius)
.cursor_pointer()
.hover(|this| this.bg(cx.theme().primary))
.hover(|this| this.bg(cx.theme().list_hover))
.on_click({
let room = room.clone();
let dock = dock.clone();
@@ -312,8 +312,9 @@ impl GreeterPanel {
)
.child(
v_flex()
.p_2()
.rounded(cx.theme().radius)
.px_2()
.py_1()
.rounded(cx.theme().radius_lg)
.bg(cx.theme().group_box)
.text_color(cx.theme().group_box_foreground)
.children(rows),
@@ -349,7 +350,7 @@ impl GreeterPanel {
.gap_2()
.rounded(cx.theme().radius)
.cursor_pointer()
.hover(|this| this.bg(cx.theme().primary))
.hover(|this| this.bg(cx.theme().list_hover))
.on_click({
let room = room.clone();
let dock = dock.clone();
@@ -430,8 +431,9 @@ impl GreeterPanel {
)
.child(
v_flex()
.p_2()
.rounded(cx.theme().radius)
.px_2()
.py_1()
.rounded(cx.theme().radius_lg)
.bg(cx.theme().group_box)
.text_color(cx.theme().group_box_foreground)
.children(rows),
+3 -4
View File
@@ -6,7 +6,6 @@ use gpui::{
AnyElement, ClipboardItem, Context, Entity, InteractiveElement as _, IntoElement,
ParentElement, SharedString, Styled, WeakEntity, div, relative, uniform_list,
};
use gpui_kit::assets::IconName;
use gpui_kit::base::StyledExt as _;
use gpui_kit::component::button::{Button, ButtonVariants};
use gpui_kit::component::menu::{ContextMenuExt as _, PopupMenuItem};
@@ -15,7 +14,7 @@ use nip29::Group;
use nostr_sdk::prelude::*;
use settings::AppSettings;
use state::NostrRegistry;
use ui::Avatar;
use ui::{Avatar, IconName};
use super::Sidebar;
use crate::dialogs::profile;
@@ -235,9 +234,9 @@ impl Sidebar {
GroupSection::Members => self.members_open,
};
let icon = if open {
IconName::ChevronDown
IconName::CaretDown
} else {
IconName::ChevronRight
IconName::CaretRight
};
let label = section.label();
+24 -37
View File
@@ -4,8 +4,6 @@ use gpui::{
AnyElement, App, Context, Div, Entity, InteractiveElement, IntoElement, ParentElement,
Stateful, Styled, Window, div, px,
};
use gpui_kit::assets::IconName;
use gpui_kit::base::StyledExt as _;
use gpui_kit::component::button::{Button, ButtonVariant, ButtonVariants};
use gpui_kit::component::dialog::DialogButtonProps;
use gpui_kit::component::menu::{DropdownMenu, PopupMenuItem};
@@ -14,7 +12,7 @@ use gpui_kit::component::{
};
use nostr_sdk::prelude::*;
use state::NostrRegistry;
use ui::Avatar;
use ui::{Avatar, IconName};
use super::Sidebar;
use crate::Command;
@@ -30,7 +28,6 @@ impl Sidebar {
let updater = AutoUpdater::try_global(cx);
let profile = self.directory.read(cx).person(current_user, cx);
let avatar = profile.avatar();
let name = profile.name();
h_flex()
.id("sidebar-user")
@@ -46,36 +43,28 @@ impl Sidebar {
.dropdown_caret(true)
.min_w_0()
.flex_shrink_1()
.child(
h_flex()
.min_w_0()
.gap_1p5()
.child(Avatar::new(avatar).seed(profile.avatar_seed()).small())
.child(
div()
.min_w_0()
.truncate()
.text_xs()
.font_semibold()
.child(name),
),
)
.child(Avatar::new(avatar).seed(profile.avatar_seed()).small())
.dropdown_menu(move |this, _window, _cx| {
this.menu("Profile", Box::new(Command::ShowProfile))
.menu("Relays", Box::new(Command::ShowRelayList))
.separator()
.item(
PopupMenuItem::element(|_, cx| {
div().text_color(cx.theme().danger).child("Log out")
})
.on_click(|_, window, cx| {
open_logout_dialog(window, cx);
}),
)
this.menu_with_icon(
"Profile",
IconName::Profile,
Box::new(Command::ShowProfile),
)
.menu_with_icon("Relays", IconName::Relay, Box::new(Command::ShowRelayList))
.separator()
.item(
PopupMenuItem::element(|_, cx| {
div().text_color(cx.theme().danger).child("Log out")
})
.on_click(|_, window, cx| {
open_logout_dialog(window, cx);
}),
)
}),
)
.child(
h_flex()
.gap_1()
.when_some(updater, |this, updater| {
this.child(self.render_updater(updater, cx))
})
@@ -86,34 +75,32 @@ impl Sidebar {
.selected(self.search_open)
.ghost()
.small()
.flex_shrink_0()
.on_click(cx.listener(|this, _event, window, cx| {
this.toggle_search(window, cx);
})),
)
.child(
Button::new("sidebar-new")
.icon(IconName::MessageSquarePlus)
.icon(IconName::PlusChat)
.tooltip("New")
.ghost()
.small()
.flex_shrink_0()
.dropdown_menu(|menu, _window, _cx| {
menu.label("Public Group")
.menu_with_icon(
"New Group",
IconName::Users,
IconName::Group,
Box::new(Command::NewGroup),
)
.menu_with_icon(
"Join Group",
IconName::DoorOpen,
IconName::Door,
Box::new(Command::JoinGroup),
)
.separator()
.menu_with_icon(
"New Chat",
IconName::MessageSquare,
IconName::Message,
Box::new(Command::NewChat),
)
}),
@@ -150,7 +137,7 @@ impl Sidebar {
.when(!up_to_date, |this| {
this.child(
Button::new("update")
.icon(IconName::CircleArrowDown)
.icon(IconName::ArrowDownCircle)
.tooltip(status)
.small()
.ghost()
@@ -160,7 +147,7 @@ impl Sidebar {
.when(staged, |this| {
this.child(
Button::new("restart")
.icon(IconName::CircleArrowDown)
.icon(IconName::ArrowDownCircle)
.tooltip("Quit and relaunch into the installed update")
.small()
.ghost()
+3 -6
View File
@@ -5,11 +5,11 @@ use gpui::prelude::FluentBuilder;
use gpui::{
AnyElement, App, Context, IntoElement, ParentElement, SharedString, Styled, div, uniform_list,
};
use gpui_kit::assets::IconName;
use gpui_kit::base::StyledExt as _;
use gpui_kit::component::{ActiveTheme, Icon, Sizable, h_flex, v_flex};
use nip29::GroupsRegistry;
use settings::AppSettings;
use ui::IconName;
use super::Sidebar;
use super::rows::SidebarRow;
@@ -46,10 +46,7 @@ impl Sidebar {
let (list_id, title) = if contacts_open {
("sidebar-contacts", Some(("Contacts", IconName::Book)))
} else if requests_open {
(
"sidebar-requests",
Some(("Requests", IconName::UserRoundPlus)),
)
("sidebar-requests", Some(("Requests", IconName::Invite)))
} else {
("sidebar-list", None)
};
@@ -80,7 +77,7 @@ impl Sidebar {
)
.child(
Nav::new("reqs")
.prefix(Icon::new(IconName::UserRoundPlus).small())
.prefix(Icon::new(IconName::Invite).small())
.label("Requests")
.text_sm()
.when(request_count > 0, |this| {
+5 -10
View File
@@ -1,8 +1,8 @@
use gpui_kit::component::button::{Button, ButtonCustomVariant, ButtonVariants};
use gpui_kit::component::{Sizable, v_flex};
use std::time::{SystemTime, UNIX_EPOCH};
use gpui::{AnyElement, App, IntoElement, ParentElement, SharedString, Styled, Window, img};
use gpui_kit::component::button::{Button, ButtonVariants};
use gpui_kit::component::{Sizable, v_flex};
use crate::dialogs::import;
@@ -16,11 +16,12 @@ pub(super) fn pick_banner() -> SharedString {
.map(|elapsed| elapsed.subsec_nanos())
.unwrap_or_default();
let index = nanos as usize % SIGNED_OUT_BANNERS.len();
SIGNED_OUT_BANNERS[index].into()
}
/// The headline and identity import shown while signed out.
pub(super) fn render_signed_out(_window: &mut Window, cx: &mut App) -> AnyElement {
pub(super) fn render_signed_out(_window: &mut Window, _cx: &mut App) -> AnyElement {
v_flex()
.size_full()
.justify_end()
@@ -30,13 +31,7 @@ pub(super) fn render_signed_out(_window: &mut Window, cx: &mut App) -> AnyElemen
.child(
Button::new("import")
.label("Import Identity")
.custom(
ButtonCustomVariant::new(cx)
.color(gpui::white())
.foreground(gpui::black())
.hover(gpui::white().opacity(0.9))
.active(gpui::white().opacity(0.8)),
)
.primary()
.large()
.on_click(|_, window, cx| {
import::open(window, cx);
+3 -4
View File
@@ -7,7 +7,6 @@ use gpui::{
AnyElement, App, Context, Entity, InteractiveElement as _, IntoElement, ParentElement,
SharedString, Styled, WeakEntity, Window, div, px,
};
use gpui_kit::assets::IconName;
use gpui_kit::base::StyledExt as _;
use gpui_kit::component::dialog::DialogButtonProps;
use gpui_kit::component::dock::{ClosePanel, DockArea, DockPlacement, PanelHandle};
@@ -16,7 +15,7 @@ use gpui_kit::component::{ActiveTheme, Icon, Selectable, Sizable, WindowExt, h_f
use nip29::Group;
use nostr_sdk::prelude::*;
use settings::AppSettings;
use ui::Avatar;
use ui::{Avatar, IconName};
use super::Sidebar;
use super::list::ListSection;
@@ -112,9 +111,9 @@ impl Sidebar {
};
let icon = if open {
IconName::ChevronDown
IconName::CaretDown
} else {
IconName::ChevronRight
IconName::CaretRight
};
Nav::new(label)