migrate icons to gpui-native-kit

This commit is contained in:
2026-11-10 04:11:42 +07:00
parent 8e8ceaf2db
commit 48d16bb33e
35 changed files with 224 additions and 114 deletions
Generated
+6 -1
View File
@@ -382,7 +382,7 @@ name = "assets"
version = "2.0.0-alpha3"
dependencies = [
"anyhow",
"gpui-kit",
"gpui-native-kit",
"gpui-pre",
"rust-embed",
]
@@ -1459,6 +1459,7 @@ dependencies = [
"chat",
"common",
"gpui-kit",
"gpui-native-kit",
"gpui-pre",
"instant",
"itertools 0.13.0",
@@ -6128,6 +6129,7 @@ dependencies = [
"chat_ui",
"common",
"gpui-kit",
"gpui-native-kit",
"gpui-pre",
"instant",
"log",
@@ -6149,6 +6151,7 @@ dependencies = [
"anyhow",
"flume 0.11.1",
"gpui-kit",
"gpui-native-kit",
"gpui-pre",
"log",
"nostr-sdk",
@@ -6190,6 +6193,7 @@ dependencies = [
"anyhow",
"common",
"gpui-kit",
"gpui-native-kit",
"gpui-pre",
"nip60",
"nostr-sdk",
@@ -10498,6 +10502,7 @@ dependencies = [
"common",
"gpui-base",
"gpui-kit",
"gpui-native-kit",
"gpui-pre",
"log",
"nostr-sdk",
+16
View File
@@ -0,0 +1,16 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M13.744 17.736a6 6 0 1 1-7.48-7.48" />
<path d="M15 6h1v4" />
<path d="m6.134 14.768.866-.5 2 3.464" />
<circle cx="16" cy="8" r="6" />
</svg>

After

Width:  |  Height:  |  Size: 361 B

+1 -1
View File
@@ -8,7 +8,7 @@ publish.workspace = true
gpui.workspace = true
anyhow.workspace = true
rust-embed.workspace = true
gpui-kit.workspace = true
gpui-native-kit.workspace = true
# On wasm there is no filesystem to read from, so rust-embed's debug-mode
# disk loading returns nothing; embed the assets even in debug builds.
+8 -16
View File
@@ -1,4 +1,5 @@
use gpui::{AssetSource, Result, SharedString};
use gpui_native_kit::icons::IconAssets;
use rust_embed::RustEmbed;
/// The Lucide icons the app and the kit components draw, vendored so they ship
@@ -11,8 +12,7 @@ use rust_embed::RustEmbed;
#[exclude = "*.DS_Store"]
pub struct Assets;
/// Coop's bundled assets, with the GPUI Kit component icon bundle as the
/// fallback for any icon not vendored here.
/// Coop's bundled assets, with the native kit's icon bundle.
pub struct CombinedAssets;
impl AssetSource for CombinedAssets {
@@ -23,17 +23,13 @@ impl AssetSource for CombinedAssets {
#[cfg(target_arch = "wasm32")]
{
// The kit bundle fetches icons over HTTP on the web; a single
// instance keeps its download cache alive across loads.
use std::sync::OnceLock;
static KIT_ASSETS: OnceLock<gpui_kit::assets::Assets> = OnceLock::new();
KIT_ASSETS
.get_or_init(gpui_kit::assets::Assets::default)
.load(path)
static KIT_ASSETS: OnceLock<IconAssets> = OnceLock::new();
KIT_ASSETS.get_or_init(|| IconAssets).load(path)
}
#[cfg(not(target_arch = "wasm32"))]
gpui_kit::assets::Assets.load(path)
IconAssets.load(path)
}
fn list(&self, path: &str) -> Result<Vec<SharedString>> {
@@ -42,16 +38,12 @@ impl AssetSource for CombinedAssets {
#[cfg(target_arch = "wasm32")]
{
use std::sync::OnceLock;
static KIT_ASSETS: OnceLock<gpui_kit::assets::Assets> = OnceLock::new();
paths.extend(
KIT_ASSETS
.get_or_init(gpui_kit::assets::Assets::default)
.list(path)?,
);
static KIT_ASSETS: OnceLock<IconAssets> = OnceLock::new();
paths.extend(KIT_ASSETS.get_or_init(|| IconAssets).list(path)?);
}
#[cfg(not(target_arch = "wasm32"))]
paths.extend(gpui_kit::assets::Assets.list(path)?);
paths.extend(IconAssets.list(path)?);
Ok(paths)
}
+1
View File
@@ -9,6 +9,7 @@ state = { path = "../state" }
speech = { path = "../speech" }
ui = { path = "../ui" }
gpui-kit = { workspace = true, features = ["speech"] }
gpui-native-kit.workspace = true
common = { path = "../common" }
person = { path = "../person" }
chat = { path = "../chat" }
+11 -6
View File
@@ -23,7 +23,8 @@ use gpui_kit::component::notification::Notification;
use gpui_kit::component::scroll::Scrollbar;
use gpui_kit::component::speech::{SpeechButton, SpeechEvent, SpeechState, SpeechWaveform};
use gpui_kit::component::tooltip::Tooltip;
use gpui_kit::component::{ActiveTheme, Disableable, Icon, Sizable, WindowExt, h_flex, v_flex};
use gpui_kit::component::{ActiveTheme, Disableable, Sizable, WindowExt, h_flex, v_flex};
use gpui_native_kit::icons::Icon;
use itertools::Itertools;
use nostr_sdk::prelude::*;
use person::{Directory, Person};
@@ -1126,7 +1127,7 @@ impl ChatPanel {
.rounded_full()
.bg(cx.theme().warning.opacity(0.15))
.text_color(cx.theme().warning)
.child(Icon::new(IconName::Warning).small()),
.child(Icon::named(IconName::Warning).size(ui::small_icon_size(cx))),
)
.child(
div()
@@ -1575,7 +1576,7 @@ impl ChatPanel {
.justify_center()
.rounded_full()
.bg(red())
.child(Icon::new(IconName::Close).size_2().text_color(white())),
.child(Icon::named(IconName::Close).size(px(8.)).color(white())),
)
.on_click({
let url = url.clone();
@@ -1655,7 +1656,7 @@ impl ChatPanel {
.border_1()
.border_color(cx.theme().border)
.rounded(cx.theme().radius)
.child(Icon::new(IconName::Lock).text_color(cx.theme().primary))
.child(Icon::named(IconName::Lock).color(cx.theme().primary))
.child(
v_flex()
.min_w_0()
@@ -1728,7 +1729,11 @@ impl ChatPanel {
.border_1()
.border_color(cx.theme().border)
.bg(gpui::green())
.child(Icon::new(IconName::Lock).size_2().text_color(gpui::white())),
.child(
Icon::named(IconName::Lock)
.size(px(8.))
.color(gpui::white()),
),
)
.on_click({
let url = file.url.clone();
@@ -2050,7 +2055,7 @@ impl Render for ChatPanel {
.when(cfg!(not(target_arch = "wasm32")), |this| {
this.child(
Button::new("nutzap")
.icon(gpui_kit::assets::IconName::Coins)
.icon(ui::IconName::Coins)
.tooltip("Send eCash")
.disabled(dictating)
.ghost()
+1
View File
@@ -14,6 +14,7 @@ settings = { path = "../settings" }
speech = { path = "../speech" }
state = { path = "../state" }
gpui-kit = { workspace = true, features = ["speech"] }
gpui-native-kit.workspace = true
ui = { path = "../ui" }
gpui.workspace = true
+10 -10
View File
@@ -10,7 +10,6 @@ use gpui::{
ParentElement, Render, SharedString, Styled, Subscription, Task, WeakEntity, Window, div, 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;
@@ -19,7 +18,8 @@ use gpui_kit::component::input::{InputEvent, Textarea, TextareaState};
use gpui_kit::component::notification::Notification;
use gpui_kit::component::scroll::Scrollbar;
use gpui_kit::component::speech::{SpeechButton, SpeechEvent, SpeechState, SpeechWaveform};
use gpui_kit::component::{ActiveTheme, Disableable, Icon, Sizable, WindowExt, h_flex, v_flex};
use gpui_kit::component::{ActiveTheme, Disableable, Sizable, WindowExt, h_flex, v_flex};
use gpui_native_kit::icons::Icon;
use nip29::{Group, GroupEvent, GroupKey, GroupsRegistry, Membership, Pin, Row};
use nostr_sdk::prelude::*;
use person::Directory;
@@ -28,7 +28,7 @@ use settings::AppSettings;
use smallvec::{SmallVec, smallvec};
use speech::speaker::Speaker;
use state::{NostrRegistry, pick_file, upload_file};
use ui::{Avatar, RenderedText, RevealText, WelcomeMessage, rendered_text};
use ui::{Avatar, IconName, RenderedText, RevealText, WelcomeMessage, rendered_text};
use util::{attachment_name, display_name, opens_run, pin_label, report};
mod details;
@@ -783,9 +783,9 @@ impl GroupPanel {
.border_b_1()
.border_color(cx.theme().border)
.child(
Icon::new(IconName::Info)
.small()
.text_color(cx.theme().muted_foreground),
Icon::named(IconName::Info)
.size(ui::small_icon_size(cx))
.color(cx.theme().muted_foreground),
)
.child(div().flex_1().min_w_0().truncate().child(message))
.child(
@@ -820,9 +820,9 @@ impl GroupPanel {
.text_xs()
.bg(cx.theme().secondary)
.child(
Icon::new(IconName::Info)
.small()
.text_color(cx.theme().warning),
Icon::named(IconName::Info)
.size(ui::small_icon_size(cx))
.color(cx.theme().warning),
)
.child(div().flex_1().min_w_0().child(
"This group is public. Messages are not encrypted and can be read by anyone.",
@@ -1277,7 +1277,7 @@ impl GroupPanel {
.rounded(cx.theme().radius)
.text_xs()
.text_color(cx.theme().muted_foreground)
.child(Icon::new(IconName::Link).xsmall())
.child(Icon::named(IconName::Link).size(ui::dense_icon_size(cx)))
.child(
div()
.max_w(px(200.))
+5 -5
View File
@@ -5,11 +5,11 @@ use gpui::{
AnyElement, App, Entity, InteractiveElement, IntoElement, ParentElement, SharedString, Styled,
WeakEntity, div,
};
use gpui_kit::assets::IconName;
use gpui_kit::base::StyledExt as _;
use gpui_kit::component::menu::{ContextMenuExt as _, PopupMenuItem};
use gpui_kit::component::notification::Notification;
use gpui_kit::component::{ActiveTheme, Icon, Sizable, WindowExt, h_flex};
use gpui_kit::component::{ActiveTheme, Sizable, WindowExt, h_flex};
use gpui_native_kit::icons::Icon;
use nip29::{Activity, Group, Reaction};
use nostr_sdk::prelude::{EventId, Kind};
use person::Directory;
@@ -17,8 +17,8 @@ use settings::AppSettings;
use speech::speaker::END_GRACE;
use state::NostrRegistry;
use ui::{
Avatar, MessageActions, MessageMedia, MessageRow, REACTION_EMOJIS, ReactionBar, ReplyPreview,
group_reactions, react_menu,
Avatar, IconName, MessageActions, MessageMedia, MessageRow, REACTION_EMOJIS, ReactionBar,
ReplyPreview, group_reactions, react_menu,
};
use crate::GroupPanel;
@@ -274,7 +274,7 @@ fn badge(activity: &Activity, cx: &App) -> AnyElement {
.flex_shrink_0()
.justify_center()
.size_8()
.child(Icon::new(icon).small().text_color(color))
.child(Icon::named(icon).size(ui::small_icon_size(cx)).color(color))
.into_any_element()
}
+1
View File
@@ -9,6 +9,7 @@ state = { path = "../state" }
person = { path = "../person" }
ui = { path = "../ui" }
gpui-kit.workspace = true
gpui-native-kit.workspace = true
settings = { path = "../settings" }
gpui.workspace = true
+1
View File
@@ -14,6 +14,7 @@ ui = { path = "../ui" }
gpui.workspace = true
gpui-kit.workspace = true
gpui-native-kit.workspace = true
nostr-sdk.workspace = true
anyhow.workspace = true
smallvec.workspace = true
+6 -8
View File
@@ -10,22 +10,20 @@ use gpui::{
StatefulInteractiveElement as _, 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 as _};
use gpui_kit::component::dock::{Panel, PanelEvent};
use gpui_kit::component::input::{Input, InputEvent, InputState, NumberInput};
use gpui_kit::component::notification::Notification;
use gpui_kit::component::separator::Separator;
use gpui_kit::component::{
ActiveTheme, Disableable as _, Icon, Sizable, WindowExt, h_flex, v_flex,
};
use gpui_kit::component::{ActiveTheme, Disableable as _, Sizable, WindowExt, h_flex, v_flex};
use gpui_native_kit::icons::Icon;
use nostr_sdk::prelude::*;
use person::Directory;
use settings::AppSettings;
use smallvec::SmallVec;
use state::NostrRegistry;
use ui::Avatar;
use ui::{Avatar, IconName};
pub fn init(window: &mut Window, cx: &mut App) -> Entity<WalletPanel> {
cx.new(|cx| WalletPanel::new(window, cx))
@@ -743,9 +741,9 @@ impl Panel for WalletPanel {
h_flex()
.gap_1p5()
.child(
Icon::new(IconName::Wallet)
.small()
.text_color(cx.theme().muted_foreground),
Icon::named(IconName::Wallet)
.size(ui::small_icon_size(cx))
.color(cx.theme().muted_foreground),
)
.child(self.name.clone())
.into_any_element()
+1
View File
@@ -11,6 +11,7 @@ person = { path = "../person" }
gpui.workspace = true
gpui-base.workspace = true
gpui-kit.workspace = true
gpui-native-kit.workspace = true
nostr-sdk.workspace = true
web-time = "1.1"
smallvec.workspace = true
+82 -5
View File
@@ -1,38 +1,68 @@
use gpui::SharedString;
use gpui_kit::assets::IconNamed;
use gpui::{App, Pixels, SharedString};
use gpui_native_kit::icons::IconNamed;
use gpui_native_kit::theme::ActiveTheme as _;
/// Coop icons kept from before the gpui-kit migration; absent from the kit bundle.
/// The app-wide icon set: coop's vendored glyphs plus every kit glyph the app uses.
#[derive(Clone, Copy)]
pub enum IconName {
ArrowDownCircle,
ArrowLeft,
ArrowRight,
Ban,
Book,
CaretDown,
CaretRight,
Check,
CheckCircle,
ChevronDown,
CircleCheck,
CircleX,
Close,
Coins,
Compass,
Door,
Ellipsis,
Emoji,
Group,
Inbox,
Info,
Input,
Invite,
Link,
Lock,
LogIn,
LogOut,
Message,
MessageSquare,
Paperclip,
PaperPlaneFill,
PanelBottom,
PanelBottomOpen,
PanelLeft,
PanelLeftOpen,
PanelRight,
PanelRightOpen,
Plus,
PlusChat,
Profile,
Relay,
Speech,
Reply,
Search,
Settings,
Settings2,
Speech,
SquarePen,
TriangleAlert,
Unlock,
Upload,
UserRoundPlus,
Wallet,
Warning,
WindowClose,
WindowMaximize,
WindowMinimize,
WindowRestore,
X,
}
impl IconNamed for IconName {
@@ -40,34 +70,81 @@ impl IconNamed for IconName {
match self {
Self::ArrowDownCircle => "icons/arrow-down-circle.svg",
Self::ArrowLeft => "icons/arrow-left.svg",
Self::ArrowRight => "icons/arrow-right.svg",
Self::Ban => "icons/ban.svg",
Self::Book => "icons/book.svg",
Self::CaretDown => "icons/caret-down.svg",
Self::CaretRight => "icons/caret-right.svg",
Self::Check => "icons/check.svg",
Self::CheckCircle => "icons/check-circle.svg",
Self::ChevronDown => "icons/chevron-down.svg",
Self::CircleCheck => "icons/circle-check.svg",
Self::CircleX => "icons/circle-x.svg",
Self::Close => "icons/close.svg",
Self::Coins => "icons/coins.svg",
Self::Compass => "icons/compass.svg",
Self::Door => "icons/door.svg",
Self::Ellipsis => "icons/ellipsis.svg",
Self::Emoji => "icons/emoji.svg",
Self::Group => "icons/group.svg",
Self::Inbox => "icons/inbox.svg",
Self::Info => "icons/info.svg",
Self::Input => "icons/input.svg",
Self::Invite => "icons/invite.svg",
Self::Link => "icons/link.svg",
Self::Lock => "icons/lock.svg",
Self::LogIn => "icons/log-in.svg",
Self::LogOut => "icons/log-out.svg",
Self::Message => "icons/message.svg",
Self::MessageSquare => "icons/message-square.svg",
Self::Paperclip => "icons/paperclip.svg",
Self::PaperPlaneFill => "icons/paper-plane-fill.svg",
Self::PanelBottom => "icons/panel-bottom.svg",
Self::PanelBottomOpen => "icons/panel-bottom-open.svg",
Self::PanelLeft => "icons/panel-left.svg",
Self::PanelLeftOpen => "icons/panel-left-open.svg",
Self::PanelRight => "icons/panel-right.svg",
Self::PanelRightOpen => "icons/panel-right-open.svg",
Self::Plus => "icons/plus.svg",
Self::PlusChat => "icons/plus-chat.svg",
Self::Profile => "icons/profile.svg",
Self::Relay => "icons/relay.svg",
Self::Speech => "icons/speech.svg",
Self::Reply => "icons/reply.svg",
Self::Search => "icons/search.svg",
Self::Settings => "icons/settings.svg",
Self::Settings2 => "icons/settings2.svg",
Self::Speech => "icons/speech.svg",
Self::SquarePen => "icons/square-pen.svg",
Self::TriangleAlert => "icons/triangle-alert.svg",
Self::Unlock => "icons/unlock.svg",
Self::Upload => "icons/upload.svg",
Self::UserRoundPlus => "icons/user-round-plus.svg",
Self::Wallet => "icons/wallet.svg",
Self::Warning => "icons/warning.svg",
Self::WindowClose => "icons/x.svg",
Self::WindowMaximize => "icons/square.svg",
Self::WindowMinimize => "icons/minus.svg",
Self::WindowRestore => "icons/copy.svg",
Self::X => "icons/x.svg",
}
.into()
}
}
// The old kit's identical trait, so its components keep accepting coop icons
// until they are replaced in later migration steps.
impl gpui_kit::assets::IconNamed for IconName {
fn path(self) -> SharedString {
IconNamed::path(self)
}
}
/// The kit's small icon size, for icons drawn beside labels.
pub fn small_icon_size(cx: &App) -> Pixels {
cx.theme().sizes.small.icon_size
}
/// The kit's dense icon size, for icons inline with dense rows.
pub fn dense_icon_size(cx: &App) -> Pixels {
cx.theme().sizes.small.dense_icon_size
}
+1 -1
View File
@@ -1,6 +1,6 @@
pub use avatar::Avatar;
pub use form::*;
pub use icon::IconName;
pub use icon::{IconName, dense_icon_size, small_icon_size};
pub use message::*;
pub use text::*;
pub use window_drag::title_bar_drag_handlers;
+2 -1
View File
@@ -9,7 +9,6 @@ use gpui::{
ParentElement as _, RenderOnce, SharedString, SharedUri, StatefulInteractiveElement as _,
StyleRefinement, Styled, StyledImage, Window, div, img, px,
};
use gpui_kit::assets::IconName;
use gpui_kit::component::button::{Button, ButtonVariants as _};
use gpui_kit::component::clipboard::Clipboard;
use gpui_kit::component::menu::{DropdownMenu as _, PopupMenu, PopupMenuItem};
@@ -19,6 +18,8 @@ use gpui_kit::component::{
};
use smallvec::SmallVec;
use crate::icon::IconName;
type MouseDownListener = Box<dyn Fn(&MouseDownEvent, &mut Window, &mut App) + 'static>;
type ClickListener = Box<dyn Fn(&ClickEvent, &mut Window, &mut App) + 'static>;
type SharedClickListener = Rc<dyn Fn(&ClickEvent, &mut Window, &mut App)>;
+1 -1
View File
@@ -1,7 +1,7 @@
use std::rc::Rc;
use gpui::{App, AppContext, ClickEvent, ParentElement, Styled, Window, px};
use gpui_kit::assets::IconName;
use ui::IconName;
use gpui_kit::component::button::{Button, ButtonVariants};
use gpui_kit::component::input::{Input, InputState};
use gpui_kit::component::notification::Notification;
+1 -1
View File
@@ -9,7 +9,7 @@ use gpui::{
Render, SharedString, StatefulInteractiveElement as _, Styled, Subscription, Task, WeakEntity,
Window, div, px, uniform_list,
};
use gpui_kit::assets::IconName;
use ui::IconName;
use gpui_kit::component::button::{Button, ButtonVariants};
use gpui_kit::component::dock::{DockArea, DockPlacement, PanelHandle};
use gpui_kit::component::input::{Input, InputEvent, InputState};
+6 -5
View File
@@ -6,7 +6,7 @@ use gpui::{
Subscription, Task, WeakEntity, Window, div, px, rems,
};
use gpui_base::{Popup, Select};
use gpui_kit::assets::IconName;
use ui::IconName;
use gpui_kit::base::StyledExt as _;
use gpui_kit::component::button::{Button, ButtonVariants};
use gpui_kit::component::dock::{DockArea, DockPlacement, PanelHandle};
@@ -14,7 +14,8 @@ use gpui_kit::component::group_box::{GroupBox, GroupBoxVariants};
use gpui_kit::component::input::{Input, InputEvent, InputState, Textarea, TextareaState};
use gpui_kit::component::separator::Separator;
use gpui_kit::component::switch::Switch;
use gpui_kit::component::{ActiveTheme, Disableable, Icon, Sizable, WindowExt, h_flex, v_flex};
use gpui_kit::component::{ActiveTheme, Disableable, Sizable, WindowExt, h_flex, v_flex};
use gpui_native_kit::icons::Icon;
use nip29::{GroupCreateOptions, GroupKey, GroupsEvent, GroupsRegistry};
use nostr_sdk::prelude::*;
use settings::AppSettings;
@@ -379,9 +380,9 @@ impl NewGroup {
}))
.child(selected.to_owned())
.child(
Icon::new(IconName::ChevronDown)
.small()
.text_color(cx.theme().muted_foreground),
Icon::named(IconName::ChevronDown)
.size(ui::small_icon_size(cx))
.color(cx.theme().muted_foreground),
);
let select = Select::new("relay-select")
+1 -1
View File
@@ -7,7 +7,7 @@ use gpui::{
App, AppContext, Context, Div, Entity, IntoElement, ParentElement, Render, SharedString,
Styled, Task, Window, div, retain_all,
};
use gpui_kit::assets::IconName;
use ui::IconName;
use gpui_kit::base::StyledExt as _;
use gpui_kit::component::button::{Button, ButtonVariants};
use gpui_kit::component::clipboard::Clipboard;
+1 -1
View File
@@ -7,7 +7,7 @@ use gpui::{
ParentElement, Render, SharedString, Stateful, Styled, Subscription, Task, TextAlign,
WeakEntity, Window, div, rems,
};
use gpui_kit::assets::IconName;
use ui::IconName;
use gpui_kit::base::StyledExt as _;
use gpui_kit::component::button::{Button, ButtonVariants};
use gpui_kit::component::input::{Input, InputEvent, InputState};
+1 -1
View File
@@ -4,7 +4,7 @@ use gpui::{
AppContext, Context, Entity, IntoElement, ParentElement, Render, SharedString, Styled,
Subscription, Task, Window, div,
};
use gpui_kit::assets::IconName;
use ui::IconName;
use gpui_kit::component::button::{Button, ButtonVariants};
use gpui_kit::component::input::{Input, InputEvent, InputState};
use gpui_kit::component::{ActiveTheme, WindowExt, h_flex, v_flex};
+14 -10
View File
@@ -7,17 +7,17 @@ use gpui::{
App, AppContext, Context, Div, Entity, InteractiveElement, IntoElement, ParentElement, Render,
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};
use gpui_kit::component::{ActiveTheme, Disableable, Sizable, WindowExt, h_flex, v_flex};
use gpui_native_kit::icons::Icon;
use instant::Duration;
use nostr_sdk::prelude::*;
use person::{Directory, Person, PersonRegistry, shorten_pubkey};
use smallvec::{SmallVec, smallvec};
use state::{BOOTSTRAP_RELAYS, NostrAddress, NostrRegistry, TIMEOUT};
use ui::Avatar;
use ui::{Avatar, IconName};
pub fn init(public_key: PublicKey, window: &mut Window, cx: &mut App) -> Entity<Screening> {
cx.new(|cx| Screening::new(public_key, window, cx))
@@ -569,13 +569,17 @@ fn status_badge(status: Option<bool>, cx: &App) -> Div {
.flex_shrink_0()
.map(|this| {
if let Some(status) = status {
this.child(Icon::new(IconName::CircleCheck).small().text_color({
if status {
cx.theme().primary
} else {
cx.theme().muted_foreground
}
}))
this.child(
Icon::named(IconName::CircleCheck)
.size(ui::small_icon_size(cx))
.color({
if status {
cx.theme().primary
} else {
cx.theme().muted_foreground
}
}),
)
} else {
this.child(Spinner::new().small())
}
+1 -1
View File
@@ -11,7 +11,7 @@ use gpui::{
AnyElement, App, AppContext, Context, Entity, IntoElement, ParentElement, Render, Styled,
Subscription, Window, div,
};
use gpui_kit::assets::IconName;
use ui::IconName;
use gpui_kit::component::button::{Button, ButtonVariants};
use gpui_kit::component::input::{Input, InputState};
use gpui_kit::component::kbd::Kbd;
+1 -1
View File
@@ -15,7 +15,7 @@ use gpui_base::dock::{
PanelView as BasePanelView, TabGroupContext, TabGroupRenderer,
};
use gpui_base::{ElementExt, InteractiveElementExt, Tab, Tabs};
use gpui_kit::assets::IconName;
use ui::IconName;
use gpui_kit::component::animation::{Lerp as _, ease_out_cubic};
use gpui_kit::component::button::{Button, ButtonVariants as _};
use gpui_kit::component::dock::{ClosePanel, PanelControl, PanelHandle, ToggleZoom};
+4 -3
View File
@@ -3,8 +3,9 @@ use gpui::{
App, Hsla, InteractiveElement, IntoElement, MouseButton, ParentElement, RenderOnce,
StatefulInteractiveElement, Styled, Window, div, px,
};
use gpui_kit::assets::IconName;
use gpui_kit::component::{ActiveTheme as _, Icon, Sizable as _, h_flex};
use gpui_kit::component::{ActiveTheme as _, h_flex};
use gpui_native_kit::icons::Icon;
use ui::IconName;
use super::TAB_BAR_HEIGHT;
@@ -131,7 +132,7 @@ impl RenderOnce for ControlIcon {
}
})
})
.child(Icon::new(self.icon()).small())
.child(Icon::named(self.icon()).size(ui::small_icon_size(cx)))
}
}
+7 -7
View File
@@ -9,19 +9,19 @@ use gpui::{
size, transparent_black,
};
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};
use gpui_kit::component::notification::Notification;
use gpui_kit::component::scroll::Scrollbar;
use gpui_kit::component::{ActiveTheme, Icon, Sizable, WindowExt, h_flex, v_flex};
use gpui_kit::component::{ActiveTheme, Sizable, WindowExt, h_flex, v_flex};
use gpui_native_kit::icons::Icon;
use nip29::{Discovery, GroupCandidate, GroupKey, GroupsEvent, GroupsRegistry, Membership};
use nostr_sdk::prelude::{RelayUrl, Timestamp};
use settings::AppSettings;
use smallvec::{SmallVec, smallvec};
use ui::Avatar;
use ui::{Avatar, IconName};
const TITLE: &str = "Browse";
const INPUT_PLACEHOLDER: &str = "wss://relay.example.com";
@@ -437,7 +437,7 @@ impl BrowsePanel {
.w_full()
.gap_1p5()
.text_color(cx.theme().muted_foreground)
.child(Icon::new(IconName::Book))
.child(Icon::named(IconName::Book))
.child(
div()
.text_xs()
@@ -464,9 +464,9 @@ impl Panel for BrowsePanel {
.gap_1()
.text_xs()
.child(
Icon::new(IconName::Compass)
.small()
.text_color(cx.theme().muted_foreground),
Icon::named(IconName::Compass)
.size(ui::small_icon_size(cx))
.color(cx.theme().muted_foreground),
)
.child(TITLE)
.into_any_element()
+1 -1
View File
@@ -7,7 +7,7 @@ use gpui::{
IntoElement, ParentElement, Render, SharedString, Styled, Subscription, Task, TextAlign,
Window, div, rems, retain_all,
};
use gpui_kit::assets::IconName;
use ui::IconName;
use gpui_kit::base::StyledExt as _;
use gpui_kit::component::button::{Button, ButtonVariants};
use gpui_kit::component::dock::{Panel, PanelEvent};
+5 -5
View File
@@ -9,17 +9,17 @@ use gpui::{
InteractiveElement, IntoElement, ParentElement, Render, SharedString,
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::scroll::ScrollableElement;
use gpui_kit::component::{ActiveTheme, Icon, Sizable, h_flex, v_flex};
use gpui_kit::component::{ActiveTheme, Sizable, h_flex, v_flex};
use gpui_native_kit::icons::Icon;
use nostr_sdk::prelude::*;
use person::PersonRegistry;
use smallvec::{SmallVec, smallvec};
use state::{NostrRegistry, StateEvent};
use ui::Avatar;
use ui::{Avatar, IconName};
use super::browse;
use crate::dock::add_panel_to;
@@ -458,7 +458,7 @@ impl GreeterPanel {
.w_full()
.child(
Nav::new("browse-group")
.prefix(Icon::new(IconName::Compass))
.prefix(Icon::named(IconName::Compass))
.label("Browse Public Groups")
.text_sm()
.on_click(cx.listener(|this, _, window, cx| {
@@ -474,7 +474,7 @@ impl GreeterPanel {
)
.child(
Nav::new("browse-posts")
.prefix(Icon::new(IconName::Link))
.prefix(Icon::named(IconName::Link))
.label("Browse Nostr via Jumble")
.text_sm()
.on_click(|_, _, cx| {
+6 -5
View File
@@ -2,9 +2,10 @@ use gpui::{
App, AppContext, Context, Entity, EventEmitter, FocusHandle, Focusable, IntoElement,
ParentElement, Render, SharedString, Styled, Window,
};
use gpui_kit::assets::IconName;
use gpui_kit::component::dock::{Panel, PanelEvent};
use gpui_kit::component::{ActiveTheme, Icon, Sizable, h_flex};
use gpui_kit::component::{ActiveTheme, h_flex};
use gpui_native_kit::icons::Icon;
use ui::IconName;
pub fn init(window: &mut Window, cx: &mut App) -> Entity<InboxPanel> {
cx.new(|cx| InboxPanel::new(window, cx))
@@ -35,9 +36,9 @@ impl Panel for InboxPanel {
h_flex()
.gap_1p5()
.child(
Icon::new(IconName::Inbox)
.small()
.text_color(cx.theme().muted_foreground),
Icon::named(IconName::Inbox)
.size(ui::small_icon_size(cx))
.color(cx.theme().muted_foreground),
)
.child(self.name.clone())
.into_any_element()
+5 -4
View File
@@ -8,7 +8,8 @@ use gpui::{
};
use gpui_kit::base::StyledExt as _;
use gpui_kit::component::menu::{ContextMenuExt as _, PopupMenuItem};
use gpui_kit::component::{ActiveTheme, Icon, Sizable, h_flex, v_flex};
use gpui_kit::component::{ActiveTheme, Sizable, h_flex, v_flex};
use gpui_native_kit::icons::Icon;
use nip29::Group;
use nostr_sdk::prelude::*;
use settings::AppSettings;
@@ -231,9 +232,9 @@ impl Sidebar {
Nav::new(label)
.label(label)
.suffix(
Icon::new(icon)
.small()
.text_color(cx.theme().muted_foreground),
Icon::named(icon)
.size(ui::small_icon_size(cx))
.color(cx.theme().muted_foreground),
)
.text_xs()
.font_semibold()
+4 -3
View File
@@ -16,7 +16,8 @@ use gpui_kit::component::dialog::DialogButtonProps;
use gpui_kit::component::menu::{DropdownMenu, PopupMenuItem};
use gpui_kit::component::popover::Popover;
use gpui_kit::component::separator::Separator;
use gpui_kit::component::{ActiveTheme, Icon, Selectable, Sizable, WindowExt, h_flex, v_flex};
use gpui_kit::component::{ActiveTheme, Selectable, Sizable, WindowExt, h_flex, v_flex};
use gpui_native_kit::icons::Icon;
use nostr_sdk::prelude::*;
use person::shorten_pubkey;
use settings::AppSettings;
@@ -210,7 +211,7 @@ impl Sidebar {
})
}
pub(super) fn render_footer(&self, loading: bool, _cx: &mut Context<Self>) -> Div {
pub(super) fn render_footer(&self, loading: bool, cx: &mut Context<Self>) -> Div {
v_flex()
.p_2()
.flex_shrink_0()
@@ -220,7 +221,7 @@ impl Sidebar {
.when(!loading, |this| {
this.child(
Nav::new("settings")
.prefix(Icon::new(IconName::Settings).small())
.prefix(Icon::named(IconName::Settings).size(ui::small_icon_size(cx)))
.center_prefix(true)
.label("Settings")
.text_sm()
+6 -5
View File
@@ -6,7 +6,8 @@ use gpui::{
AnyElement, App, Context, IntoElement, ParentElement, SharedString, Styled, div, uniform_list,
};
use gpui_kit::base::StyledExt as _;
use gpui_kit::component::{ActiveTheme, Icon, Sizable, h_flex, v_flex};
use gpui_kit::component::{ActiveTheme, h_flex, v_flex};
use gpui_native_kit::icons::Icon;
use nip29::GroupsRegistry;
use settings::AppSettings;
use ui::IconName;
@@ -70,7 +71,7 @@ impl Sidebar {
.when(cfg!(not(target_arch = "wasm32")), |this| {
this.child(
Nav::new("wallet")
.prefix(Icon::new(gpui_kit::assets::IconName::Wallet).small())
.prefix(Icon::named(IconName::Wallet).size(ui::small_icon_size(cx)))
.label("Wallet")
.text_sm()
.on_click(|_, window, cx| {
@@ -80,7 +81,7 @@ impl Sidebar {
})
.child(
Nav::new("browse")
.prefix(Icon::new(IconName::Compass).small())
.prefix(Icon::named(IconName::Compass).size(ui::small_icon_size(cx)))
.label("Browse")
.text_sm()
.on_click(|_, window, cx| {
@@ -89,7 +90,7 @@ impl Sidebar {
)
.child(
Nav::new("reqs")
.prefix(Icon::new(IconName::Invite).small())
.prefix(Icon::named(IconName::Invite).size(ui::small_icon_size(cx)))
.label("Requests")
.text_sm()
.when(request_count > 0, |this| {
@@ -129,7 +130,7 @@ impl Sidebar {
)
.child(
Nav::new("contacts")
.prefix(Icon::new(IconName::Book).small())
.prefix(Icon::named(IconName::Book).size(ui::small_icon_size(cx)))
.label("Contacts")
.text_sm()
.when(contacts_open, |this| this.bg(cx.theme().list_active))
+5 -4
View File
@@ -11,7 +11,8 @@ 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};
use gpui_kit::component::{ActiveTheme, Icon, Selectable, Sizable, WindowExt, h_flex};
use gpui_kit::component::{ActiveTheme, Selectable, Sizable, WindowExt, h_flex};
use gpui_native_kit::icons::Icon;
use nip29::Group;
use nostr_sdk::prelude::*;
use settings::AppSettings;
@@ -119,9 +120,9 @@ impl Sidebar {
Nav::new(label)
.label(label)
.suffix(
Icon::new(icon)
.small()
.text_color(cx.theme().muted_foreground),
Icon::named(icon)
.size(ui::small_icon_size(cx))
.color(cx.theme().muted_foreground),
)
.text_xs()
.font_semibold()
+1 -1
View File
@@ -6,7 +6,7 @@ use gpui::{
AnyElement, App, Context, Entity, IntoElement, ParentElement, SharedString, Styled, Task,
Window, div, uniform_list,
};
use gpui_kit::assets::IconName;
use ui::IconName;
use gpui_kit::component::button::{Button, ButtonVariants};
use gpui_kit::component::input::Input;
use gpui_kit::component::{ActiveTheme, Selectable, Sizable, h_flex, v_flex};