feat: add todo management feature; implement todo content tracking and display in the UI
This commit is contained in:
@@ -303,6 +303,20 @@ pub fn apply_action(state: &mut AppStateRest, action: Action) {
|
||||
state.misc.tick_count = state.misc.tick_count.wrapping_add(1);
|
||||
let now_ms = chrono::Utc::now().timestamp_millis();
|
||||
state.misc.drain_expired_toasts(now_ms);
|
||||
|
||||
if state.misc.tick_count.is_multiple_of(10) {
|
||||
let todo_path = state.session_dir.join("todo.md");
|
||||
if let Ok(content) = std::fs::read_to_string(&todo_path) {
|
||||
if content != state.misc.todo_content {
|
||||
state.misc.todo_content = content;
|
||||
state.dirty = true;
|
||||
}
|
||||
} else if !state.misc.todo_content.is_empty() {
|
||||
state.misc.todo_content.clear();
|
||||
state.dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Background API connectivity check — runs on a background thread
|
||||
// every ~1s while disconnected, every ~30s while connected, so the
|
||||
// status bar reflects real API availability without user input.
|
||||
|
||||
@@ -278,6 +278,7 @@ pub struct MiscState {
|
||||
pub editor: Option<super::super::mode::editor::EditorState>,
|
||||
pub api_connected: bool,
|
||||
pub tick_count: u64,
|
||||
pub todo_content: String,
|
||||
}
|
||||
|
||||
impl MiscState {
|
||||
@@ -294,6 +295,7 @@ impl MiscState {
|
||||
editor: None,
|
||||
api_connected: false,
|
||||
tick_count: 0,
|
||||
todo_content: String::new(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user