feat: add todo management feature; implement todo content tracking and display in the UI
This commit is contained in:
+43
-5
@@ -29,6 +29,20 @@ use theme::Theme;
|
||||
pub fn draw(frame: &mut Frame, state: &crate::app::state::rest::AppStateRest) {
|
||||
let area = frame.area();
|
||||
|
||||
let show_todo = !state.misc.todo_content.is_empty() || state.misc.overlay == crate::app::state::types::Overlay::Todo;
|
||||
let (main_area, todo_area) = if show_todo && area.width > 60 {
|
||||
let h_chunks = Layout::default()
|
||||
.direction(Direction::Horizontal)
|
||||
.constraints([
|
||||
Constraint::Min(40),
|
||||
Constraint::Length(30),
|
||||
])
|
||||
.split(area);
|
||||
(h_chunks[0], Some(h_chunks[1]))
|
||||
} else {
|
||||
(area, None)
|
||||
};
|
||||
|
||||
let chunks = Layout::default()
|
||||
.direction(Direction::Vertical)
|
||||
.constraints([
|
||||
@@ -36,26 +50,50 @@ pub fn draw(frame: &mut Frame, state: &crate::app::state::rest::AppStateRest) {
|
||||
Constraint::Length(3),
|
||||
Constraint::Length(1),
|
||||
])
|
||||
.split(area);
|
||||
.split(main_area);
|
||||
|
||||
let main_area = chunks[0];
|
||||
let chat_area = chunks[0];
|
||||
let input_area = chunks[1];
|
||||
let status_area = chunks[2];
|
||||
|
||||
if state.misc.overlay.is_active() {
|
||||
if state.misc.overlay.is_active() && state.misc.overlay != crate::app::state::types::Overlay::Todo {
|
||||
let overlay = state.misc.overlay;
|
||||
render_overlay(frame, main_area, overlay, state);
|
||||
render_overlay(frame, chat_area, overlay, state);
|
||||
} else {
|
||||
render_main_panel(frame, main_area, state);
|
||||
render_main_panel(frame, chat_area, state);
|
||||
}
|
||||
|
||||
render_input_bar(frame, input_area, state);
|
||||
status::draw_status_bar(frame, status_area, state);
|
||||
|
||||
if let Some(todo_rect) = todo_area {
|
||||
render_todo_panel(frame, todo_rect, state);
|
||||
}
|
||||
|
||||
// Toast notifications at top-right (like Hyprland)
|
||||
render_toasts(frame, state);
|
||||
}
|
||||
|
||||
fn render_todo_panel(frame: &mut Frame, area: Rect, state: &crate::app::state::rest::AppStateRest) {
|
||||
let block = Block::default()
|
||||
.title(" Todo ")
|
||||
.borders(Borders::ALL)
|
||||
.border_style(Style::default().fg(Theme::PRIMARY))
|
||||
.style(Style::default().bg(Theme::BG));
|
||||
|
||||
let content = if state.misc.todo_content.is_empty() {
|
||||
"No tasks yet."
|
||||
} else {
|
||||
&state.misc.todo_content
|
||||
};
|
||||
|
||||
let paragraph = Paragraph::new(content)
|
||||
.block(block)
|
||||
.wrap(Wrap { trim: false });
|
||||
|
||||
frame.render_widget(paragraph, area);
|
||||
}
|
||||
|
||||
fn render_main_panel(frame: &mut Frame, area: Rect, state: &crate::app::state::rest::AppStateRest) {
|
||||
chat::draw_chat(frame, area, state);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user