feat: add new theme (#61)

Reviewed-on: #61
This commit was merged in pull request #61.
This commit is contained in:
2026-10-10 00:30:42 +00:00
parent 4ef764984b
commit 602a91b4f0
94 changed files with 3337 additions and 4456 deletions
+13 -13
View File
@@ -7,7 +7,7 @@ use gpui::{
use instant::Duration;
use nostr_connect::prelude::*;
use state::{CoopAuthUrlHandler, NostrRegistry, USER_KEYRING};
use theme::ActiveTheme;
use theme::{ActiveTheme, TextStyle, Typeset as _, surface_radius};
use ui::button::{Button, ButtonVariants};
use ui::input::{Input, InputEvent, InputState};
use ui::{Disableable, StyledExt, WindowExtension, v_flex};
@@ -223,8 +223,8 @@ impl Render for ImportIdentity {
v_flex()
.size_full()
.gap_2()
.text_sm()
.gap(px(theme::SPACE))
.text_style(TextStyle::Callout)
.child(
v_flex()
.gap_1()
@@ -248,10 +248,10 @@ impl Render for ImportIdentity {
this.child(
div()
.p_2()
.rounded(cx.theme().radius)
.bg(cx.theme().warning_background)
.text_xs()
.text_color(cx.theme().warning_foreground)
.rounded(px(surface_radius()))
.bg(cx.theme().warning_muted)
.text_style(TextStyle::Caption)
.text_color(cx.theme().warning)
.line_height(relative(1.2))
.child(div().child(BUNKER_WARN)),
)
@@ -260,10 +260,10 @@ impl Render for ImportIdentity {
this.child(
div()
.p_2()
.rounded(cx.theme().radius)
.bg(cx.theme().warning_background)
.text_xs()
.text_color(cx.theme().warning_foreground)
.rounded(px(surface_radius()))
.bg(cx.theme().warning_muted)
.text_style(TextStyle::Caption)
.text_color(cx.theme().warning)
.line_height(relative(1.2))
.child(div().child(KEY_WARN)),
)
@@ -295,9 +295,9 @@ impl Render for ImportIdentity {
.when_some(self.error.read(cx).as_ref(), |this, error| {
this.child(
div()
.text_xs()
.text_style(TextStyle::Caption)
.text_center()
.text_color(cx.theme().text_danger)
.text_color(cx.theme().danger)
.child(error.clone()),
)
})
+4 -3
View File
@@ -2,7 +2,7 @@ use std::rc::Rc;
use gpui::{App, AppContext, ClickEvent, ParentElement, Styled, Window, px};
use nip29::{GroupReference, GroupsRegistry};
use ui::button::{Button, ButtonVariants};
use ui::button::{Button, ButtonVariants, IconPosition};
use ui::input::{Input, InputState};
use ui::notification::Notification;
use ui::{IconName, StyledExt, WindowExtension, h_flex, v_flex};
@@ -43,7 +43,7 @@ pub fn open(window: &mut Window, cx: &mut App) {
.child(
v_flex()
.gap_3()
.child(Input::new(&input).cleanable(true).text_sm())
.child(Input::new(&input).cleanable(true))
.child(
h_flex()
.gap_1()
@@ -56,7 +56,8 @@ pub fn open(window: &mut Window, cx: &mut App) {
)
.child(
Button::new("join")
.icon(IconName::CheckCircle)
.icon(IconName::ArrowRight)
.icon_position(IconPosition::End)
.label("Join")
.primary()
.font_semibold()
+13 -12
View File
@@ -13,9 +13,9 @@ use nostr_sdk::prelude::*;
use person::PersonRegistry;
use settings::AppSettings;
use state::NostrRegistry;
use theme::ActiveTheme;
use theme::{ActiveTheme, TextStyle, Typeset as _};
use ui::avatar::Avatar;
use ui::button::{Button, ButtonVariants};
use ui::button::{Button, ButtonVariants, IconPosition};
use ui::dock::{DockArea, DockPlacement, PanelHandle};
use ui::input::{Input, InputEvent, InputState};
use ui::nav::Nav;
@@ -332,7 +332,7 @@ impl NewChat {
Nav::new(start + offset)
.label(profile.name())
.text_sm()
.text_style(TextStyle::Callout)
.when(!AppSettings::get_hide_avatar(cx), |this| {
this.prefix(
Avatar::from_source(profile.avatar())
@@ -365,9 +365,9 @@ impl NewChat {
.gap_1()
.p_0p5()
.rounded_full()
.bg(cx.theme().ghost_element_background_alt)
.text_size(px(10.))
.hover(|this| this.bg(cx.theme().ghost_element_hover))
.bg(cx.theme().surface_raised)
.text_style(TextStyle::Caption2)
.hover(|this| this.bg(cx.theme().element_hover))
.child(
Avatar::from_source(profile.avatar())
.seed(profile.avatar_seed())
@@ -394,7 +394,7 @@ impl Render for NewChat {
h_flex()
.gap_1()
.w_full()
.child(Input::new(&self.input).flex_1().text_sm().cleanable(true))
.child(Input::new(&self.input).flex_1().cleanable(true))
.child(
Button::new("add")
.icon(IconName::Plus)
@@ -414,15 +414,15 @@ impl Render for NewChat {
if let Some(error) = self.error.clone() {
this.child(
div()
.text_xs()
.text_color(cx.theme().text_danger)
.text_style(TextStyle::Caption)
.text_color(cx.theme().danger)
.child(error),
)
} else {
this.child(
div()
.text_xs()
.text_color(cx.theme().text_placeholder)
.text_style(TextStyle::Caption)
.text_color(cx.theme().text_faint)
.child(notice),
)
}
@@ -449,7 +449,8 @@ impl Render for NewChat {
)
.child(
Button::new("start")
.icon(IconName::CheckCircle)
.icon(IconName::ArrowRight)
.icon_position(IconPosition::End)
.label("Start")
.primary()
.font_semibold()
+5 -4
View File
@@ -3,8 +3,8 @@ use std::rc::Rc;
use gpui::{App, AppContext, ClickEvent, Div, Entity, ParentElement, Styled, Window, px};
use nip29::{GroupId, GroupKey, GroupMetadata, GroupsRegistry};
use nostr_sdk::prelude::*;
use theme::ActiveTheme;
use ui::button::{Button, ButtonVariants};
use theme::{ActiveTheme, TextStyle, Typeset as _};
use ui::button::{Button, ButtonVariants, IconPosition};
use ui::input::{Input, InputState};
use ui::notification::Notification;
use ui::{IconName, StyledExt, WindowExtension, h_flex, v_flex};
@@ -47,7 +47,8 @@ pub fn open(window: &mut Window, cx: &mut App) {
)
.child(
Button::new("create")
.icon(IconName::CheckCircle)
.icon(IconName::ArrowRight)
.icon_position(IconPosition::End)
.label("Create")
.primary()
.font_semibold()
@@ -67,7 +68,7 @@ pub fn open(window: &mut Window, cx: &mut App) {
fn field(label: &'static str, input: &Entity<InputState>, cx: &App) -> Div {
v_flex()
.gap_1()
.text_sm()
.text_style(TextStyle::Callout)
.text_color(cx.theme().text_muted)
.child(label)
.child(Input::new(input))
+19 -13
View File
@@ -5,16 +5,16 @@ use chat::{ChatRegistry, Room, RoomKind};
use gpui::prelude::FluentBuilder;
use gpui::{
App, AppContext, ClipboardItem, Context, Div, Entity, IntoElement, ParentElement,
PathPromptOptions, Render, SharedString, Styled, Task, Window, div, retain_all,
PathPromptOptions, Render, SharedString, Styled, Task, Window, div, px, retain_all,
};
use instant::Duration;
use nostr_sdk::prelude::*;
use person::{Person, PersonRegistry, shorten_pubkey};
use settings::AppSettings;
use state::{NostrRegistry, upload};
use theme::ActiveTheme;
use theme::{ActiveTheme, TextStyle, Typeset as _, button_radius};
use ui::avatar::Avatar;
use ui::button::{Button, ButtonVariants};
use ui::button::{Button, ButtonVariants, IconPosition};
use ui::dock::DockPlacement;
use ui::input::{Input, InputState, Textarea, TextareaState};
use ui::notification::Notification;
@@ -366,12 +366,13 @@ impl Render for ProfileDialog {
.w_full()
.items_center()
.justify_center()
.bg(cx.theme().surface_background)
.bg(cx.theme().surface)
.child(Avatar::new(avatar).seed(profile.avatar_seed()).large())
.when(self.editing, |this| {
this.child(
Button::new("upload")
.icon(IconName::PlusCircle)
.icon(IconName::ArrowRight)
.icon_position(IconPosition::End)
.label("Add an avatar")
.xsmall()
.ghost()
@@ -391,9 +392,9 @@ impl Render for ProfileDialog {
.w_full()
.justify_center()
.gap_3()
.rounded(cx.theme().radius)
.bg(cx.theme().surface_background)
.text_sm()
.rounded(px(button_radius()))
.bg(cx.theme().surface)
.text_style(TextStyle::Callout)
.child(shorten_pkey)
.child(
Button::new("copy")
@@ -464,6 +465,7 @@ impl Render for ProfileDialog {
this.child(
Button::new("update")
.icon(IconName::Edit)
.icon_position(IconPosition::End)
.label("Update")
.primary()
.font_semibold()
@@ -476,6 +478,7 @@ impl Render for ProfileDialog {
this.child(
Button::new("message")
.icon(IconName::Message)
.icon_position(IconPosition::End)
.label("Message")
.primary()
.font_semibold()
@@ -497,6 +500,7 @@ impl Render for ProfileDialog {
.child(
Button::new("save")
.icon(IconName::CheckCircle)
.icon_position(IconPosition::End)
.label("Save")
.primary()
.font_semibold()
@@ -513,7 +517,7 @@ impl Render for ProfileDialog {
fn label(label: &'static str, cx: &App) -> Div {
div()
.text_xs()
.text_style(TextStyle::Caption)
.text_color(cx.theme().text_muted)
.font_semibold()
.child(label)
@@ -530,8 +534,10 @@ fn field(
None => (SharedString::from(placeholder), cx.theme().text_muted),
};
v_flex()
.gap_1p5()
.child(label(text, cx))
.child(div().text_sm().text_color(color).child(content))
v_flex().gap_1p5().child(label(text, cx)).child(
div()
.text_style(TextStyle::Callout)
.text_color(color)
.child(content),
)
}
+20 -20
View File
@@ -11,8 +11,8 @@ use instant::Duration;
use nostr_sdk::prelude::*;
use smallvec::{SmallVec, smallvec};
use state::NostrRegistry;
use theme::ActiveTheme;
use ui::button::{Button, ButtonVariants};
use theme::{ActiveTheme, TextStyle, Typeset as _, button_radius, panel_radius};
use ui::button::{Button, ButtonVariants, IconPosition};
use ui::input::{Input, InputEvent, InputState};
use ui::menu::{DropdownMenu, PopupMenuItem};
use ui::scroll::ScrollableElement;
@@ -108,10 +108,10 @@ impl RelayManager {
let manager = cx.entity().downgrade();
v_flex()
.gap_2()
.gap(px(theme::SPACE))
.child(
div()
.text_xs()
.text_style(TextStyle::Caption)
.text_color(cx.theme().text_muted)
.child(SharedString::from(GOSSIP_MSG)),
)
@@ -132,7 +132,7 @@ impl RelayManager {
.tooltip("Relay metadata")
.ghost()
.h(rems(2.))
.text_xs()
.text_style(TextStyle::Caption)
.dropdown_menu(move |menu, _window, _cx| {
menu.item(metadata_item(&manager, RelayMetadata::Read))
.item(metadata_item(&manager, RelayMetadata::Write))
@@ -153,8 +153,8 @@ impl RelayManager {
this.child(
div()
.italic()
.text_xs()
.text_color(cx.theme().text_danger)
.text_style(TextStyle::Caption)
.text_color(cx.theme().danger)
.child(error.clone()),
)
})
@@ -197,10 +197,10 @@ impl RelayManager {
fn render_inbox(&mut self, cx: &mut Context<Self>) -> impl IntoElement {
v_flex()
.gap_2()
.gap(px(theme::SPACE))
.child(
div()
.text_xs()
.text_style(TextStyle::Caption)
.text_color(cx.theme().text_muted)
.child(SharedString::from(INBOX_MSG)),
)
@@ -224,8 +224,8 @@ impl RelayManager {
this.child(
div()
.italic()
.text_xs()
.text_color(cx.theme().text_danger)
.text_style(TextStyle::Caption)
.text_color(cx.theme().danger)
.child(error.clone()),
)
})
@@ -283,7 +283,8 @@ impl RelayManager {
h_flex().gap_1().justify_end().child(
Button::new("update")
.icon(IconName::CheckCircle)
.icon(IconName::ArrowRight)
.icon_position(IconPosition::End)
.label("Update")
.primary()
.font_semibold()
@@ -607,7 +608,7 @@ impl Render for RelayManager {
v_flex()
.gap_4()
.text_sm()
.text_style(TextStyle::Callout)
.child(self.render_tab_bar(cx))
.child(content)
.child(self.render_actions(cx))
@@ -646,20 +647,19 @@ fn relay_row(
.h_8()
.px_2()
.justify_between()
.rounded(cx.theme().radius)
.bg(cx.theme().surface_background)
.rounded(px(button_radius()))
.bg(cx.theme().surface)
.child(
h_flex()
.gap_1()
.text_sm()
.text_style(TextStyle::Callout)
.child(label)
.when_some(badge, |this, badge| {
this.child(
div()
.p_0p5()
.rounded_xs()
.font_semibold()
.text_size(px(8.))
.text_style(TextStyle::Caption2)
.child(badge),
)
}),
@@ -682,8 +682,8 @@ fn empty_relays(cx: &App) -> impl IntoElement {
.border_2()
.border_dashed()
.border_color(cx.theme().border)
.rounded(cx.theme().radius_lg)
.text_sm()
.rounded(px(panel_radius()))
.text_style(TextStyle::Callout)
.text_align(TextAlign::Center)
.child(SharedString::from("Please add some relays."))
}
+8 -7
View File
@@ -7,8 +7,8 @@ use gpui::{
use instant::Duration;
use nip4e::DeviceRegistry;
use nostr_sdk::prelude::*;
use theme::ActiveTheme;
use ui::button::{Button, ButtonVariants};
use theme::{ActiveTheme, TextStyle, Typeset as _};
use ui::button::{Button, ButtonVariants, IconPosition};
use ui::input::{Input, InputEvent, InputState};
use ui::{IconName, StyledExt, WindowExtension, h_flex, v_flex};
@@ -100,11 +100,11 @@ impl Render for RestoreEncryption {
v_flex()
.size_full()
.gap_3()
.text_sm()
.text_style(TextStyle::Callout)
.child(
v_flex()
.gap_1()
.text_sm()
.text_style(TextStyle::Callout)
.text_color(cx.theme().text_muted)
.child("Secret Key")
.child(Input::new(&self.key_input)),
@@ -112,7 +112,8 @@ impl Render for RestoreEncryption {
.child(
h_flex().gap_1().justify_end().child(
Button::new("restore")
.icon(IconName::CheckCircle)
.icon(IconName::ArrowRight)
.icon_position(IconPosition::End)
.label("Restore")
.primary()
.font_semibold()
@@ -124,9 +125,9 @@ impl Render for RestoreEncryption {
.when_some(self.error.read(cx).as_ref(), |this, error| {
this.child(
div()
.text_xs()
.text_style(TextStyle::Caption)
.text_center()
.text_color(cx.theme().text_danger)
.text_color(cx.theme().danger)
.child(error.clone()),
)
})
+32 -29
View File
@@ -12,7 +12,7 @@ use nostr_sdk::prelude::*;
use person::{Person, PersonRegistry, shorten_pubkey};
use smallvec::{SmallVec, smallvec};
use state::{BOOTSTRAP_RELAYS, NostrAddress, NostrRegistry, TIMEOUT};
use theme::ActiveTheme;
use theme::{ActiveTheme, TextStyle, Typeset as _, button_radius};
use ui::avatar::Avatar;
use ui::button::{Button, ButtonVariants};
use ui::indicator::Indicator;
@@ -283,9 +283,9 @@ impl Screening {
.w_full()
.px_2()
.gap_1p5()
.rounded(cx.theme().radius)
.text_sm()
.hover(|this| this.bg(cx.theme().elevated_surface_background))
.rounded(px(button_radius()))
.text_style(TextStyle::Callout)
.hover(|this| this.bg(cx.theme().element_hover))
.child(Avatar::new(profile.avatar()).small())
.child(profile.name()),
);
@@ -344,8 +344,8 @@ impl Render for Screening {
.h_7()
.justify_center()
.rounded_full()
.bg(cx.theme().elevated_surface_background)
.text_sm()
.bg(cx.theme().surface_raised)
.text_style(TextStyle::Callout)
.truncate()
.text_ellipsis()
.text_center()
@@ -385,33 +385,36 @@ impl Render for Screening {
.child(
h_flex()
.items_start()
.gap_2()
.text_sm()
.gap(px(theme::SPACE))
.text_style(TextStyle::Callout)
.child(status_badge(Some(self.followed), cx))
.child(
v_flex().text_sm().child("Contact").child(
div()
.line_clamp(1)
.text_color(cx.theme().text_muted)
.child({
if self.followed {
SharedString::from(CONTACT)
} else {
SharedString::from(NOT_CONTACT)
}
}),
),
v_flex()
.text_style(TextStyle::Callout)
.child("Contact")
.child(
div()
.line_clamp(1)
.text_color(cx.theme().text_muted)
.child({
if self.followed {
SharedString::from(CONTACT)
} else {
SharedString::from(NOT_CONTACT)
}
}),
),
),
)
.child(
h_flex()
.items_start()
.gap_2()
.text_sm()
.gap(px(theme::SPACE))
.text_style(TextStyle::Callout)
.child(status_badge(last_active, cx))
.child(
v_flex()
.text_sm()
.text_style(TextStyle::Callout)
.child(
h_flex()
.gap_0p5()
@@ -446,11 +449,11 @@ impl Render for Screening {
.child(
h_flex()
.items_start()
.gap_2()
.gap(px(theme::SPACE))
.child(status_badge(Some(self.verified), cx))
.child(
v_flex()
.text_sm()
.text_style(TextStyle::Callout)
.child({
if let Some(addr) = self.address(cx) {
SharedString::from(format!("{} validation", addr))
@@ -481,11 +484,11 @@ impl Render for Screening {
.child(
h_flex()
.items_start()
.gap_2()
.gap(px(theme::SPACE))
.child(status_badge(Some(mutuals > 0), cx))
.child(
h_flex()
.text_sm()
.text_style(TextStyle::Callout)
.child(
div()
.line_clamp(1)
@@ -524,9 +527,9 @@ fn status_badge(status: Option<bool>, cx: &App) -> Div {
if let Some(status) = status {
this.child(Icon::new(IconName::CheckCircle).small().text_color({
if status {
cx.theme().icon_accent
cx.theme().accent
} else {
cx.theme().icon_muted
cx.theme().text_faint
}
}))
} else {
+25 -51
View File
@@ -1,10 +1,10 @@
use gpui::http_client::Url;
use gpui::{
App, AppContext, Context, Entity, IntoElement, ParentElement, Render, SharedString, Styled,
Window, div, px,
Window, div,
};
use settings::AppSettings;
use theme::{ActiveTheme, Theme, ThemeMode};
use theme::{ActiveTheme, AppExt as _, AppearanceMode, TextStyle, Typeset as _};
use ui::button::{Button, ButtonVariants};
use ui::group_box::{GroupBox, GroupBoxVariants};
use ui::input::{Input, InputState};
@@ -47,10 +47,10 @@ impl Preferences {
}
}
/// Set the theme mode (light or dark)
fn set_theme_mode(mode: ThemeMode, window: &mut Window, cx: &mut App) {
AppSettings::update_theme_mode(mode, cx);
Theme::change(mode, Some(window), cx);
/// Set the appearance mode (system, light or dark)
fn set_appearance_mode(mode: AppearanceMode, cx: &mut App) {
AppSettings::update_appearance_mode(mode, cx);
cx.set_appearance_mode(mode);
}
}
@@ -58,14 +58,13 @@ impl Render for Preferences {
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
const SCREENING: &str = "Show an screening dialog to verify the unknown sender.";
const AVATAR: &str = "Hide all avatar pictures to improve performance.";
const MODE: &str = "Use the selected light or dark theme, or to follow the OS.";
const MODE: &str = "Follow the OS, or always use light or dark.";
const NIP4E: &str = "Use a dedicated key to encrypt and decrypt messages.";
const RESET: &str = "Reset the theme to the default one.";
let screening = AppSettings::get_screening(cx);
let hide_avatar = AppSettings::get_hide_avatar(cx);
let nip4e = AppSettings::get_nip4e(cx);
let theme_mode = AppSettings::get_theme_mode(cx);
let appearance_mode = AppSettings::get_appearance_mode(cx);
v_flex()
.gap_4()
@@ -104,55 +103,30 @@ impl Render for Preferences {
.justify_between()
.child(
v_flex()
.child(div().text_sm().child(SharedString::from("Mode")))
.child(
div()
.text_xs()
.text_style(TextStyle::Callout)
.child(SharedString::from("Mode")),
)
.child(
div()
.text_style(TextStyle::Caption)
.text_color(cx.theme().text_muted)
.child(SharedString::from(MODE)),
),
)
.child(
Button::new("theme-mode")
.label(theme_mode.name())
Button::new("appearance-mode")
.label(appearance_mode.label())
.ghost_alt()
.small()
.dropdown_menu(|this, _window, _cx| {
this.item(PopupMenuItem::new("Light").on_click(
|_, window, cx| {
Self::set_theme_mode(ThemeMode::Light, window, cx);
},
))
.item(
PopupMenuItem::new("Dark").on_click(|_, window, cx| {
Self::set_theme_mode(ThemeMode::Dark, window, cx);
}),
)
}),
),
)
.child(
h_flex()
.gap_3()
.justify_between()
.child(
v_flex()
.child(div().text_sm().child(SharedString::from("Reset theme")))
.child(
div()
.text_xs()
.text_color(cx.theme().text_muted)
.child(SharedString::from(RESET)),
),
)
.child(
Button::new("reset")
.label("Reset")
.ghost_alt()
.small()
.on_click(move |_ev, window, cx| {
AppSettings::global(cx).update(cx, |this, cx| {
this.reset_theme(window, cx);
AppearanceMode::ALL.iter().fold(this, |menu, mode| {
menu.item(PopupMenuItem::new(mode.label()).on_click(
move |_, _window, cx| {
Self::set_appearance_mode(*mode, cx);
},
))
})
}),
),
@@ -184,7 +158,7 @@ impl Render for Preferences {
.child(
h_flex()
.gap_1()
.child(Input::new(&self.file_input).text_xs().small())
.child(Input::new(&self.file_input).small())
.child(
Button::new("update-file-server")
.icon(IconName::Check)
@@ -197,9 +171,9 @@ impl Render for Preferences {
)
.child(
div()
.text_size(px(10.))
.text_style(TextStyle::Caption2)
.italic()
.text_color(cx.theme().text_placeholder)
.text_color(cx.theme().text_faint)
.child(SharedString::from("Only support blossom service")),
),
),
+5 -90
View File
@@ -1,6 +1,5 @@
use std::sync::Arc;
use ::settings::AppSettings;
use anyhow::Error;
use auto_update::AutoUpdater;
use chat::{ChatEvent, ChatRegistry};
@@ -15,11 +14,11 @@ use nostr_sdk::prelude::*;
use serde::Deserialize;
use smallvec::{SmallVec, smallvec};
use state::{NostrRegistry, StateEvent};
use theme::{ActiveTheme, SIDEBAR_WIDTH, Theme, ThemeRegistry};
use ui::button::{Button, ButtonVariants};
use theme::{ActiveTheme, TextStyle, Typeset as _, SIDEBAR_WIDTH, Theme};
use ui::button::Button;
use ui::dock::{self, DockArea, DockLayout, DockPlacement, Panel, PanelHandle};
use ui::notification::{Notification, NotificationKind};
use ui::{IconName, Root, Sizable, WindowExtension, h_flex, v_flex};
use ui::{Root, WindowExtension, v_flex};
use crate::dialogs::restore::RestoreEncryption;
use crate::dialogs::{join_group, new_chat, new_group, profile, relays, settings};
@@ -40,7 +39,6 @@ struct MsgRelayNotification;
#[derive(Action, Clone, PartialEq, Eq, Deserialize)]
#[action(namespace = workspace, no_json)]
enum Command {
ToggleTheme,
Update,
RefreshMessagingRelays,
BackupEncryption,
@@ -327,9 +325,6 @@ impl Workspace {
Command::ResetEncryption => {
self.confirm_reset_encryption(window, cx);
}
Command::ToggleTheme => {
self.theme_selector(window, cx);
}
Command::BackupEncryption => {
let device = DeviceRegistry::global(cx).downgrade();
let save_dialog = cx.prompt_for_new_path(download_dir(), Some("encryption.txt"));
@@ -420,12 +415,12 @@ impl Workspace {
.child(
v_flex()
.gap_1()
.text_sm()
.text_style(TextStyle::Callout)
.child(SharedString::from(ENC_MSG))
.child(
div()
.italic()
.text_color(cx.theme().text_danger)
.text_color(cx.theme().danger)
.child(SharedString::from(ENC_WARN)),
),
)
@@ -448,86 +443,6 @@ impl Workspace {
.child(restore.clone())
});
}
fn theme_selector(&mut self, window: &mut Window, cx: &mut Context<Self>) {
window.open_dialog(cx, move |this, _window, cx| {
let registry = ThemeRegistry::global(cx);
let themes = registry.read(cx).themes();
this.width(px(520.))
.show_close(true)
.title("Select theme")
.child(v_flex().gap_2().w_full().children({
let mut items = vec![];
for (ix, (path, theme)) in themes.iter().enumerate() {
items.push(
h_flex()
.id(ix)
.group("")
.px_2()
.h_8()
.w_full()
.justify_between()
.rounded(cx.theme().radius)
.bg(cx.theme().ghost_element_background)
.hover(|this| this.bg(cx.theme().ghost_element_hover))
.child(
h_flex()
.gap_1p5()
.flex_1()
.text_sm()
.child(theme.name.clone())
.child(
div()
.text_xs()
.italic()
.text_color(cx.theme().text_muted)
.child(theme.author.clone()),
),
)
.child(
h_flex()
.gap_1()
.invisible()
.group_hover("", |this| this.visible())
.child(
Button::new(format!("url-{ix}"))
.icon(IconName::Link)
.ghost()
.small()
.on_click({
let theme = theme.clone();
move |_ev, _window, cx| {
cx.open_url(&theme.url);
}
}),
)
.child(
Button::new(format!("set-{ix}"))
.icon(IconName::Check)
.primary()
.small()
.on_click({
let path = path.clone();
move |_ev, window, cx| {
let settings = AppSettings::global(cx);
let path = path.clone();
settings.update(cx, |this, cx| {
this.set_theme(path, window, cx);
})
}
}),
),
),
);
}
items
}))
});
}
}
impl Render for Workspace {
+7 -7
View File
@@ -1,12 +1,12 @@
use anyhow::Error;
use gpui::{
AnyElement, App, AppContext, ClipboardItem, Context, Entity, EventEmitter, FocusHandle,
Focusable, IntoElement, ParentElement, Render, SharedString, Styled, Task, Window, div,
Focusable, IntoElement, ParentElement, Render, SharedString, Styled, Task, Window, div, px,
};
use instant::Duration;
use nostr_sdk::prelude::*;
use state::USER_KEYRING;
use theme::ActiveTheme;
use theme::{ActiveTheme, TextStyle, Typeset as _};
use ui::button::{Button, ButtonVariants};
use ui::dock::{Panel, PanelEvent};
use ui::input::{Input, InputState};
@@ -132,24 +132,24 @@ impl Render for BackupPanel {
.w_full()
.child(
div()
.text_xs()
.text_style(TextStyle::Caption)
.text_color(cx.theme().text_muted)
.child(SharedString::from(MSG)),
)
.child(divider(cx))
.child(
v_flex()
.gap_2()
.gap(px(theme::SPACE))
.flex_1()
.w_full()
.text_sm()
.text_style(TextStyle::Callout)
.child(
v_flex()
.gap_1p5()
.w_full()
.child(
div()
.text_xs()
.text_style(TextStyle::Caption)
.font_semibold()
.text_color(cx.theme().text_muted)
.child(SharedString::from("Public Key:")),
@@ -162,7 +162,7 @@ impl Render for BackupPanel {
.w_full()
.child(
div()
.text_xs()
.text_style(TextStyle::Caption)
.font_semibold()
.text_color(cx.theme().text_muted)
.child(SharedString::from("Secret Key:")),
+21 -22
View File
@@ -6,14 +6,14 @@ use gpui::{
AnyElement, App, AppContext, Context, Entity, EventEmitter, FocusHandle, Focusable,
InteractiveElement, IntoElement, ParentElement, Render, ScrollStrategy, SharedString,
StatefulInteractiveElement, Styled, Subscription, Task, WeakEntity, Window, div, px, relative,
size,
size, transparent_black,
};
use gpui_base::{VirtualListScrollHandle, v_virtual_list};
use nip29::{Discovery, GroupCandidate, GroupKey, GroupsEvent, GroupsRegistry, Membership};
use nostr_sdk::prelude::{RelayUrl, Timestamp};
use settings::AppSettings;
use smallvec::{SmallVec, smallvec};
use theme::ActiveTheme;
use theme::{ActiveTheme, TextStyle, Typeset as _, button_radius, panel_radius};
use ui::avatar::Avatar;
use ui::button::{Button, ButtonVariants};
use ui::dock::{DockArea, DockPlacement, Panel, PanelEvent, PanelHandle};
@@ -268,7 +268,7 @@ impl BrowsePanel {
.min_w_0()
.child(
div()
.text_sm()
.text_style(TextStyle::Callout)
.font_semibold()
.line_height(relative(1.2))
.child("Public Groups"),
@@ -276,7 +276,7 @@ impl BrowsePanel {
.child(
div()
.truncate()
.text_xs()
.text_style(TextStyle::Caption)
.text_color(cx.theme().text_muted)
.map(|this| match &self.relay {
Some(relay) => {
@@ -294,13 +294,12 @@ impl BrowsePanel {
.w_full()
.max_w_64()
.px_1()
.rounded(cx.theme().radius)
.bg(cx.theme().surface_background)
.rounded(px(button_radius()))
.bg(cx.theme().surface)
.child(
Input::new(&self.input)
.appearance(false)
.small()
.text_sm()
.flex_1(),
)
.child(
@@ -375,26 +374,26 @@ impl BrowsePanel {
.min_w_0()
.h_full()
.overflow_hidden()
.rounded(cx.theme().radius)
.rounded(px(panel_radius()))
.cursor_pointer()
.border_1()
.border_color(cx.theme().border_transparent)
.bg(cx.theme().surface_background)
.border_color(transparent_black())
.bg(cx.theme().surface)
.hover(|this| {
this.bg(cx.theme().elevated_surface_background)
.border_color(cx.theme().border_focused)
this.bg(cx.theme().surface_raised)
.border_color(cx.theme().border_strong)
})
.child(
v_flex()
.flex_1()
.min_h_0()
.p_2()
.gap_2()
.gap(px(theme::SPACE))
.child(
h_flex()
.w_full()
.items_center()
.gap_2()
.gap(px(theme::SPACE))
.when(!hide_avatar, |this| {
this.child(Avatar::from_source(picture).seed(seed).flex_shrink_0())
})
@@ -404,7 +403,7 @@ impl BrowsePanel {
.min_w_0()
.child(
div()
.text_sm()
.text_style(TextStyle::Callout)
.truncate()
.font_semibold()
.line_height(relative(1.2))
@@ -413,8 +412,8 @@ impl BrowsePanel {
.child(
div()
.truncate()
.text_xs()
.text_color(cx.theme().text_placeholder)
.text_style(TextStyle::Caption)
.text_color(cx.theme().text_faint)
.child(relay),
),
),
@@ -422,7 +421,7 @@ impl BrowsePanel {
.child(
div()
.min_w_0()
.text_sm()
.text_style(TextStyle::Callout)
.text_color(cx.theme().text_muted)
.text_ellipsis()
.line_clamp(2)
@@ -443,7 +442,7 @@ impl BrowsePanel {
.child(Icon::new(IconName::Book))
.child(
div()
.text_sm()
.text_style(TextStyle::Callout)
.child(SharedString::from(format!("{members} members"))),
),
),
@@ -463,11 +462,11 @@ impl Panel for BrowsePanel {
fn title(&self, cx: &App) -> AnyElement {
h_flex()
.gap_1()
.text_xs()
.text_style(TextStyle::Caption)
.child(
Icon::new(IconName::Compass)
.small()
.text_color(cx.theme().icon_muted),
.text_color(cx.theme().text_faint),
)
.child(TITLE)
.into_any_element()
@@ -543,7 +542,7 @@ fn notice(text: &'static str, cx: &App) -> AnyElement {
h_flex()
.size_full()
.justify_center()
.text_sm()
.text_style(TextStyle::Callout)
.text_color(cx.theme().text_muted)
.child(text)
.into_any_element()
+13 -13
View File
@@ -5,14 +5,14 @@ use gpui::prelude::FluentBuilder;
use gpui::{
AnyElement, App, AppContext, Context, Entity, EventEmitter, FocusHandle, Focusable,
InteractiveElement, IntoElement, ParentElement, Render, SharedString, Styled, Subscription,
Task, TextAlign, Window, div, rems, retain_all,
Task, TextAlign, Window, div, px, rems, retain_all,
};
use instant::Duration;
use nostr_sdk::prelude::*;
use person::PersonRegistry;
use smallvec::{SmallVec, smallvec};
use state::NostrRegistry;
use theme::ActiveTheme;
use theme::{ActiveTheme, TextStyle, Typeset as _, button_radius, panel_radius};
use ui::avatar::Avatar;
use ui::button::{Button, ButtonVariants};
use ui::dock::{Panel, PanelEvent};
@@ -233,12 +233,12 @@ impl ContactListPanel {
.h_8()
.px_2()
.justify_between()
.rounded(cx.theme().radius)
.hover(|this| this.bg(cx.theme().ghost_element_hover))
.rounded(px(button_radius()))
.hover(|this| this.bg(cx.theme().element_hover))
.child(
h_flex()
.gap_2()
.text_sm()
.gap(px(theme::SPACE))
.text_style(TextStyle::Callout)
.child(
Avatar::new(profile.avatar())
.seed(profile.avatar_seed())
@@ -273,8 +273,8 @@ impl ContactListPanel {
.border_2()
.border_dashed()
.border_color(cx.theme().border)
.rounded(cx.theme().radius_lg)
.text_sm()
.rounded(px(panel_radius()))
.text_style(TextStyle::Callout)
.text_align(TextAlign::Center)
.child(SharedString::from("Please add some relays."))
}
@@ -308,13 +308,13 @@ impl Render for ContactListPanel {
.overflow_y_scrollbar()
.child(
v_flex()
.gap_2()
.gap(px(theme::SPACE))
.flex_1()
.w_full()
.text_sm()
.text_style(TextStyle::Callout)
.child(
div()
.text_xs()
.text_style(TextStyle::Caption)
.font_semibold()
.text_color(cx.theme().text_muted)
.child("New contact:"),
@@ -342,8 +342,8 @@ impl Render for ContactListPanel {
this.child(
div()
.italic()
.text_xs()
.text_color(cx.theme().text_danger)
.text_style(TextStyle::Caption)
.text_color(cx.theme().danger)
.child(error.clone()),
)
}),
+10 -24
View File
@@ -1,14 +1,13 @@
use gpui::{
AnyElement, App, AppContext, Context, Entity, EventEmitter, FocusHandle, Focusable,
IntoElement, ParentElement, Render, SharedString, Styled, Window, div, svg,
IntoElement, ParentElement, Render, SharedString, Styled, Window, div, px, svg,
};
use state::NostrRegistry;
use theme::ActiveTheme;
use theme::{ActiveTheme, TextStyle, Typeset as _};
use ui::button::{Button, ButtonVariants};
use ui::dock::{Panel, PanelEvent};
use ui::{Icon, IconName, Sizable, StyledExt, h_flex, v_flex};
use crate::Command;
use crate::dialogs::profile;
pub fn init(window: &mut Window, cx: &mut App) -> Entity<GreeterPanel> {
@@ -45,7 +44,7 @@ impl Panel for GreeterPanel {
fn title(&self, cx: &App) -> AnyElement {
h_flex()
.gap_1()
.text_xs()
.text_style(TextStyle::Caption)
.child(
svg()
.path("brand/coop.svg")
@@ -85,13 +84,13 @@ impl Render for GreeterPanel {
.child(
h_flex()
.mb_4()
.gap_2()
.gap(px(theme::SPACE))
.w_full()
.child(
svg()
.path("brand/coop.svg")
.size_12()
.text_color(cx.theme().icon_muted),
.text_color(cx.theme().text_faint),
)
.child(
v_flex()
@@ -103,7 +102,7 @@ impl Render for GreeterPanel {
)
.child(
div()
.text_xs()
.text_style(TextStyle::Caption)
.text_color(cx.theme().text_muted)
.child(SharedString::from(DESCRIPTION)),
),
@@ -111,13 +110,13 @@ impl Render for GreeterPanel {
)
.child(
v_flex()
.gap_2()
.gap(px(theme::SPACE))
.w_full()
.child(
h_flex()
.gap_2()
.gap(px(theme::SPACE))
.w_full()
.text_xs()
.text_style(TextStyle::Caption)
.font_semibold()
.text_color(cx.theme().text_muted)
.child(SharedString::from("Get Started"))
@@ -125,7 +124,7 @@ impl Render for GreeterPanel {
)
.child(
v_flex()
.gap_2()
.gap(px(theme::SPACE))
.w_full()
.justify_start()
.items_start()
@@ -138,19 +137,6 @@ impl Render for GreeterPanel {
.on_click(cx.listener(move |this, _, window, cx| {
this.open_profile(window, cx)
})),
)
.child(
Button::new("theme")
.icon(Icon::new(IconName::Moon))
.label("Change theme")
.ghost()
.small()
.on_click(cx.listener(move |_, _, window, cx| {
window.dispatch_action(
Box::new(Command::ToggleTheme),
cx,
);
})),
),
),
),
+3 -3
View File
@@ -2,7 +2,7 @@ use gpui::{
AnyElement, App, AppContext, Context, Entity, EventEmitter, FocusHandle, Focusable,
IntoElement, ParentElement, Render, SharedString, Styled, Window,
};
use theme::ActiveTheme;
use theme::{ActiveTheme, TextStyle, Typeset as _};
use ui::dock::{Panel, PanelEvent};
use ui::{Icon, IconName, Sizable, h_flex};
@@ -35,7 +35,7 @@ impl Panel for InboxPanel {
.child(
Icon::new(IconName::Inbox)
.small()
.text_color(cx.theme().icon_muted),
.text_color(cx.theme().text_faint),
)
.child(self.name.clone())
.into_any_element()
@@ -55,7 +55,7 @@ impl Render for InboxPanel {
h_flex()
.size_full()
.justify_center()
.text_sm()
.text_style(TextStyle::Callout)
.text_color(cx.theme().text_muted)
.child(self.name.clone())
}
+10 -10
View File
@@ -11,7 +11,7 @@ use nostr_sdk::prelude::*;
use person::PersonRegistry;
use settings::AppSettings;
use state::NostrRegistry;
use theme::ActiveTheme;
use theme::{ActiveTheme, TextStyle, Typeset as _};
use ui::avatar::Avatar;
use ui::menu::{DropdownMenu, PopupMenuItem};
use ui::nav::Nav;
@@ -131,7 +131,7 @@ impl Sidebar {
.flex_1()
.min_h_0()
.w_full()
.gap_2()
.gap(px(theme::SPACE))
.child(
h_flex()
.px_2()
@@ -149,7 +149,7 @@ impl Sidebar {
.min_w_0()
.child(
div()
.text_xs()
.text_style(TextStyle::Caption)
.truncate()
.line_height(relative(1.2))
.font_semibold()
@@ -157,7 +157,7 @@ impl Sidebar {
)
.child(
div()
.text_size(px(10.))
.text_style(TextStyle::Caption2)
.text_color(cx.theme().text_muted)
.child(total_members),
),
@@ -230,10 +230,10 @@ impl Sidebar {
Nav::new(label)
.label(label)
.suffix(Icon::new(icon).small().text_color(cx.theme().icon_muted))
.text_xs()
.suffix(Icon::new(icon).small().text_color(cx.theme().text_faint))
.text_style(TextStyle::Caption)
.font_semibold()
.text_color(cx.theme().text_placeholder)
.text_color(cx.theme().text_faint)
.on_click(cx.listener(move |this, _event, _window, cx| {
match section {
GroupSection::Admins => this.admins_open = !this.admins_open,
@@ -262,7 +262,7 @@ impl Sidebar {
Nav::new(public_key.to_hex())
.label(person.name())
.text_sm()
.text_style(TextStyle::Callout)
.font_medium()
.clickable(true)
.when(!hide_avatar, |this| {
@@ -277,8 +277,8 @@ impl Sidebar {
this.suffix(
div()
.truncate()
.text_xs()
.text_color(cx.theme().text_placeholder)
.text_style(TextStyle::Caption)
.text_color(cx.theme().text_faint)
.child(SharedString::from(roles.join(", "))),
)
})
+2 -3
View File
@@ -33,7 +33,7 @@ impl Sidebar {
.h(TABBAR_HEIGHT)
.flex_shrink_0()
.items_center()
.gap_2()
.gap(px(theme::SPACE))
.px_2()
.when(cfg!(target_os = "macos"), |this| {
this.pl(px(TRAFFIC_LIGHT_PADDING))
@@ -57,7 +57,6 @@ impl Sidebar {
)
.menu_with_icon("Relays", IconName::Relay, Box::new(Command::ShowRelayList))
.separator()
.menu_with_icon("Themes", IconName::Sun, Box::new(Command::ToggleTheme))
.menu_with_icon(
"Settings",
IconName::Settings,
@@ -121,7 +120,7 @@ impl Sidebar {
let staged = updater.read(cx).staged();
h_flex()
.gap_2()
.gap(px(theme::SPACE))
.when(!up_to_date, |this| {
this.child(
Button::new("update")
+3 -3
View File
@@ -6,7 +6,7 @@ use gpui::{
};
use nostr_sdk::prelude::*;
use state::NostrRegistry;
use theme::ActiveTheme;
use theme::{ActiveTheme, TextStyle, Typeset as _};
use ui::button::{Button, ButtonVariants};
use ui::dock::{DockPlacement, PanelHandle};
use ui::notification::Notification;
@@ -192,7 +192,7 @@ impl Sidebar {
.px_4()
.border_t_1()
.border_color(cx.theme().border)
.bg(cx.theme().background)
.bg(cx.theme().bg)
.child(
Button::new("create-chat")
.label(if self.selected_contacts.len() > 1 {
@@ -208,7 +208,7 @@ impl Sidebar {
.child(
h_flex()
.gap_1()
.text_xs()
.text_style(TextStyle::Caption)
.text_color(cx.theme().text_muted)
.child("Selected")
.child(
+10 -14
View File
@@ -8,7 +8,7 @@ use gpui::{
};
use nip29::GroupsRegistry;
use settings::AppSettings;
use theme::ActiveTheme;
use theme::{ActiveTheme, TextStyle, Typeset as _, control_radius};
use ui::nav_item::NavItem;
use ui::scroll::Scrollbar;
use ui::{Icon, IconName, Sizable, StyledExt, h_flex, v_flex};
@@ -61,7 +61,7 @@ impl Sidebar {
.flex_1()
.min_h_0()
.relative()
.gap_2()
.gap(px(theme::SPACE))
.child(
v_flex()
.px_2()
@@ -85,34 +85,30 @@ impl Sidebar {
.px_1()
.min_w_6()
.justify_center()
.text_size(px(10.))
.text_style(TextStyle::Caption2)
.text_color(cx.theme().text_muted)
.text_center()
.rounded(cx.theme().radius)
.bg(cx.theme().elevated_surface_background)
.rounded(px(control_radius()))
.bg(cx.theme().surface_raised)
.child(SharedString::from(
request_count.to_string(),
)),
)
.when(self.new_requests && !requests_open, |this| {
this.child(
div().size_1().rounded_full().bg(cx.theme().cursor),
div().size_1().rounded_full().bg(cx.theme().accent),
)
}),
)
})
.when(requests_open, |this| {
this.bg(cx.theme().ghost_element_active)
})
.when(requests_open, |this| this.bg(cx.theme().element_active))
.on_click(cx.listener(|this, _event, _window, cx| {
this.toggle_requests(cx);
})),
)
.child(
NavItem::new("contacts", "Contacts", Icon::new(IconName::Book).small())
.when(contacts_open, |this| {
this.bg(cx.theme().ghost_element_active)
})
.when(contacts_open, |this| this.bg(cx.theme().element_active))
.on_click(cx.listener(|this, _event, window, cx| {
this.toggle_contacts(window, cx);
})),
@@ -122,9 +118,9 @@ impl Sidebar {
this.child(
div()
.px_4()
.text_xs()
.text_style(TextStyle::Caption)
.font_semibold()
.text_color(cx.theme().text_placeholder)
.text_color(cx.theme().text_faint)
.child(list_title),
)
})
+8 -8
View File
@@ -7,7 +7,7 @@ use gpui::prelude::FluentBuilder;
use gpui::{
AnyElement, App, AppContext, Context, Entity, EventEmitter, FocusHandle, Focusable,
InteractiveElement, IntoElement, ObjectFit, ParentElement, Render, SharedString, Styled,
StyledImage, Subscription, Task, UniformListScrollHandle, WeakEntity, Window, div, img,
StyledImage, Subscription, Task, UniformListScrollHandle, WeakEntity, Window, div, img, px,
retain_all,
};
use instant::Duration;
@@ -15,7 +15,7 @@ use nip29::{Group, GroupKey, GroupsEvent, GroupsRegistry};
use nostr_sdk::prelude::*;
use smallvec::{SmallVec, smallvec};
use state::{FIND_DELAY, NostrRegistry, StateEvent};
use theme::{ActiveTheme, TABBAR_HEIGHT};
use theme::{ActiveTheme, TABBAR_HEIGHT, TextStyle, Typeset as _};
use ui::dock::{DockArea, Panel, PanelEvent};
use ui::indicator::Indicator;
use ui::input::{InputEvent, InputState};
@@ -276,8 +276,8 @@ impl Render for Sidebar {
.image_cache(retain_all("sidebar"))
.size_full()
.relative()
.gap_2()
.bg(cx.theme().surface_background)
.gap(px(theme::SPACE))
.bg(cx.theme().surface)
.when_some(current_user.as_ref(), |this, current_user| {
this.child(title_bar_drag_handlers(
self.render_user(current_user, cx),
@@ -326,17 +326,17 @@ impl Render for Sidebar {
.px_8()
.child(
h_flex()
.gap_2()
.gap(px(theme::SPACE))
.w_full()
.h_9()
.justify_center()
.bg(cx.theme().background.opacity(0.85))
.bg(cx.theme().bg.opacity(0.85))
.when(cx.theme().shadow, |this| this.shadow_md())
.rounded_full()
.text_xs()
.text_style(TextStyle::Caption)
.font_semibold()
.text_color(cx.theme().text_muted)
.child(Indicator::new().small().color(cx.theme().icon_accent))
.child(Indicator::new().small().color(cx.theme().accent))
.child("Getting messages..."),
),
)
+21 -21
View File
@@ -5,13 +5,13 @@ use common::TimestampExt;
use gpui::prelude::FluentBuilder;
use gpui::{
AnyElement, App, Context, Entity, IntoElement, ParentElement, SharedString, Styled, WeakEntity,
Window, div,
Window, div, px,
};
use nip29::Group;
use nostr_sdk::prelude::*;
use person::PersonRegistry;
use settings::AppSettings;
use theme::ActiveTheme;
use theme::{ActiveTheme, TextStyle, Typeset as _, button_radius};
use ui::avatar::Avatar;
use ui::dialog::DialogButtonProps;
use ui::dock::{ClosePanel, DockArea, DockPlacement, PanelHandle};
@@ -89,10 +89,10 @@ impl Sidebar {
Nav::new(label)
.label(label)
.suffix(Icon::new(icon).small().text_color(cx.theme().icon_muted))
.text_xs()
.suffix(Icon::new(icon).small().text_color(cx.theme().text_faint))
.text_style(TextStyle::Caption)
.font_semibold()
.text_color(cx.theme().text_placeholder)
.text_color(cx.theme().text_faint)
.on_click(cx.listener(move |this, _event, _window, cx| {
match section {
ListSection::Pins => this.pins_open = !this.pins_open,
@@ -112,9 +112,9 @@ impl Sidebar {
Nav::new(label)
.label(label)
.text_xs()
.text_style(TextStyle::Caption)
.font_semibold()
.text_color(cx.theme().text_placeholder)
.text_color(cx.theme().text_faint)
.into_any_element()
}
SidebarRow::Empty(text) => v_flex()
@@ -130,9 +130,9 @@ impl Sidebar {
.border_1()
.border_dashed()
.border_color(cx.theme().border)
.rounded(cx.theme().radius)
.text_xs()
.text_color(cx.theme().text_placeholder)
.rounded(px(button_radius()))
.text_style(TextStyle::Caption)
.text_color(cx.theme().text_faint)
.child(*text),
)
.into_any_element(),
@@ -149,7 +149,7 @@ impl Sidebar {
let nav = Nav::new(index)
.label(name)
.text_sm()
.text_style(TextStyle::Callout)
.when(!hide_avatar, |this| {
this.prefix(
Avatar::from_source(picture)
@@ -161,8 +161,8 @@ impl Sidebar {
.suffix(
div()
.font_normal()
.text_xs()
.text_color(cx.theme().text_placeholder)
.text_style(TextStyle::Caption)
.text_color(cx.theme().text_faint)
.child(created_at),
)
.on_click(move |_event, window, cx| {
@@ -204,7 +204,7 @@ impl Sidebar {
Nav::new(index)
.label(person.name())
.text_sm()
.text_style(TextStyle::Callout)
.when(!hide_avatar, |this| {
this.prefix(
Avatar::from_source(person.avatar())
@@ -230,7 +230,7 @@ impl Sidebar {
Nav::new(index)
.label(person.name())
.text_sm()
.text_style(TextStyle::Callout)
.when(!hide_avatar, |this| {
this.prefix(
Avatar::from_source(person.avatar())
@@ -265,7 +265,7 @@ impl Sidebar {
let nav = Nav::new(index)
.label(name)
.text_sm()
.text_style(TextStyle::Callout)
.when(!hide_avatar, |this| {
this.prefix(
Avatar::from_source(picture)
@@ -278,8 +278,8 @@ impl Sidebar {
this.suffix(
div()
.font_normal()
.text_xs()
.text_color(cx.theme().text_placeholder)
.text_style(TextStyle::Caption)
.text_color(cx.theme().text_faint)
.child(suffix),
)
})
@@ -339,7 +339,7 @@ impl Sidebar {
Nav::new(index)
.label(content)
.text_sm()
.text_style(TextStyle::Callout)
.font_medium()
.when(!hide_avatar, |this| {
this.prefix(
@@ -352,8 +352,8 @@ impl Sidebar {
.suffix(
div()
.font_normal()
.text_xs()
.text_color(cx.theme().text_placeholder)
.text_style(TextStyle::Caption)
.text_color(cx.theme().text_faint)
.child(detail),
)
.on_click(move |_event, window, cx| {
+5 -10
View File
@@ -4,12 +4,12 @@ use std::rc::Rc;
use chat::{ChatRegistry, Room};
use gpui::{
AnyElement, App, Context, Entity, IntoElement, ParentElement, SharedString, Styled, Task,
Window, div, uniform_list,
Window, div, px, uniform_list,
};
use nip29::{Group, GroupsRegistry};
use nostr_sdk::prelude::*;
use state::{FIND_LIMIT, NostrRegistry};
use theme::ActiveTheme;
use theme::{ActiveTheme, button_radius};
use ui::button::{Button, ButtonVariants};
use ui::input::Input;
use ui::scroll::Scrollbar;
@@ -201,14 +201,9 @@ impl Sidebar {
.px_1p5()
.gap_1()
.w_full()
.rounded(cx.theme().radius)
.bg(cx.theme().elevated_surface_background)
.child(
Input::new(&self.find_input)
.appearance(false)
.small()
.text_xs(),
)
.rounded(px(button_radius()))
.bg(cx.theme().surface_raised)
.child(Input::new(&self.find_input).appearance(false).small())
.child(
Button::new("sidebar-global")
.icon(IconName::Compass)