Initial upload: GitPulse - Developer Productivity Analyzer CLI tool
This commit is contained in:
51
src/ui/dashboard.rs
Normal file
51
src/ui/dashboard.rs
Normal file
@@ -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,
|
||||
}
|
||||
Reference in New Issue
Block a user