Remove vestigial code

This commit is contained in:
Ian Keane 2025-11-23 12:11:46 -05:00
parent 8534fa4988
commit eb7790ff8f
4 changed files with 10 additions and 27 deletions

View file

@ -462,9 +462,6 @@ impl App {
}
fn format_log_entries(&mut self) {
use chrono::{DateTime, Local, Timelike};
use std::collections::BTreeMap;
if self.log_view_frames.is_empty() {
self.log_view_content = vec!["No log entries for this period.".to_string()];
return;
@ -829,20 +826,16 @@ impl App {
fn jump_to_previous_project(&mut self) {
// Find the previous project and jump to its first entry
let mut current_date = String::new();
let mut current_project = String::new();
let mut selected_project = String::new();
let mut selected_date = String::new();
let mut _selected_project = String::new();
let mut frame_count = 0;
let mut previous_project_first_entry = None;
let mut last_different_project_entry = None;
// Find which project we're currently in
for line in &self.log_view_content.clone() {
if !line.starts_with('\t') && !line.is_empty() && !line.starts_with(" ") {
current_date = line.clone();
} else if line.starts_with(" ") && !line.starts_with("\t") {
if !current_project.is_empty() && current_project != selected_project {
if line.starts_with(" ") && !line.starts_with("\t") {
if !current_project.is_empty() && current_project != _selected_project {
last_different_project_entry = previous_project_first_entry;
}
current_project = line.clone();
@ -851,8 +844,7 @@ impl App {
if self.is_entry_line(line) {
if frame_count == self.log_view_selected {
selected_project = current_project.clone();
selected_date = current_date.clone();
_selected_project = current_project.clone();
// Jump to the last different project we saw
if let Some(entry) = last_different_project_entry {
self.log_view_selected = entry;
@ -920,7 +912,7 @@ impl App {
fn jump_to_previous_day(&mut self) {
// Find the previous day and jump to its first entry
let mut current_date = String::new();
let mut selected_date = String::new();
let mut _selected_date = String::new();
let mut frame_count = 0;
let mut last_different_day_entry = None;
let mut previous_day_first_entry = None;
@ -928,7 +920,7 @@ impl App {
// Find which day we're currently in
for line in &self.log_view_content.clone() {
if !line.starts_with('\t') && !line.is_empty() && !line.starts_with(" ") {
if !current_date.is_empty() && current_date != selected_date {
if !current_date.is_empty() && current_date != _selected_date {
last_different_day_entry = previous_day_first_entry;
}
current_date = line.clone();
@ -937,7 +929,7 @@ impl App {
if self.is_entry_line(line) {
if frame_count == self.log_view_selected {
selected_date = current_date.clone();
_selected_date = current_date.clone();
// Jump to the last different day we saw
if let Some(entry) = last_different_day_entry {
self.log_view_selected = entry;

View file

@ -5,8 +5,6 @@ use std::path::PathBuf;
pub struct Config {
#[serde(default = "default_show_help_hint")]
pub show_help_hint: bool,
#[serde(default = "default_show_command_hints")]
pub show_command_hints: bool,
#[serde(default = "Vec::new")]
pub projects: Vec<String>,
#[serde(default = "default_strict_projects")]
@ -17,10 +15,6 @@ fn default_show_help_hint() -> bool {
true
}
fn default_show_command_hints() -> bool {
true
}
fn default_strict_projects() -> bool {
false
}
@ -29,7 +23,6 @@ impl Default for Config {
fn default() -> Self {
Self {
show_help_hint: default_show_help_hint(),
show_command_hints: default_show_command_hints(),
projects: Vec::new(),
strict_projects: default_strict_projects(),
}
@ -49,6 +42,7 @@ impl Config {
Ok(serde_yaml::from_str(&contents)?)
}
#[allow(dead_code)]
pub fn save(&self) -> anyhow::Result<()> {
let path = Self::config_path()?;
let yaml = serde_yaml::to_string(&self)?;

View file

@ -69,6 +69,7 @@ impl AppState {
Ok(())
}
#[allow(dead_code)]
pub fn add_recent_item(&mut self, item: TimeItem) {
self.recent_items.insert(0, item);
if self.recent_items.len() > 20 {

View file

@ -281,9 +281,6 @@ fn render_config_help(frame: &mut Frame, _app: &App) {
"show_help_hint: true/false",
" Controls visibility of the help hint in the bottom bar",
"",
"show_command_hints: true/false",
" Controls visibility of command hints in the bottom bar",
"",
"projects: [list of strings]",
" List of available project names",
"",
@ -292,7 +289,6 @@ fn render_config_help(frame: &mut Frame, _app: &App) {
"",
"Example configuration:",
"show_help_hint: true",
"show_command_hints: true",
"projects:",
" - project1",
" - project2",
@ -477,7 +473,7 @@ fn render_log_view(frame: &mut Frame, app: &App) {
// Determine what counts as an entry based on grouping mode
let is_by_project = matches!(app.log_view_grouping, LogViewGrouping::ByProject);
for (idx, line) in app.log_view_content.iter().enumerate() {
for (_idx, line) in app.log_view_content.iter().enumerate() {
if !line.starts_with('\t') && !line.is_empty() && !line.starts_with(" ") {
current_date = line.clone();
} else if line.starts_with(" ") && !line.starts_with("\t") {