notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

commit 65537b28fd8538a4a034b1eeb3d0d944623069b0
parent 800fb920a284d2f422ac454d1b1a10d41697ade2
Author: William Casarin <jb55@jb55.com>
Date:   Fri, 29 Nov 2024 11:59:36 -0800

ui: remove top panel

Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
Msrc/app.rs | 37-------------------------------------
Msrc/ui/side_panel.rs | 10+++++++++-
2 files changed, 9 insertions(+), 38 deletions(-)

diff --git a/src/app.rs b/src/app.rs @@ -2,7 +2,6 @@ use crate::{ accounts::{Accounts, AccountsRoute}, app_creation::setup_cc, app_size_handler::AppSizeHandler, - app_style::user_requested_visuals_change, args::Args, column::{Column, Columns}, draft::Drafts, @@ -658,42 +657,7 @@ fn circle_icon(ui: &mut egui::Ui, openness: f32, response: &egui::Response) { } */ -fn top_panel(ctx: &egui::Context) -> egui::TopBottomPanel { - let top_margin = egui::Margin { - top: 4.0, - left: 8.0, - right: 8.0, - ..Default::default() - }; - - let frame = Frame { - inner_margin: top_margin, - fill: ctx.style().visuals.panel_fill, - ..Default::default() - }; - - egui::TopBottomPanel::top("top_panel") - .frame(frame) - .show_separator_line(false) -} - -fn render_panel(ctx: &egui::Context) { - top_panel(ctx).show(ctx, |ui| { - ui.with_layout(egui::Layout::right_to_left(egui::Align::TOP), |ui| { - ui.visuals_mut().button_frame = false; - - if let Some(new_visuals) = - user_requested_visuals_change(ui::is_oled(), ctx.style().visuals.dark_mode, ui) - { - ctx.set_visuals(new_visuals) - } - }); - }); -} - fn render_damus_mobile(ctx: &egui::Context, app: &mut Damus) { - //render_panel(ctx, app, 0); - #[cfg(feature = "profiling")] puffin::profile_function!(); @@ -723,7 +687,6 @@ fn main_panel(style: &Style, narrow: bool) -> egui::CentralPanel { } fn render_damus_desktop(ctx: &egui::Context, app: &mut Damus) { - render_panel(ctx); #[cfg(feature = "profiling")] puffin::profile_function!(); diff --git a/src/ui/side_panel.rs b/src/ui/side_panel.rs @@ -5,7 +5,7 @@ use tracing::info; use crate::{ accounts::AccountsRoute, - colors, + app_style, colors, column::{Column, Columns}, imgcache::ImageCache, route::Route, @@ -131,6 +131,14 @@ impl<'a> DesktopSidePanel<'a> { let pfp_resp = self.pfp_button(ui); let settings_resp = ui.add(settings_button(dark_mode)); + if let Some(new_visuals) = app_style::user_requested_visuals_change( + super::is_oled(), + ui.ctx().style().visuals.dark_mode, + ui, + ) { + ui.ctx().set_visuals(new_visuals) + } + let support_resp = ui.add(support_button()); let optional_inner = if pfp_resp.clicked() {