claude-dashboard 0.2.2

A terminal TUI dashboard that renders Claude Code usage reports with token stats, project breakdowns, and language distribution.
Documentation
use std::collections::HashMap;
use chrono::NaiveDate;

use crate::data::models::ViewData;
use crate::llm::LlmReportType;
use super::{FocusSection, LoadState};

/// UI scroll state and focus tracking.
#[derive(Debug, Clone)]
pub struct AppUiState {
    pub focus_section: FocusSection,
    pub model_scroll: u16,
    pub lang_scroll: u16,
    pub tool_scroll: u16,
    pub project_scroll: u16,
}

impl Default for AppUiState {
    fn default() -> Self {
        AppUiState {
            focus_section: FocusSection::ModelBars,
            model_scroll: 0,
            lang_scroll: 0,
            tool_scroll: 0,
            project_scroll: 0,
        }
    }
}

/// LLM Summary tab state.
#[derive(Debug, Clone)]
pub struct AppLlmState {
    pub report_type: LlmReportType,
    pub data: Option<String>,
    pub thinking_data: Option<String>,
    pub thinking_mode: bool,
    pub selected_month: NaiveDate,
    pub selected_year: i32,
    pub scroll: u16,
    pub status_message: Option<String>,
    pub load_state: LoadState,
}

impl AppLlmState {
    pub fn new(month: NaiveDate, year: i32) -> Self {
        AppLlmState {
            report_type: LlmReportType::All,
            data: None,
            thinking_data: None,
            thinking_mode: false,
            selected_month: month,
            selected_year: year,
            scroll: 0,
            status_message: None,
            load_state: LoadState::Idle,
        }
    }
}

/// Cached view data and session summaries.
#[derive(Debug, Clone, Default)]
pub struct AppViewCache {
    pub monthly_cache: HashMap<(i32, u32), ViewData>,
    pub yearly_cache: HashMap<i32, ViewData>,
    pub overview_view_data: Option<ViewData>,
    pub current_view_data: Option<ViewData>,
    pub cached_sessions: Vec<crate::data::models::SessionSummary>,
    pub loaded: bool,
}