From cf21794b19efbc34aa13f72d8c458035d755af95 Mon Sep 17 00:00:00 2001 From: 7000pctAUTO Date: Wed, 4 Feb 2026 15:45:45 +0000 Subject: [PATCH] Initial upload: GitPulse - Developer Productivity Analyzer CLI tool --- src/ui/app.rs | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 src/ui/app.rs diff --git a/src/ui/app.rs b/src/ui/app.rs new file mode 100644 index 0000000..9b70e0e --- /dev/null +++ b/src/ui/app.rs @@ -0,0 +1,69 @@ +use crate::config::Config; +use crate::models::AnalysisResult; +use anyhow::Result; +use std::path::PathBuf; + +pub enum AppState { + Overview, + Contributors, + Churn, + Refactoring, +} + +pub struct GitPulseApp { + pub current_view: AppState, + pub analysis_result: Option, + pub config: Config, + pub should_quit: bool, +} + +impl GitPulseApp { + pub fn new(config: Config) -> Self { + Self { + current_view: AppState::Overview, + analysis_result: None, + config, + should_quit: false, + } + } + + pub fn set_result(&mut self, result: AnalysisResult) { + self.analysis_result = Some(result); + } + + pub fn next_view(&mut self) { + self.current_view = match self.current_view { + AppState::Overview => AppState::Contributors, + AppState::Contributors => AppState::Churn, + AppState::Churn => AppState::Refactoring, + AppState::Refactoring => AppState::Overview, + }; + } + + pub fn previous_view(&mut self) { + self.current_view = match self.current_view { + AppState::Overview => AppState::Refactoring, + AppState::Contributors => AppState::Overview, + AppState::Churn => AppState::Contributors, + AppState::Refactoring => AppState::Churn, + }; + } + + pub fn handle_key(&mut self, key: char) { + match key { + 'q' | 'Q' | '\x1b' => self.should_quit = true, + 'n' | '\t' => self.next_view(), + 'p' | '\x1b' => self.previous_view(), + 'r' | 'R' => { + self.should_quit = true; + } + _ => {} + } + } +} + +pub fn run(_repo_path: Option, _config: &Config, _verbose: bool) -> Result<()> { + println!("Dashboard feature coming soon!"); + println!("Use 'gitpulse analyze' for text-based output."); + Ok(()) +}