refactor: consolidate shared ui helpers and prune unused code

This commit is contained in:
2026-11-22 18:23:21 +07:00
parent 4a72f2b4a0
commit 9daee9d54d
82 changed files with 3607 additions and 7184 deletions
+1 -6
View File
@@ -1,12 +1,7 @@
use gpui::App;
use settings::{AppearanceMode, Settings};
use settings::AppearanceMode;
use ui::theme::{ThemeVariant, follow_system, set_mode_override};
/// Applies the persisted light/dark/system preference to the kit theme.
pub fn apply_appearance(settings: &Settings, cx: &mut App) {
apply_appearance_mode(settings.appearance, cx);
}
/// Applies one appearance mode to the kit theme.
pub fn apply_appearance_mode(mode: AppearanceMode, cx: &mut App) {
match mode {
+2 -2
View File
@@ -7,7 +7,7 @@ use gpui::{
AppContext as _, Context, Entity, InteractiveElement as _, IntoElement, ParentElement as _,
Render, Styled as _, Subscription, Window, div, px,
};
use helpers::apply_appearance;
use helpers::apply_appearance_mode;
use settings::SettingsStore;
use signed_state::{Backend, BackendEvent};
use ui::common::h_flex;
@@ -82,7 +82,7 @@ impl AppRoot {
subscriptions.push(cx.observe(&settings, |_this, store, cx| {
let settings = store.read(cx).settings().clone();
apply_appearance(&settings, cx);
apply_appearance_mode(settings.appearance, cx);
}));
let app = cx.entity().downgrade();
+9 -9
View File
@@ -45,15 +45,6 @@ impl Panel for SignedOutView {
}
}
/// One of the three banner photos, picked per process launch.
fn pick_banner() -> SharedString {
let nanos = SystemTime::now()
.duration_since(UNIX_EPOCH)
.map(|now| now.subsec_nanos())
.unwrap_or(0);
format!("backgrounds/banner{}.jpg", nanos % 3 + 1).into()
}
impl Render for SignedOutView {
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
let theme = cx.theme();
@@ -110,3 +101,12 @@ impl Render for SignedOutView {
.when_some(self.import.clone(), |el, view| el.child(view))
}
}
/// One of the three banner photos, picked per process launch.
fn pick_banner() -> SharedString {
let nanos = SystemTime::now()
.duration_since(UNIX_EPOCH)
.map(|now| now.subsec_nanos())
.unwrap_or(0);
format!("backgrounds/banner{}.jpg", nanos % 3 + 1).into()
}