This commit is contained in:
2026-10-22 05:18:35 +07:00
parent 14b66d530c
commit b560ea4116
24 changed files with 87 additions and 88 deletions
+4 -3
View File
@@ -16,6 +16,7 @@ use gpui::{
retain_all, svg, white,
};
use gpui_kit::assets::IconName;
use gpui_kit::base::StyledExt as _;
use gpui_kit::component::button::{Button, ButtonVariants};
use gpui_kit::component::dock::{Panel, PanelEvent};
use gpui_kit::component::input::{Input, InputEvent, InputState, Textarea, TextareaState};
@@ -1295,7 +1296,7 @@ impl ChatPanel {
.child(
h_flex()
.gap_1()
.font_weight(gpui::FontWeight::SEMIBOLD)
.font_semibold()
.child(Avatar::new(avatar).seed(profile.avatar_seed()).small())
.child(name.clone()),
),
@@ -1334,7 +1335,7 @@ impl ChatPanel {
.child(
div()
.text_xs()
.font_weight(gpui::FontWeight::SEMIBOLD)
.font_semibold()
.line_height(relative(1.25))
.child(SharedString::from(url.to_string())),
)
@@ -1364,7 +1365,7 @@ impl ChatPanel {
.child(
div()
.text_xs()
.font_weight(gpui::FontWeight::SEMIBOLD)
.font_semibold()
.line_height(relative(1.25))
.child(SharedString::from(url.0.to_string())),
)
+2 -6
View File
@@ -211,11 +211,7 @@ impl RenderOnce for MessageRow {
.text_xs()
.text_color(cx.theme().muted_foreground)
.when_some(author, |this, author| {
this.child(
div()
.font_weight(gpui::FontWeight::SEMIBOLD)
.child(author),
)
this.child(div().font_semibold().child(author))
})
.when_some(timestamp, |this, timestamp| {
this.child(timestamp)
@@ -299,7 +295,7 @@ impl RenderOnce for ReplyPreview {
.border_color(cx.theme().list_active)
.text_xs()
.refine_style(&style)
.child(div().font_weight(gpui::FontWeight::SEMIBOLD).child(author))
.child(div().font_semibold().child(author))
.child(div().w_full().text_ellipsis().line_clamp(1).child(preview))
.hover(|this| this.bg(cx.theme().secondary))
.when_some(on_click, |this, on_click| this.on_click(on_click))
+3 -2
View File
@@ -2,6 +2,7 @@ use gpui::{
AnyElement, App, IntoElement, ParentElement, SharedString, Styled, WeakEntity, Window, div, px,
relative,
};
use gpui_kit::base::StyledExt as _;
use gpui_kit::component::{ActiveTheme, Sizable, WindowExt, h_flex, v_flex};
use nip29::{Group, GroupMetadata};
use ui::Avatar;
@@ -137,7 +138,7 @@ fn header(group: &Group, cx: &App) -> AnyElement {
.child(
div()
.text_sm()
.font_weight(gpui::FontWeight::SEMIBOLD)
.font_semibold()
.truncate()
.child(group.display_name()),
)
@@ -162,7 +163,7 @@ fn section(label: &'static str, content: AnyElement, cx: &App) -> AnyElement {
.child(
div()
.text_xs()
.font_weight(gpui::FontWeight::MEDIUM)
.font_medium()
.text_color(cx.theme().muted_foreground)
.child(label),
)
+2 -1
View File
@@ -11,6 +11,7 @@ use gpui::{
list, 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::dock::{Panel, PanelEvent};
@@ -1126,7 +1127,7 @@ impl GroupPanel {
.flex_shrink_0()
.max_w(px(140.))
.truncate()
.font_weight(gpui::FontWeight::SEMIBOLD)
.font_semibold()
.text_color(cx.theme().foreground)
.child(author),
)
+2 -1
View File
@@ -7,6 +7,7 @@ use gpui::{
WeakEntity, div,
};
use gpui_kit::assets::IconName;
use gpui_kit::base::StyledExt as _;
use gpui_kit::component::menu::{ContextMenuExt as _, PopupMenu, PopupMenuItem};
use gpui_kit::component::{ActiveTheme, Icon, Sizable, h_flex};
use nip29::{Activity, Group, Reaction};
@@ -232,7 +233,7 @@ pub(crate) fn render_activity(
.min_w_0()
.truncate()
.text_xs()
.font_weight(gpui::FontWeight::SEMIBOLD)
.font_semibold()
.child(subject.name()),
)
.child(
+3 -2
View File
@@ -10,6 +10,7 @@ use gpui::{
App, AppContext, Context, Entity, EventEmitter, Global, IntoElement, ParentElement,
SharedString, Styled, Subscription, Task, Window, div, relative,
};
use gpui_kit::base::StyledExt as _;
use gpui_kit::component::button::Button;
use gpui_kit::component::notification::{Notification, NotificationType};
use gpui_kit::component::{ActiveTheme, Disableable, Sizable, WindowExt, h_flex, v_flex};
@@ -743,7 +744,7 @@ impl DeviceRegistry {
.text_xs()
.child(
div()
.font_weight(gpui::FontWeight::SEMIBOLD)
.font_semibold()
.text_xs()
.text_color(cx.theme().muted_foreground)
.child(SharedString::from("From:")),
@@ -773,7 +774,7 @@ impl DeviceRegistry {
.text_xs()
.child(
div()
.font_weight(gpui::FontWeight::SEMIBOLD)
.font_semibold()
.text_xs()
.text_color(cx.theme().muted_foreground)
.child(SharedString::from("Code:")),
@@ -60,7 +60,6 @@ pub fn open(window: &mut Window, cx: &mut App) {
.icon(IconName::ArrowRight)
.label("Join")
.primary()
.font_weight(gpui::FontWeight::SEMIBOLD)
.on_click({
let join = join.clone();
move |event, window, cx| {
-1
View File
@@ -450,7 +450,6 @@ impl Render for NewChat {
.icon(IconName::ArrowRight)
.label("Start")
.primary()
.font_weight(gpui::FontWeight::SEMIBOLD)
.on_click(cx.listener(move |this, _event, window, cx| {
if this.start_chat(window, cx) {
window.close_dialog(cx);
+2 -2
View File
@@ -7,6 +7,7 @@ use gpui::{
};
use gpui_base::{Popup, Select};
use gpui_kit::assets::IconName;
use gpui_kit::base::StyledExt as _;
use gpui_kit::component::button::{Button, ButtonVariants};
use gpui_kit::component::dock::{DockArea, DockPlacement, PanelHandle};
use gpui_kit::component::form::field;
@@ -641,7 +642,6 @@ impl Render for NewGroup {
"Create Group"
})
.primary()
.font_weight(gpui::FontWeight::SEMIBOLD)
.loading(self.creating)
.disabled(self.creating || self.uploading)
.on_click(cx.listener(|this, _event, _window, cx| this.create(cx))),
@@ -658,7 +658,7 @@ fn field_label(text: &'static str, cx: &App) -> Div {
div()
.text_xs()
.text_color(cx.theme().muted_foreground)
.font_weight(gpui::FontWeight::SEMIBOLD)
.font_semibold()
.child(text)
}
+2 -4
View File
@@ -8,6 +8,7 @@ use gpui::{
PathPromptOptions, Render, SharedString, Styled, Task, Window, div, retain_all,
};
use gpui_kit::assets::IconName;
use gpui_kit::base::StyledExt as _;
use gpui_kit::component::button::{Button, ButtonVariants};
use gpui_kit::component::dock::DockPlacement;
use gpui_kit::component::input::{Input, InputState, Textarea, TextareaState};
@@ -486,7 +487,6 @@ impl Render for ProfileDialog {
.icon(IconName::SquarePen)
.label("Update")
.primary()
.font_weight(gpui::FontWeight::SEMIBOLD)
.on_click(cx.listener(move |this, _ev, window, cx| {
this.toggle_edit(window, cx);
})),
@@ -498,7 +498,6 @@ impl Render for ProfileDialog {
.icon(IconName::MessageSquare)
.label("Message")
.primary()
.font_weight(gpui::FontWeight::SEMIBOLD)
.on_click(cx.listener(move |this, _ev, window, cx| {
this.message(window, cx);
})),
@@ -519,7 +518,6 @@ impl Render for ProfileDialog {
.icon(IconName::CircleCheck)
.label("Save")
.primary()
.font_weight(gpui::FontWeight::SEMIBOLD)
.loading(self.updating)
.disabled(self.updating)
.on_click(cx.listener(move |this, _ev, window, cx| {
@@ -535,7 +533,7 @@ fn label(label: &'static str, cx: &App) -> Div {
div()
.text_xs()
.text_color(cx.theme().muted_foreground)
.font_weight(gpui::FontWeight::SEMIBOLD)
.font_semibold()
.child(label)
}
-1
View File
@@ -286,7 +286,6 @@ impl RelayManager {
.icon(IconName::ArrowRight)
.label("Update")
.primary()
.font_weight(gpui::FontWeight::SEMIBOLD)
.loading(updating)
.disabled(updating)
.on_click(cx.listener(move |this, _ev, window, cx| {
-1
View File
@@ -115,7 +115,6 @@ impl Render for RestoreEncryption {
.icon(IconName::ArrowRight)
.label("Restore")
.primary()
.font_weight(gpui::FontWeight::SEMIBOLD)
.on_click(cx.listener(move |this, _, window, cx| {
this.restore(window, cx);
})),
+2 -1
View File
@@ -8,6 +8,7 @@ use gpui::{
SharedString, Styled, Subscription, Task, Window, div, px, 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::spinner::Spinner;
use gpui_kit::component::{ActiveTheme, Disableable, Icon, Sizable, WindowExt, h_flex, v_flex};
@@ -376,7 +377,7 @@ impl Render for Screening {
)
.child(
div()
.font_weight(gpui::FontWeight::SEMIBOLD)
.font_semibold()
.line_height(relative(1.25))
.child(profile.name()),
),
+4 -7
View File
@@ -1,5 +1,6 @@
use std::sync::Arc;
use ::settings::{AppSettings, AppearanceMode};
use anyhow::Error;
use auto_update::AutoUpdater;
use chat::{ChatEvent, ChatRegistry};
@@ -11,7 +12,7 @@ use gpui::{
use gpui_kit::component::button::Button;
use gpui_kit::component::dock::{DockArea, DockLayout, DockPlacement, Panel, PanelHandle};
use gpui_kit::component::notification::{Notification, NotificationType};
use gpui_kit::component::{ActiveTheme, WindowExt, v_flex};
use gpui_kit::component::{ActiveTheme, Theme, WindowExt, v_flex};
use nip4e::{DeviceEvent, DeviceRegistry};
use nip29::{GroupId, GroupKey};
use nostr_sdk::prelude::*;
@@ -88,13 +89,9 @@ impl Workspace {
let workspace = cx.entity().downgrade();
let mut subscriptions = smallvec![];
// Follow OS appearance changes only when the user has not pinned a
// mode; the native-theme watcher drives runtime changes either way.
// The `::settings` path is the external crate; the crate-local
// `settings` module is the preferences dialog.
if ::settings::AppSettings::get_appearance_mode(cx) == ::settings::AppearanceMode::System {
if AppSettings::get_appearance_mode(cx) == AppearanceMode::System {
subscriptions.push(cx.observe_window_appearance(window, |_this, window, cx| {
gpui_kit::component::Theme::sync_system_appearance(Some(window), cx);
Theme::sync_system_appearance(Some(window), cx);
}));
}
+3 -3
View File
@@ -4,6 +4,7 @@ use gpui::{
IntoElement, ParentElement, Render, SharedString, Styled, Task, Window, div,
};
use gpui_kit::assets::IconName;
use gpui_kit::base::StyledExt as _;
use gpui_kit::component::button::{Button, ButtonVariants};
use gpui_kit::component::dock::{Panel, PanelEvent};
use gpui_kit::component::input::{Input, InputState};
@@ -153,7 +154,7 @@ impl Render for BackupPanel {
.child(
div()
.text_xs()
.font_weight(gpui::FontWeight::SEMIBOLD)
.font_semibold()
.text_color(cx.theme().muted_foreground)
.child(SharedString::from("Public Key:")),
)
@@ -166,7 +167,7 @@ impl Render for BackupPanel {
.child(
div()
.text_xs()
.font_weight(gpui::FontWeight::SEMIBOLD)
.font_semibold()
.text_color(cx.theme().muted_foreground)
.child(SharedString::from("Secret Key:")),
)
@@ -184,7 +185,6 @@ impl Render for BackupPanel {
})
.primary()
.small()
.font_weight(gpui::FontWeight::SEMIBOLD)
.on_click(cx.listener(move |this, _ev, _window, cx| {
this.copy_secret(cx);
})),
+3 -2
View File
@@ -10,6 +10,7 @@ use gpui::{
};
use gpui_base::{VirtualListScrollHandle, v_virtual_list};
use gpui_kit::assets::IconName;
use gpui_kit::base::StyledExt as _;
use gpui_kit::component::button::{Button, ButtonVariants};
use gpui_kit::component::dock::{DockArea, DockPlacement, Panel, PanelEvent, PanelHandle};
use gpui_kit::component::input::{Input, InputEvent, InputState};
@@ -269,7 +270,7 @@ impl BrowsePanel {
.child(
div()
.text_xs()
.font_weight(gpui::FontWeight::SEMIBOLD)
.font_semibold()
.line_height(relative(1.2))
.child("Public Groups"),
)
@@ -402,7 +403,7 @@ impl BrowsePanel {
div()
.text_xs()
.truncate()
.font_weight(gpui::FontWeight::SEMIBOLD)
.font_semibold()
.line_height(relative(1.2))
.child(name),
)
+2 -2
View File
@@ -8,6 +8,7 @@ use gpui::{
Window, div, rems, retain_all,
};
use gpui_kit::assets::IconName;
use gpui_kit::base::StyledExt as _;
use gpui_kit::component::button::{Button, ButtonVariants};
use gpui_kit::component::dock::{Panel, PanelEvent};
use gpui_kit::component::input::{Input, InputEvent, InputState};
@@ -325,7 +326,7 @@ impl Render for ContactListPanel {
.child(
div()
.text_xs()
.font_weight(gpui::FontWeight::SEMIBOLD)
.font_semibold()
.text_color(cx.theme().muted_foreground)
.child("New contact:"),
)
@@ -376,7 +377,6 @@ impl Render for ContactListPanel {
.icon(IconName::CircleCheck)
.label("Update")
.primary()
.font_weight(gpui::FontWeight::SEMIBOLD)
.loading(self.updating)
.disabled(self.updating)
.on_click(cx.listener(move |this, _ev, window, cx| {
+2 -1
View File
@@ -10,6 +10,7 @@ use gpui::{
StatefulInteractiveElement, Styled, Subscription, Task, WeakEntity, Window, div, svg,
};
use gpui_kit::assets::IconName;
use gpui_kit::base::StyledExt as _;
use gpui_kit::component::button::{Button, ButtonVariants};
use gpui_kit::component::dock::{DockArea, DockPlacement, Panel, PanelEvent, PanelHandle};
use gpui_kit::component::group_box::{GroupBox, GroupBoxVariants};
@@ -424,7 +425,7 @@ impl GreeterPanel {
div()
.text_color(cx.theme().muted_foreground)
.text_xs()
.font_weight(gpui::FontWeight::SEMIBOLD)
.font_semibold()
.child("Find new friends"),
)
.child(
+3 -3
View File
@@ -165,7 +165,7 @@ impl Sidebar {
.text_xs()
.truncate()
.line_height(relative(1.2))
.font_weight(gpui::FontWeight::SEMIBOLD)
.font_semibold()
.child(name),
)
.child(
@@ -250,7 +250,7 @@ impl Sidebar {
.text_color(cx.theme().muted_foreground),
)
.text_xs()
.font_weight(gpui::FontWeight::SEMIBOLD)
.font_semibold()
.text_color(cx.theme().muted_foreground)
.on_click(cx.listener(move |this, _event, _window, cx| {
match section {
@@ -286,7 +286,7 @@ impl Sidebar {
let nav = Nav::new(public_key.to_hex())
.label(person.name())
.text_xs()
.font_weight(gpui::FontWeight::MEDIUM)
.font_medium()
.clickable(true)
.when(!hide_avatar, |this| {
this.prefix(
+2 -1
View File
@@ -4,6 +4,7 @@ use gpui::{
AnyElement, App, AppContext, Context, IntoElement, ParentElement, SharedString, Styled, Task,
Window, div,
};
use gpui_kit::base::StyledExt as _;
use gpui_kit::component::button::{Button, ButtonVariants};
use gpui_kit::component::dock::{DockPlacement, PanelHandle};
use gpui_kit::component::notification::Notification;
@@ -215,7 +216,7 @@ impl Sidebar {
.child("Selected")
.child(
div()
.font_weight(gpui::FontWeight::SEMIBOLD)
.font_semibold()
.child(SharedString::from(self.selected_contacts.len().to_string())),
),
)
+8 -6
View File
@@ -8,7 +8,7 @@ use gpui::{
use gpui_kit::assets::IconName;
use gpui_kit::base::StyledExt as _;
use gpui_kit::component::scroll::Scrollbar;
use gpui_kit::component::{ActiveTheme, Icon, Sizable, h_flex, v_flex};
use gpui_kit::component::{ActiveTheme, Icon, h_flex, v_flex};
use nip29::GroupsRegistry;
use settings::AppSettings;
@@ -65,19 +65,20 @@ impl Sidebar {
.child(
v_flex()
.px_2()
.gap_1()
.child(
Nav::new("browse")
.prefix(Icon::new(IconName::Compass).small())
.prefix(Icon::new(IconName::Compass))
.label("Browse")
.text_sm()
.on_click(|_, window, cx| {
window.dispatch_action(Box::new(Command::ShowBrowse), cx)
}),
)
.child(
Nav::new("reqs")
.prefix(Icon::new(IconName::UserRoundPlus).small())
.prefix(Icon::new(IconName::UserRoundPlus))
.label("Requests")
.text_sm()
.when(request_count > 0, |this| {
this.suffix(
h_flex()
@@ -116,8 +117,9 @@ impl Sidebar {
)
.child(
Nav::new("contacts")
.prefix(Icon::new(IconName::Book).small())
.prefix(Icon::new(IconName::Book))
.label("Contacts")
.text_sm()
.when(contacts_open, |this| this.bg(cx.theme().list_active))
.on_click(cx.listener(|this, _event, window, cx| {
this.toggle_contacts(window, cx);
@@ -129,7 +131,7 @@ impl Sidebar {
div()
.px_4()
.text_xs()
.font_weight(gpui::FontWeight::SEMIBOLD)
.font_semibold()
.text_color(cx.theme().muted_foreground)
.child(list_title),
)
+2 -1
View File
@@ -9,6 +9,7 @@ use gpui::{
IntoElement, ObjectFit, ParentElement, Render, SharedString, Styled, StyledImage, Subscription,
Task, UniformListScrollHandle, WeakEntity, Window, div, img, retain_all,
};
use gpui_kit::base::StyledExt as _;
use gpui_kit::component::dock::{DockArea, Panel, PanelEvent};
use gpui_kit::component::input::{InputEvent, InputState};
use gpui_kit::component::notification::Notification;
@@ -367,7 +368,7 @@ impl Render for Sidebar {
.when(cx.theme().shadow, |this| this.shadow_md())
.rounded_full()
.text_xs()
.font_weight(gpui::FontWeight::SEMIBOLD)
.font_semibold()
.text_color(cx.theme().muted_foreground)
.child(Spinner::new().small().color(cx.theme().primary))
.child("Getting messages..."),
@@ -38,7 +38,6 @@ pub(super) fn render_signed_out(_window: &mut Window, cx: &mut App) -> AnyElemen
.active(gpui::white().opacity(0.8)),
)
.large()
.font_weight(gpui::FontWeight::SEMIBOLD)
.on_click(|_, window, cx| {
import::open(window, cx);
}),
+36 -35
View File
@@ -8,6 +8,7 @@ use gpui::{
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};
use gpui_kit::component::menu::{ContextMenuExt as _, PopupMenuItem};
@@ -59,6 +60,30 @@ pub(crate) fn open_room(
}
}
/// A row shown in the sidebar's lists.
pub(super) enum SidebarRow {
Section(ListSection),
Room {
room: Entity<Room>,
},
Group {
group: Entity<Group>,
},
Contact {
public_key: PublicKey,
},
/// A profile found by global search.
Profile {
public_key: PublicKey,
},
Message {
hit: MessageHit,
},
/// A non-interactive label, such as a search results section.
Heading(&'static str),
Empty(&'static str),
}
impl Sidebar {
pub(super) fn render_rows(
&self,
@@ -100,7 +125,7 @@ impl Sidebar {
.text_color(cx.theme().muted_foreground),
)
.text_xs()
.font_weight(gpui::FontWeight::SEMIBOLD)
.font_semibold()
.text_color(cx.theme().muted_foreground)
.on_click(cx.listener(move |this, _event, _window, cx| {
match section {
@@ -122,7 +147,7 @@ impl Sidebar {
Nav::new(label)
.label(label)
.text_xs()
.font_weight(gpui::FontWeight::SEMIBOLD)
.font_semibold()
.text_color(cx.theme().muted_foreground)
.into_any_element()
}
@@ -160,7 +185,7 @@ impl Sidebar {
let nav = Nav::new(index)
.label(name)
.text_xs()
.text_sm()
.when(!hide_avatar, |this| {
this.prefix(
Avatar::new(room.read(cx).display_image(cx))
@@ -185,7 +210,7 @@ impl Sidebar {
.when(!spam, |this| {
this.child(
div()
.font_weight(gpui::FontWeight::NORMAL)
.font_normal()
.text_xs()
.text_color(cx.theme().muted_foreground)
.child(created_at),
@@ -230,7 +255,7 @@ impl Sidebar {
Nav::new(index)
.label(person.name())
.text_xs()
.text_sm()
.when(!hide_avatar, |this| {
this.prefix(
Avatar::new(person.avatar())
@@ -254,7 +279,7 @@ impl Sidebar {
Nav::new(index)
.label(person.name())
.text_xs()
.text_sm()
.when(!hide_avatar, |this| {
this.prefix(
Avatar::new(person.avatar())
@@ -287,7 +312,7 @@ impl Sidebar {
let nav = Nav::new(index)
.label(name)
.text_xs()
.text_sm()
.when(!hide_avatar, |this| {
this.prefix(
Avatar::new(group.read(cx).display_image())
@@ -298,7 +323,7 @@ impl Sidebar {
.when_some(suffix, |this, suffix| {
this.suffix(
div()
.font_weight(gpui::FontWeight::NORMAL)
.font_normal()
.text_xs()
.text_color(cx.theme().muted_foreground)
.child(suffix),
@@ -360,8 +385,8 @@ impl Sidebar {
Nav::new(index)
.label(content)
.text_xs()
.font_weight(gpui::FontWeight::MEDIUM)
.text_sm()
.font_medium()
.when(!hide_avatar, |this| {
this.prefix(
Avatar::new(person.avatar())
@@ -371,7 +396,7 @@ impl Sidebar {
})
.suffix(
div()
.font_weight(gpui::FontWeight::NORMAL)
.font_normal()
.text_xs()
.text_color(cx.theme().muted_foreground)
.child(detail),
@@ -386,27 +411,3 @@ impl Sidebar {
.collect()
}
}
/// A row shown in the sidebar's lists.
pub(super) enum SidebarRow {
Section(ListSection),
Room {
room: Entity<Room>,
},
Group {
group: Entity<Group>,
},
Contact {
public_key: PublicKey,
},
/// A profile found by global search.
Profile {
public_key: PublicKey,
},
Message {
hit: MessageHit,
},
/// A non-interactive label, such as a search results section.
Heading(&'static str),
Empty(&'static str),
}