From 5cf729fe283f248388d3c08d23fc899cfbba8c34 Mon Sep 17 00:00:00 2001 From: Mike Dilger Date: Mon, 1 Jul 2024 10:14:36 +1200 Subject: [PATCH] Remove FeedProperties in theme - was dead code --- gossip-bin/src/ui/feed/mod.rs | 11 +++-------- gossip-bin/src/ui/theme/default.rs | 8 ++++---- gossip-bin/src/ui/theme/mod.rs | 23 +++++++++-------------- 3 files changed, 16 insertions(+), 26 deletions(-) diff --git a/gossip-bin/src/ui/feed/mod.rs b/gossip-bin/src/ui/feed/mod.rs index 5ccb7497..61125f1c 100644 --- a/gossip-bin/src/ui/feed/mod.rs +++ b/gossip-bin/src/ui/feed/mod.rs @@ -1,4 +1,3 @@ -use super::theme::FeedProperties; use super::{widgets, GossipUi, Page}; use eframe::egui::{self, Align, Rect}; use egui::{Context, RichText, Ui, Vec2}; @@ -277,10 +276,6 @@ fn render_a_feed( scroll_area_id: &str, offer_load_more: bool, ) { - let feed_properties = FeedProperties { - is_thread: threaded, - }; - let feed_newest_at_bottom = GLOBALS.storage.read_setting_feed_newest_at_bottom(); // Do not render feed while switching or we will lose our scroll offset. @@ -303,9 +298,9 @@ fn render_a_feed( top: 0.0, bottom: 0.0, }) - .rounding(app.theme.feed_scroll_rounding(&feed_properties)) - .fill(app.theme.feed_scroll_fill(&feed_properties)) - .stroke(app.theme.feed_scroll_stroke(&feed_properties)) + .rounding(app.theme.feed_scroll_rounding()) + .fill(app.theme.feed_scroll_fill()) + .stroke(app.theme.feed_scroll_stroke()) .show(ui, |ui| { if feed_newest_at_bottom { ui.add_space(50.0); diff --git a/gossip-bin/src/ui/theme/default.rs b/gossip-bin/src/ui/theme/default.rs index 0cf67741..60ca1e89 100644 --- a/gossip-bin/src/ui/theme/default.rs +++ b/gossip-bin/src/ui/theme/default.rs @@ -1,4 +1,4 @@ -use super::{FeedProperties, NoteRenderData, ThemeDef}; +use super::{NoteRenderData, ThemeDef}; use crate::ui::HighlightType; use eframe::egui::style::{Selection, WidgetVisuals, Widgets}; use eframe::egui::{ @@ -740,13 +740,13 @@ impl ThemeDef for DefaultTheme { } // feed styling - fn feed_scroll_rounding(_feed: &FeedProperties) -> Rounding { + fn feed_scroll_rounding() -> Rounding { Rounding::ZERO } - fn feed_scroll_fill(_dark_mode: bool, _feed: &FeedProperties) -> Color32 { + fn feed_scroll_fill(_dark_mode: bool) -> Color32 { Color32::from_rgba_premultiplied(0, 0, 0, 0) // Transparent separator } - fn feed_scroll_stroke(_dark_mode: bool, _feed: &FeedProperties) -> Stroke { + fn feed_scroll_stroke(_dark_mode: bool) -> Stroke { Stroke::NONE } fn feed_post_separator_stroke(_dark_mode: bool, _post: &NoteRenderData) -> Stroke { diff --git a/gossip-bin/src/ui/theme/mod.rs b/gossip-bin/src/ui/theme/mod.rs index 86851627..9bc08303 100644 --- a/gossip-bin/src/ui/theme/mod.rs +++ b/gossip-bin/src/ui/theme/mod.rs @@ -47,11 +47,6 @@ impl Theme { } } -pub struct FeedProperties { - /// This is a thread - pub is_thread: bool, -} - macro_rules! theme_dispatch { ($($variant:path, $class:ident, $name:literal),+) => { @@ -370,21 +365,21 @@ macro_rules! theme_dispatch { } } - pub fn feed_scroll_fill(&self, feed: &FeedProperties) -> Color32 { + pub fn feed_scroll_fill(&self) -> Color32 { match self.variant { - $( $variant => $class::feed_scroll_fill(self.dark_mode, feed), )+ + $( $variant => $class::feed_scroll_fill(self.dark_mode), )+ } } - pub fn feed_scroll_stroke(&self, feed: &FeedProperties) -> Stroke { + pub fn feed_scroll_stroke(&self) -> Stroke { match self.variant { - $( $variant => $class::feed_scroll_stroke(self.dark_mode, feed), )+ + $( $variant => $class::feed_scroll_stroke(self.dark_mode), )+ } } - pub fn feed_scroll_rounding(&self, feed: &FeedProperties) -> Rounding { + pub fn feed_scroll_rounding(&self) -> Rounding { match self.variant { - $( $variant => $class::feed_scroll_rounding(feed), )+ + $( $variant => $class::feed_scroll_rounding(), )+ } } @@ -601,9 +596,9 @@ pub trait ThemeDef: Send + Sync { fn input_bg_color(dark_mode: bool) -> eframe::egui::Color32; // feed styling - fn feed_scroll_rounding(feed: &FeedProperties) -> Rounding; - fn feed_scroll_fill(dark_mode: bool, feed: &FeedProperties) -> Color32; - fn feed_scroll_stroke(dark_mode: bool, feed: &FeedProperties) -> Stroke; + fn feed_scroll_rounding() -> Rounding; + fn feed_scroll_fill(dark_mode: bool) -> Color32; + fn feed_scroll_stroke(dark_mode: bool) -> Stroke; fn feed_post_separator_stroke(dark_mode: bool, post: &NoteRenderData) -> Stroke; fn feed_post_outer_indent(ui: &mut Ui, post: &NoteRenderData); fn feed_post_inner_indent(ui: &mut Ui, post: &NoteRenderData);