Remove vestigial code
This commit is contained in:
parent
8534fa4988
commit
eb7790ff8f
4 changed files with 10 additions and 27 deletions
22
src/app.rs
22
src/app.rs
|
|
@ -462,9 +462,6 @@ impl App {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn format_log_entries(&mut self) {
|
fn format_log_entries(&mut self) {
|
||||||
use chrono::{DateTime, Local, Timelike};
|
|
||||||
use std::collections::BTreeMap;
|
|
||||||
|
|
||||||
if self.log_view_frames.is_empty() {
|
if self.log_view_frames.is_empty() {
|
||||||
self.log_view_content = vec!["No log entries for this period.".to_string()];
|
self.log_view_content = vec!["No log entries for this period.".to_string()];
|
||||||
return;
|
return;
|
||||||
|
|
@ -829,20 +826,16 @@ impl App {
|
||||||
|
|
||||||
fn jump_to_previous_project(&mut self) {
|
fn jump_to_previous_project(&mut self) {
|
||||||
// Find the previous project and jump to its first entry
|
// Find the previous project and jump to its first entry
|
||||||
let mut current_date = String::new();
|
|
||||||
let mut current_project = String::new();
|
let mut current_project = String::new();
|
||||||
let mut selected_project = String::new();
|
let mut _selected_project = String::new();
|
||||||
let mut selected_date = String::new();
|
|
||||||
let mut frame_count = 0;
|
let mut frame_count = 0;
|
||||||
let mut previous_project_first_entry = None;
|
let mut previous_project_first_entry = None;
|
||||||
let mut last_different_project_entry = None;
|
let mut last_different_project_entry = None;
|
||||||
|
|
||||||
// Find which project we're currently in
|
// Find which project we're currently in
|
||||||
for line in &self.log_view_content.clone() {
|
for line in &self.log_view_content.clone() {
|
||||||
if !line.starts_with('\t') && !line.is_empty() && !line.starts_with(" ") {
|
if line.starts_with(" ") && !line.starts_with("\t") {
|
||||||
current_date = line.clone();
|
if !current_project.is_empty() && current_project != _selected_project {
|
||||||
} else 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;
|
last_different_project_entry = previous_project_first_entry;
|
||||||
}
|
}
|
||||||
current_project = line.clone();
|
current_project = line.clone();
|
||||||
|
|
@ -851,8 +844,7 @@ impl App {
|
||||||
|
|
||||||
if self.is_entry_line(line) {
|
if self.is_entry_line(line) {
|
||||||
if frame_count == self.log_view_selected {
|
if frame_count == self.log_view_selected {
|
||||||
selected_project = current_project.clone();
|
_selected_project = current_project.clone();
|
||||||
selected_date = current_date.clone();
|
|
||||||
// Jump to the last different project we saw
|
// Jump to the last different project we saw
|
||||||
if let Some(entry) = last_different_project_entry {
|
if let Some(entry) = last_different_project_entry {
|
||||||
self.log_view_selected = entry;
|
self.log_view_selected = entry;
|
||||||
|
|
@ -920,7 +912,7 @@ impl App {
|
||||||
fn jump_to_previous_day(&mut self) {
|
fn jump_to_previous_day(&mut self) {
|
||||||
// Find the previous day and jump to its first entry
|
// Find the previous day and jump to its first entry
|
||||||
let mut current_date = String::new();
|
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 frame_count = 0;
|
||||||
let mut last_different_day_entry = None;
|
let mut last_different_day_entry = None;
|
||||||
let mut previous_day_first_entry = None;
|
let mut previous_day_first_entry = None;
|
||||||
|
|
@ -928,7 +920,7 @@ impl App {
|
||||||
// Find which day we're currently in
|
// Find which day we're currently in
|
||||||
for line in &self.log_view_content.clone() {
|
for line in &self.log_view_content.clone() {
|
||||||
if !line.starts_with('\t') && !line.is_empty() && !line.starts_with(" ") {
|
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;
|
last_different_day_entry = previous_day_first_entry;
|
||||||
}
|
}
|
||||||
current_date = line.clone();
|
current_date = line.clone();
|
||||||
|
|
@ -937,7 +929,7 @@ impl App {
|
||||||
|
|
||||||
if self.is_entry_line(line) {
|
if self.is_entry_line(line) {
|
||||||
if frame_count == self.log_view_selected {
|
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
|
// Jump to the last different day we saw
|
||||||
if let Some(entry) = last_different_day_entry {
|
if let Some(entry) = last_different_day_entry {
|
||||||
self.log_view_selected = entry;
|
self.log_view_selected = entry;
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,6 @@ use std::path::PathBuf;
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
#[serde(default = "default_show_help_hint")]
|
#[serde(default = "default_show_help_hint")]
|
||||||
pub show_help_hint: bool,
|
pub show_help_hint: bool,
|
||||||
#[serde(default = "default_show_command_hints")]
|
|
||||||
pub show_command_hints: bool,
|
|
||||||
#[serde(default = "Vec::new")]
|
#[serde(default = "Vec::new")]
|
||||||
pub projects: Vec<String>,
|
pub projects: Vec<String>,
|
||||||
#[serde(default = "default_strict_projects")]
|
#[serde(default = "default_strict_projects")]
|
||||||
|
|
@ -17,10 +15,6 @@ fn default_show_help_hint() -> bool {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn default_show_command_hints() -> bool {
|
|
||||||
true
|
|
||||||
}
|
|
||||||
|
|
||||||
fn default_strict_projects() -> bool {
|
fn default_strict_projects() -> bool {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
@ -29,7 +23,6 @@ impl Default for Config {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
show_help_hint: default_show_help_hint(),
|
show_help_hint: default_show_help_hint(),
|
||||||
show_command_hints: default_show_command_hints(),
|
|
||||||
projects: Vec::new(),
|
projects: Vec::new(),
|
||||||
strict_projects: default_strict_projects(),
|
strict_projects: default_strict_projects(),
|
||||||
}
|
}
|
||||||
|
|
@ -49,6 +42,7 @@ impl Config {
|
||||||
Ok(serde_yaml::from_str(&contents)?)
|
Ok(serde_yaml::from_str(&contents)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn save(&self) -> anyhow::Result<()> {
|
pub fn save(&self) -> anyhow::Result<()> {
|
||||||
let path = Self::config_path()?;
|
let path = Self::config_path()?;
|
||||||
let yaml = serde_yaml::to_string(&self)?;
|
let yaml = serde_yaml::to_string(&self)?;
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,7 @@ impl AppState {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn add_recent_item(&mut self, item: TimeItem) {
|
pub fn add_recent_item(&mut self, item: TimeItem) {
|
||||||
self.recent_items.insert(0, item);
|
self.recent_items.insert(0, item);
|
||||||
if self.recent_items.len() > 20 {
|
if self.recent_items.len() > 20 {
|
||||||
|
|
|
||||||
|
|
@ -281,9 +281,6 @@ fn render_config_help(frame: &mut Frame, _app: &App) {
|
||||||
"show_help_hint: true/false",
|
"show_help_hint: true/false",
|
||||||
" Controls visibility of the help hint in the bottom bar",
|
" 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]",
|
"projects: [list of strings]",
|
||||||
" List of available project names",
|
" List of available project names",
|
||||||
"",
|
"",
|
||||||
|
|
@ -292,7 +289,6 @@ fn render_config_help(frame: &mut Frame, _app: &App) {
|
||||||
"",
|
"",
|
||||||
"Example configuration:",
|
"Example configuration:",
|
||||||
"show_help_hint: true",
|
"show_help_hint: true",
|
||||||
"show_command_hints: true",
|
|
||||||
"projects:",
|
"projects:",
|
||||||
" - project1",
|
" - project1",
|
||||||
" - project2",
|
" - project2",
|
||||||
|
|
@ -477,7 +473,7 @@ fn render_log_view(frame: &mut Frame, app: &App) {
|
||||||
// Determine what counts as an entry based on grouping mode
|
// Determine what counts as an entry based on grouping mode
|
||||||
let is_by_project = matches!(app.log_view_grouping, LogViewGrouping::ByProject);
|
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(" ") {
|
if !line.starts_with('\t') && !line.is_empty() && !line.starts_with(" ") {
|
||||||
current_date = line.clone();
|
current_date = line.clone();
|
||||||
} else if line.starts_with(" ") && !line.starts_with("\t") {
|
} else if line.starts_with(" ") && !line.starts_with("\t") {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue