cleaner UI

This commit is contained in:
2025-12-02 19:50:12 +01:00
parent 75df916d97
commit c24d94ca2b
5 changed files with 194 additions and 66 deletions

View File

@@ -7,6 +7,7 @@ mod highlight;
mod line_index;
mod search;
mod tab_manager;
mod theme;
mod types;
mod ui;
@@ -38,7 +39,11 @@ fn main() -> eframe::Result {
eframe::run_native(
"RLogg",
options,
Box::new(move |_cc| Ok(Box::new(LogViewerApp::new(config)))),
Box::new(move |cc| {
// Apply the modern dark purple theme
theme::apply_theme(&cc.egui_ctx);
Ok(Box::new(LogViewerApp::new(config)))
}),
)
}
@@ -219,18 +224,44 @@ impl eframe::App for LogViewerApp {
self.save_config();
}
// Render filtered view
// Render filtered view with improved styling
let show_filtered = !self.search_panel_state.query.is_empty();
let highlight_rules = self.highlight_manager.rules.clone();
if show_filtered {
if let Some(tab) = self.active_tab_mut() {
if !tab.filtered_lines.is_empty() {
let palette = theme::get_palette();
egui::TopBottomPanel::bottom("filtered_view")
.resizable(true)
.default_height(200.0)
.default_height(250.0)
.min_height(150.0)
.show(ctx, |ui| {
ui.heading("Filtered View");
// Styled header
let header_frame = egui::Frame::none()
.fill(palette.bg_secondary)
.inner_margin(egui::Margin::symmetric(12.0, 8.0));
header_frame.show(ui, |ui| {
ui.horizontal(|ui| {
let icon = egui::RichText::new("🔍")
.size(16.0);
ui.label(icon);
let title = egui::RichText::new("Search Results")
.size(16.0)
.color(palette.text_primary)
.strong();
ui.label(title);
let count = egui::RichText::new(format!("({} matches)", tab.filtered_lines.len()))
.size(14.0)
.color(palette.accent_bright);
ui.label(count);
});
});
ui.separator();
render_log_view(
@@ -249,12 +280,49 @@ impl eframe::App for LogViewerApp {
// Handle keyboard input
self.handle_keyboard_input(ctx);
// Render main view
// Render main view with improved styling
egui::CentralPanel::default().show(ctx, |ui| {
ui.heading("Main Log View");
ui.separator();
let palette = theme::get_palette();
if let Some(tab) = self.active_tab_mut() {
// Styled header
let header_frame = egui::Frame::none()
.fill(palette.bg_secondary)
.inner_margin(egui::Margin::symmetric(12.0, 8.0));
header_frame.show(ui, |ui| {
ui.horizontal(|ui| {
let icon = egui::RichText::new("📄")
.size(16.0);
ui.label(icon);
let title = egui::RichText::new("Log View")
.size(16.0)
.color(palette.text_primary)
.strong();
ui.label(title);
// Show filename
if let Some(filename) = tab.file_path.file_name() {
ui.add_space(8.0);
let filename_text = egui::RichText::new(format!("{}", filename.to_string_lossy()))
.size(14.0)
.color(palette.text_secondary);
ui.label(filename_text);
}
// Show line count
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
let line_count = egui::RichText::new(format!("{} lines", tab.line_index.total_lines))
.size(13.0)
.color(palette.text_muted);
ui.label(line_count);
});
});
});
ui.separator();
render_log_view(
ui,
LogViewContext {
@@ -265,7 +333,27 @@ impl eframe::App for LogViewerApp {
);
} else {
ui.centered_and_justified(|ui| {
ui.label("Click 'Open File' to load a log file");
ui.vertical_centered(|ui| {
ui.add_space(40.0);
let icon = egui::RichText::new("📂")
.size(48.0);
ui.label(icon);
ui.add_space(16.0);
let text = egui::RichText::new("No file loaded")
.size(18.0)
.color(palette.text_secondary);
ui.label(text);
ui.add_space(8.0);
let hint = egui::RichText::new("Click 'Open File' in the menu to get started")
.size(14.0)
.color(palette.text_muted);
ui.label(hint);
});
});
}
});