commit 0855186a8a54bbb1b8548908729a7485c7f6f667
parent 42f9ec97a6fbb13a53e00a736a3f2109c752adf9
Author: kernelkind <kernelkind@gmail.com>
Date: Fri, 29 Nov 2024 13:52:59 -0500
misc fixes
- add notedeck version number to support view & email body
- add milestone name below Damus logo in side panel
- remove search button in side panel
- remove fps counter & text mode in top bar
- remove 'add relay' button in settings view
Closes: #505
Signed-off-by: kernelkind <kernelkind@gmail.com>
Diffstat:
6 files changed, 43 insertions(+), 60 deletions(-)
diff --git a/src/app.rs b/src/app.rs
@@ -677,7 +677,7 @@ fn top_panel(ctx: &egui::Context) -> egui::TopBottomPanel {
.show_separator_line(false)
}
-fn render_panel(ctx: &egui::Context, app: &mut Damus) {
+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;
@@ -687,53 +687,6 @@ fn render_panel(ctx: &egui::Context, app: &mut Damus) {
{
ctx.set_visuals(new_visuals)
}
-
- if ui
- .add(egui::Button::new("A").frame(false))
- .on_hover_text("Text mode")
- .clicked()
- {
- app.textmode = !app.textmode;
- }
-
- /*
- if ui
- .add(egui::Button::new("+").frame(false))
- .on_hover_text("Add Timeline")
- .clicked()
- {
- app.n_panels += 1;
- }
-
- if app.n_panels != 1
- && ui
- .add(egui::Button::new("-").frame(false))
- .on_hover_text("Remove Timeline")
- .clicked()
- {
- app.n_panels -= 1;
- }
- */
-
- //#[cfg(feature = "profiling")]
- {
- ui.weak(format!(
- "FPS: {:.2}, {:10.1}ms",
- app.frame_history.fps(),
- app.frame_history.mean_frame_time() * 1e3
- ));
-
- /*
- if !app.timelines().count().is_empty() {
- ui.weak(format!(
- "{} notes",
- &app.timelines()
- .notes(ViewFilter::NotesAndReplies)
- .len()
- ));
- }
- */
- }
});
});
}
@@ -770,7 +723,7 @@ fn main_panel(style: &Style, narrow: bool) -> egui::CentralPanel {
}
fn render_damus_desktop(ctx: &egui::Context, app: &mut Damus) {
- render_panel(ctx, app);
+ render_panel(ctx);
#[cfg(feature = "profiling")]
puffin::profile_function!();
diff --git a/src/frame_history.rs b/src/frame_history.rs
@@ -24,10 +24,12 @@ impl FrameHistory {
self.frame_times.add(now, previous_frame_time); // projected
}
+ #[allow(unused)]
pub fn mean_frame_time(&self) -> f32 {
self.frame_times.average().unwrap_or_default()
}
+ #[allow(unused)]
pub fn fps(&self) -> f32 {
1.0 / self.frame_times.mean_time_interval().unwrap_or_default()
}
diff --git a/src/support.rs b/src/support.rs
@@ -29,7 +29,7 @@ impl Support {
static MAX_LOG_LINES: usize = 500;
static SUPPORT_EMAIL: &str = "support@damus.io";
-static EMAIL_TEMPLATE: &str = concat!("Commit hash: ", env!("GIT_COMMIT_HASH"), "\n\nDescribe the bug you have encountered:\n<-- your statement here -->\n\n===== Paste your log below =====\n\n");
+static EMAIL_TEMPLATE: &str = concat!("Notedeck ", env!("CARGO_PKG_VERSION"), "\nCommit hash: ", env!("GIT_COMMIT_HASH"), "\n\nDescribe the bug you have encountered:\n<-- your statement here -->\n\n===== Paste your log below =====\n\n");
impl Support {
pub fn refresh(&mut self) {
diff --git a/src/ui/relay.rs b/src/ui/relay.rs
@@ -20,11 +20,12 @@ impl View for RelayView<'_> {
);
});
- ui.with_layout(Layout::right_to_left(Align::Center), |ui| {
- if ui.add(add_relay_button()).clicked() {
- // TODO: navigate to 'add relay view'
- };
- });
+ // TODO: implement manually adding relays
+ // ui.with_layout(Layout::right_to_left(Align::Center), |ui| {
+ // if ui.add(add_relay_button()).clicked() {
+ // // TODO: navigate to 'add relay view'
+ // };
+ // });
});
ui.add_space(8.0);
@@ -111,6 +112,7 @@ fn get_right_side_width(status: &RelayStatus) -> f32 {
}
}
+#[allow(unused)]
fn add_relay_button() -> egui::Button<'static> {
Button::new("+ Add relay").min_size(Vec2::new(0.0, 32.0))
}
diff --git a/src/ui/side_panel.rs b/src/ui/side_panel.rs
@@ -1,4 +1,6 @@
-use egui::{vec2, Color32, InnerResponse, Layout, Margin, Separator, Stroke, Widget};
+use egui::{
+ vec2, Color32, InnerResponse, Label, Layout, Margin, RichText, Separator, Stroke, Widget,
+};
use tracing::info;
use crate::{
@@ -87,7 +89,9 @@ impl<'a> DesktopSidePanel<'a> {
let top_resp = ui
.with_layout(Layout::top_down(egui::Align::Center), |ui| {
let expand_resp = ui.add(expand_side_panel_button());
- ui.add_space(28.0);
+ ui.add_space(4.0);
+ ui.add(milestone_name());
+ ui.add_space(16.0);
let is_interactive = self
.selected_account
.is_some_and(|s| s.secret_key.is_some());
@@ -97,7 +101,7 @@ impl<'a> DesktopSidePanel<'a> {
} else {
compose_resp.on_hover_cursor(egui::CursorIcon::NotAllowed)
};
- let search_resp = ui.add(search_button());
+ // let search_resp = ui.add(search_button());
let column_resp = ui.add(add_column_button(dark_mode));
ui.add(Separator::default().horizontal().spacing(8.0).shrink(4.0));
@@ -112,8 +116,8 @@ impl<'a> DesktopSidePanel<'a> {
SidePanelAction::ComposeNote,
compose_resp,
))
- } else if search_resp.clicked() {
- Some(InnerResponse::new(SidePanelAction::Search, search_resp))
+ // } else if search_resp.clicked() {
+ // Some(InnerResponse::new(SidePanelAction::Search, search_resp))
} else if column_resp.clicked() {
Some(InnerResponse::new(SidePanelAction::Columns, column_resp))
} else {
@@ -341,6 +345,7 @@ fn compose_note_button(interactive: bool) -> impl Widget {
}
}
+#[allow(unused)]
fn search_button() -> impl Widget {
|ui: &mut egui::Ui| -> egui::Response {
let max_size = ICON_WIDTH * ICON_EXPANSION_MULTIPLE; // max size of the widget
@@ -416,6 +421,26 @@ fn support_button() -> impl Widget {
}
}
+fn milestone_name() -> impl Widget {
+ |ui: &mut egui::Ui| -> egui::Response {
+ ui.vertical_centered(|ui| {
+ let font = egui::FontId::new(
+ crate::app_style::get_font_size(
+ ui.ctx(),
+ &crate::app_style::NotedeckTextStyle::Small,
+ ),
+ egui::FontFamily::Name(crate::fonts::NamedFontFamily::Bold.as_str().into()),
+ );
+ ui.add(Label::new(
+ RichText::new("ALPHA")
+ .color(crate::colors::PURPLE)
+ .font(font),
+ ).selectable(false)).on_hover_text("Notedeck is an alpha product. Expect bugs and contact us when you run into issues.").on_hover_cursor(egui::CursorIcon::Help)
+ })
+ .inner
+ }
+}
+
mod preview {
use egui_extras::{Size, StripBuilder};
diff --git a/src/ui/support.rs b/src/ui/support.rs
@@ -75,6 +75,7 @@ impl<'a> SupportView<'a> {
.color(egui::Color32::RED),
);
}
+ ui.label(format!("Notedeck {}", env!("CARGO_PKG_VERSION")));
ui.label(format!("Commit hash: {}", env!("GIT_COMMIT_HASH")));
});
}