This commit is contained in:
2026-10-23 11:06:34 +07:00
parent 1c00bc7956
commit e4ebe96077
10 changed files with 200 additions and 182 deletions
+41 -37
View File
@@ -6,15 +6,14 @@ use gpui::{
use gpui_kit::assets::IconName;
use gpui_kit::base::StyledExt as _;
use gpui_kit::component::button::{Button, ButtonVariants};
use gpui_kit::component::form::field;
use gpui_kit::component::group_box::{GroupBox, GroupBoxVariants};
use gpui_kit::component::input::{Input, InputState};
use gpui_kit::component::menu::{DropdownMenu, PopupMenuItem};
use gpui_kit::component::notification::Notification;
use gpui_kit::component::switch::Switch;
use gpui_kit::component::{ActiveTheme, Disableable, Sizable, WindowExt, h_flex, v_flex};
use settings::AppSettings;
use settings::AppearanceMode;
use settings::{AppSettings, AppearanceMode};
use ui::settings_row;
pub fn init(window: &mut Window, cx: &mut App) -> Entity<Preferences> {
cx.new(|cx| Preferences::new(window, cx))
@@ -114,28 +113,35 @@ impl Render for Preferences {
.id("general")
.title("General")
.fill()
.child(field().label("Screening").description(SCREENING).child(
.child(settings_row(
"Screening",
SCREENING,
Switch::new("screening").checked(screening).on_click(
move |_, _window, cx| {
AppSettings::update_screening(!screening, cx);
},
),
cx,
))
.child(
field().label("Web of Trust").description(WOT).child(
Switch::new("wot-auto-trust")
.checked(wot_auto_trust)
.on_click(move |_, _window, cx| {
AppSettings::update_wot_auto_trust(!wot_auto_trust, cx);
}),
),
)
.child(field().label("Hide user avatar").description(AVATAR).child(
.child(settings_row(
"Web of Trust",
WOT,
Switch::new("wot-auto-trust")
.checked(wot_auto_trust)
.on_click(move |_, _window, cx| {
AppSettings::update_wot_auto_trust(!wot_auto_trust, cx);
}),
cx,
))
.child(settings_row(
"Hide user avatar",
AVATAR,
Switch::new("avatar").checked(hide_avatar).on_click(
move |_, _window, cx| {
AppSettings::update_hide_avatar(!hide_avatar, cx);
},
),
cx,
)),
)
.child(
@@ -179,19 +185,17 @@ impl Render for Preferences {
.id("background")
.title("Background")
.fill()
.child(
field()
.label("Panel background")
.description(BACKGROUND)
.child(
Switch::new("panel-background")
.checked(panel_background)
.on_click(move |_, _window, cx| {
AppSettings::update_panel_background(!panel_background, cx);
cx.refresh_windows();
}),
),
)
.child(settings_row(
"Panel background",
BACKGROUND,
Switch::new("panel-background")
.checked(panel_background)
.on_click(move |_, _window, cx| {
AppSettings::update_panel_background(!panel_background, cx);
cx.refresh_windows();
}),
cx,
))
.child(
h_flex()
.gap_3()
@@ -245,16 +249,16 @@ impl Render for Preferences {
.id("experiments")
.title("Experiments")
.fill()
.child(
field()
.label("Decoupling Encryption Key")
.description(NIP4E)
.child(Switch::new("nip4e").checked(nip4e).on_click(
move |_, _window, cx| {
AppSettings::update_nip4e(!nip4e, cx);
},
)),
),
.child(settings_row(
"Decoupling Encryption Key",
NIP4E,
Switch::new("nip4e")
.checked(nip4e)
.on_click(move |_, _window, cx| {
AppSettings::update_nip4e(!nip4e, cx);
}),
cx,
)),
)
.child(
GroupBox::new()