From 5f9a5d6b69fa1982b3fb47a0c3d70751defa23ad Mon Sep 17 00:00:00 2001 From: 7000pctAUTO Date: Wed, 4 Feb 2026 15:45:46 +0000 Subject: [PATCH] Initial upload: GitPulse - Developer Productivity Analyzer CLI tool --- src/ui/dashboard.rs | 51 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 src/ui/dashboard.rs diff --git a/src/ui/dashboard.rs b/src/ui/dashboard.rs new file mode 100644 index 0000000..4456758 --- /dev/null +++ b/src/ui/dashboard.rs @@ -0,0 +1,51 @@ +use crate::config::Config; +use crate::models::AnalysisResult; + +pub struct DashboardLayout { + pub header_height: u16, + pub sidebar_width: u16, + pub footer_height: u16, +} + +impl DashboardLayout { + pub fn new() -> Self { + Self { + header_height: 3, + sidebar_width: 30, + footer_height: 1, + } + } + + pub fn content_area(&self, width: u16, height: u16) -> (u16, u16, u16, u16) { + let x = self.sidebar_width; + let y = self.header_height; + let w = width.saturating_sub(x); + let h = height.saturating_sub(y).saturating_sub(self.footer_height); + (x, y, w, h) + } +} + +pub fn render_dashboard( + _result: &AnalysisResult, + _config: &Config, +) { + println!("Dashboard rendering - TUI coming soon!"); +} + +pub fn calculate_metrics(result: &AnalysisResult) -> DashboardMetrics { + DashboardMetrics { + total_commits: result.commit_frequency.total_commits, + commits_per_day: result.commit_frequency.commits_per_day, + total_contributors: result.contributors.top_contributors.len(), + net_churn: result.code_churn.net_change, + refactoring_score: result.refactoring.refactoring_score, + } +} + +pub struct DashboardMetrics { + pub total_commits: usize, + pub commits_per_day: f64, + pub total_contributors: usize, + pub net_churn: i64, + pub refactoring_score: f64, +}